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

Exporting SQL including creation of DB schema #111

Open
MoritzTheile opened this issue Mar 25, 2024 · 7 comments
Open

Exporting SQL including creation of DB schema #111

MoritzTheile opened this issue Mar 25, 2024 · 7 comments

Comments

@MoritzTheile
Copy link

When exporting the resulting sql file contains insert statements only. Meaning I need to have a db with fitting schema in order to import the data.

It would be great if the exported sql file would contain all sql including e.g. CREATE TABLE statements so I can execute on a newly created database.

Or maybe I oversee an existing feature?

Great software by the way! Donation incoming!

@Wisser
Copy link
Owner

Wisser commented Mar 25, 2024

Creation scripts for the tables are currently not created automatically. Please use the appropriate tools of your DBMS for this.

The creation of DDL scripts is highly DBMS-specific and thus non-trivial. I do not believe that such a feature would work satisfactorily in Jailer. I would always resort to database on-board means. This is the only way to guarantee complete and error-free creation of all database objects.

@MoritzTheile
Copy link
Author

Thanks for the quick response! Trying to find another way to dump the database with used tables only.

@Dzeri96
Copy link

Dzeri96 commented Mar 29, 2024

I know this issue is closed, but what about using Liquibase as a library to do the schema export (it has the generate-changelog command)? I've noticed that Liquibase does not do schema subsets well, because it always includes foreign key constraints, no matter if the referenced table is included or not. Having Jailer tell it exactly which tables it needs and then using its engine to export the schema seems like a great match.

@Wisser
Copy link
Owner

Wisser commented Mar 29, 2024

@Dzeri96 That's a really interesting idea. Thank you very much for it. I will definitely take a closer look at it!

@Dzeri96
Copy link

Dzeri96 commented Mar 29, 2024

I also opened a corresponding issue with liquibase, but no matter which way it goes, I still think integrating it into Jailer is a good idea. You could probably even offload some of the model analysis to it since it can talk to so many databases.

@Wisser
Copy link
Owner

Wisser commented Apr 19, 2024

@Dzeri96
In the new release, there is now a feature ("Data Model" -> "Generate DDL Script") to generate the "create table/view..." statements using Liquibase.

@Wisser Wisser reopened this Apr 19, 2024
@Wisser
Copy link
Owner

Wisser commented May 3, 2024

There was a continuation of this topic here: #113
which finally resulted in release 16.1.3.

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

3 participants