Hi Yacine,

Hmm, I'm not aware of this H2 feature and how it works, but you could do a
couple of things with jOOQ instead:

1. Use a file-based H2 database and import your CSV files with Flyway or
the maven-sql-plugin prior to using that database with the jOOQ code
generator plugin.
2. Write your own jOOQ-meta Database implementation and feed that to the
code generator, rather than an H2Database. That should be quite
straightforward. Just extend the jOOQ-meta org.jooq.util.AbstractDatabase
and implement the getTables0() method.
3. Extend the H2Database and override the create0() method to simply run
your CREATE TABLE AS SELECT * FROM CSVREAD(...) statements in the
configured Connection. You could take inspiration from the JPADatabase
(located in jooq-meta-extensions), which does something similar.

I think #3 might be the most straightforward.

Hope this helps,
Lukas

2017-05-04 12:22 GMT+02:00 FANTOUSSI Yacine <[email protected]>:

> Hi All,
> We are using jooq to generate model form csv file with maven
> (jooq-codegen-maven3.6.4)
>  we need to run n csvs to generate the whole model.
>
>
> we have something like this in our pom.xml
>
>   <jdbc>
>                                 <driver>org.h2.Driver</driver>
>                                 <user>pass</user>
>                                 <password>pass</password>
>                                 <url>jdbc:h2:mem:test;INIT=CREATE TABLE
> MY_TABLE AS SELECT * FROM CSVREAD('src/test/resources/
> myFile.csv');TRACE_LEVEL_FILE=0;TRACE_LEVEL_SYSTEM_OUT=0</url>
>  </jdbc>
>
>
> is it possible to have something like this working ?
>
>
>
> <jdbc>
>      <driver>org.h2.Driver</driver>
>      <user>sa</user>
>      <password>sa</password>
>      <url>jdbc:h2:mem:test;INIT=CREATE TABLE MY_TABLE_A AS SELECT * FROM
> CSVREAD('src/test/resources/myFileA.csv');TRACE_LEVEL_
> FILE=0;TRACE_LEVEL_SYSTEM_OUT=0</url>
>      <url>jdbc:h2:mem:test;INIT=CREATE TABLE MY_TABLE_B AS SELECT * FROM
> CSVREAD('src/test/resources/myFileB.csv');TRACE_LEVEL_
> FILE=0;TRACE_LEVEL_SYSTEM_OUT=0</url>
>  </jdbc>
>
>
> or an INIT clause like this :
>
>
> INIT=CREATE TABLE MY_TABLE_A AS SELECT * FROM 
> CSVREAD('src/test/resources/myFileA.csv')
> ; CREATE TABLE MY_TABLE_B AS SELECT * FROM CSVREAD('src/test/resources/
> myFileB.csv');
>
>
> Thanks for your answers
> Regards,
>
>
> Yacine
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to