Is it possible to generate without schema at hand? #1551
Answered by skabbes
orkhanrustamli asked this question in Q&A
-
Hi, sqlc is very helpful for me when using for personal projects but I am thinking of how to implement it for my work tasks. Most of them time, the database (all tables and etc) are created by DB engineers, so I do not have schema file at hand. Of course I can ask to get schema file which can be feed to sqlc but I wonder whether it is possible to generate without schema? |
Beta Was this translation helpful? Give feedback.
Answered by skabbes May 3, 2022
Replies: 1 comment
-
Without the schema information, sqlc cannot know what types each columns is - and therefore it is (basically) impossible to know which data types to use. What I have done in the past for this is to just issue a pg_dump - assuming you have permissions to do so. pg_dump --no-privileges --no-acl --no-owner --schema-only --no-comments --encoding=utf8 postgres://your_db_here |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by orkhanrustamli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Without the schema information, sqlc cannot know what types each columns is - and therefore it is (basically) impossible to know which data types to use.
What I have done in the past for this is to just issue a pg_dump - assuming you have permissions to do so.