https://kotlinlang.org logo
m

Marcel Overdijk

03/31/2021, 12:24 PM
Hi, I'm wondering if #exposed could also be used as a SQL generator (without interacting with the database itself). In my case I have data in various CSV files for which I need to generate a *.sql script with DDL and insert statements. The generated *.sql script can then be used by others to import it in their database. Now
SchemaUtils
has a
createStatements
fun that could do the DDL part, but I cannot find anything to simply generate the SQL for inserts.
👀 1
e

Endre Deak

03/31/2021, 6:07 PM
what do you mean by interaction?
m

Marcel Overdijk

04/01/2021, 7:43 AM
I mean not writing to the database itself (not even having a database connection) I basically just want to define the table deifnitiions, and write the DDL statements from it to a file, together with generated insert statements.
e

Endre Deak

04/01/2021, 4:44 PM
I’ve tried the same but with read queries and it seems that currently you must have at least one active transaction to get the corresponding SQL
m

Marcel Overdijk

04/01/2021, 5:24 PM
Thx for confirming, I thought the same
5 Views