Exporting SQL including creation of DB schema
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!
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.
Thanks for the quick response! Trying to find another way to dump the database with used tables only.
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.
@Dzeri96 That's a really interesting idea. Thank you very much for it. I will definitely take a closer look at it!
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.
@Dzeri96 In the new release, there is now a feature ("Data Model" -> "Generate DDL Script") to generate the "create table/view..." statements using Liquibase.
There was a continuation of this topic here: https://github.com/Wisser/Jailer/issues/113 which finally resulted in release 16.1.3.