Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TableSchema to CREATE TABLE? #186

Open
isovector opened this issue Jul 1, 2022 · 4 comments
Open

TableSchema to CREATE TABLE? #186

isovector opened this issue Jul 1, 2022 · 4 comments

Comments

@isovector
Copy link

I'd like to pretend I don't have a database at all because I don't understand SQL, and am hoping rel8 can give me the SQL necessary to create the db/table it will talk to. Is this possible given a TableSchema?

@ocharles
Copy link
Contributor

ocharles commented Jul 1, 2022

I think this should be possible (though it won't be able to set up things like primary key and foreign key stuff), but we could probably whip something together to get the basics.

@isovector
Copy link
Author

I'm happy to add my own keys!

@isovector
Copy link
Author

I tried to implement this today (in library code), but AFAICT there simply isn't enough exposed by rel8. At the least, we'd need something equivalent to Rel8.Table.Name.showNames exported.

@ocharles
Copy link
Contributor

ocharles commented Sep 4, 2022

If you want to expose more, I think we'd be happy to accept a PR if it makes this work possible

abigailalice added a commit to abigailalice/rel8 that referenced this issue Aug 3, 2024
This closes circuithub#274 and circuithub#186, allowing the generation of CREATE TABLE
statements from a TableSchema, as well as testing the table's schema in
the database against the schema implied by the TableSchema type.

Co-authored-by: David Kraeutmann <kane@kane.cx>
abigailalice added a commit to abigailalice/rel8 that referenced this issue Aug 12, 2024
This closes circuithub#274 and circuithub#186, allowing the generation of CREATE TABLE
statements from a TableSchema, as well as testing the table's schema in
the database against the schema implied by the TableSchema type.

Co-authored-by: David Kraeutmann <kane@kane.cx>
abigailalice added a commit to abigailalice/rel8 that referenced this issue Aug 12, 2024
This closes circuithub#274 and circuithub#186, allowing the generation of CREATE TABLE
statements from a TableSchema, as well as checking a TableSchema against
a database to determine if the tables are defined correctly in the
database to be read from/written to by rel8.

It also adds tests for the creation and type checking of tables, to
ensure they succeed/fail in appropriate cases.

Co-authored-by: David Kraeutmann <kane@kane.cx>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants