Why are all the metadata inputs full SQL commands?

#2
by teknium - opened

Instead of CREATE database commands as the extraneous data why not just have a schema of the database there, which is more likely what users would input?

Defog.ai org

Hi @teknium , could you give an example by what you meant as "a schema of the database"? We chose CREATE TABLE commands as it's part of the Data Definition Language (DDL) that's commonly used to initialize and define tables and their respective columns in a database, and is universally supported across most major SQL dialects (though the types would vary slightly). The CREATE TABLE statements can also be easily exported from most major SQL clients which makes it easier for users with a database running in production to export, copy, paste the metadata and start querying.

So is this the typical way a user would describe an SQL Schema? with the full command to recreate it? Thank you

Defog.ai org

Yes afaik this is the most common way that databases are specified. For postgres, you can get it via:
pg_dump -t 'schema-name.table-name' --schema-only database-name
Please see the postgres docs here https://www.postgresql.org/docs/current/app-pgdump.html for more information on the full set of options available.

Sign up or log in to comment