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.
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.
Related tool pages
- CSV to Snowflake CREATE TABLE Generator: Generate a Snowflake CREATE TABLE and INSERT script from a CSV, JSON, Excel or Parquet file. Free, runs in your browser.
- CSV to BigQuery Schema and CREATE TABLE Generator: Generate a BigQuery CREATE TABLE and INSERT script (INT64, STRING, DATETIME) from a CSV, JSON, Excel or Parquet file. Free, in your browser.
- CSV to Databricks Delta DDL Generator: Generate a Databricks CREATE TABLE ... USING DELTA script and INSERT statements from a CSV, JSON, Excel or Parquet file. Free, runs in your browser.
- CSV to Redshift CREATE TABLE Generator: Generate an Amazon Redshift CREATE TABLE and INSERT script from a CSV, JSON, Excel or Parquet file. Types are chosen for you. Free, in your browser.
- dbt schema.yml Generator from CSV, JSON or Parquet: Generate a dbt schema.yml with columns, data types and unique / not_null tests from a CSV, JSON or Parquet file. Free, in your browser.
- CSV to SQL Converter: Convert a CSV to SQL: generate CREATE TABLE and INSERT statements for PostgreSQL, MySQL, SQL Server, Oracle or SQLite. Free, in your browser.
How to use the SQL Generator: step by step
- Open the SQL Generator and drop a CSV, JSON, Excel or Parquet file.
- Review the column types, lengths, nullable flags and primary key.
- Choose the dialect: Snowflake, BigQuery, Databricks (Delta) or Redshift.
- 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.