CREATE TABLE for Snowflake, BigQuery, Databricks and Redshift

Create warehouse-ready table scripts and a dbt schema.yml from a sample file, in your browser.

Open the SQL Generator

Every cloud warehouse names its types differently. A number is INTEGER in Snowflake, INT64 in BigQuery, INT in Databricks and INTEGER in Redshift, and quoting and string escaping differ too.

The SQL Generator reads a sample file, guesses a type for each column, and lets you change any of them. Pick Snowflake, BigQuery, Databricks (Delta) or Amazon Redshift and it writes the matching CREATE TABLE and INSERT statements. BigQuery keys are written as NOT ENFORCED and text is escaped with a backslash. Databricks tables end with USING DELTA.

Switch Output to dbt schema.yml to get a model with every column, its data type for the chosen warehouse, and unique and not_null tests from the primary key and nullable settings. Nothing is uploaded: the file is read on your device.

Open the SQL Generator

Related tool pages

How to use the SQL Generator: step by step

  1. Open the SQL Generator and drop a CSV, JSON, Excel or Parquet file.
  2. Review the column types, lengths, nullable flags and primary key.
  3. Choose the dialect: Snowflake, BigQuery, Databricks (Delta) or Redshift.
  4. Copy or download the SQL, or switch Output to dbt schema.yml.

When to use the SQL Generator

  • Creating a table in Snowflake or BigQuery from a CSV
  • Starting a dbt model file with column types and tests
  • Making a Delta table definition for Databricks
  • Writing test fixtures for a warehouse

Example

Input: id,name,age 1,Ada,36 2,Alan,41

Output: CREATE TABLE people (id INT, name VARCHAR(10), age INT); INSERT INTO people VALUES (1, 'Ada', 36);

Frequently asked questions

Does it connect to my database?

No. It only writes the SQL for you to run yourself.

Which databases does the SQL Generator support?

PostgreSQL, MySQL and MariaDB, SQL Server, Oracle and SQLite. It writes CREATE TABLE and INSERT statements from a CSV, JSON, Excel or Parquet file, and guesses column types from your data.

Tip: For very large loads use the warehouse bulk loader (COPY INTO, bq load, COPY) and keep INSERT for samples and tests.