Hi Lukas, Thank you so much for your quick reply! Great to know you have parsing arrays feature on your roadmap, it'll be worth the waiting :)
I'll look at the workarounds you recommended and see if they help solving my problem. Regards, Wendy On Thursday, May 18, 2017 at 3:59:25 AM UTC-4, Lukas Eder wrote: > > Hi Wendy, > > > > Thanks for your enquiry. For the record (if someone else finds this > message on the user group), I'll forward again my reply that I had sent you > earlier in a private email: > > > > Yes indeed, we currently do not support parsing arrays (or any other > “special” data types in the loadCSV() feature. There’s a pending feature > request for this on our roadmap: > > https://github.com/jOOQ/jOOQ/issues/3530 > > > > There are two workarounds: > > > > - Writing a custom Converter<String[], String>. If you encounter > further problems with this approach, we’ll be more than happy to help you > on the user group with that: > https://groups.google.com/forum/#!forum/jooq-user > - Loading and parsing the CSV content yourself and importing records ( > > https://www.jooq.org/doc/latest/manual/sql-execution/importing/importing-records/) > > or simple arrays ( > > https://www.jooq.org/doc/latest/manual/sql-execution/importing/importing-arrays/) > > instead. > > > > I hope this helps, > > Best Regards > > Lukas > > 2017-05-17 18:04 GMT+02:00 wendyl <[email protected] <javascript:>>: > >> I tried to load a csv file using the jooq loadCSV method (such as >> .loadCSV(inputStream).fields(fields).nullString("").execute()), one of the >> columns of my table in Postgres was defined as “character >> varying(100)[]”, it was generated as “String[]” in the generated pojo >> class, when the corresponding cell in the csv file contains something like >> “{A321, B456}” it didn’t work, upload failed. I have doubled checked that I >> used SQLDialect.POSTGRES and I also tried PostgresDSL instead of DSL, it >> didn't help. >> >> >> I also tried a jooq custom datatype converter and binding, my table >> column is defined as “character varying(100)[]”, before I used the >> converter it was generated as “String[]” in the generated pojo class; after >> I used the converter it was generated as “String” in the pojo, it didn’t >> work either, the code threw DataAccessException in “Loadimpl.java”. >> >> >> I know Postgres supports Array data type, when I used the same data to >> insert directly to Postgres database in pgAdmin, the query executed >> successfully and a row was inserted, the array column is populated with >> data like “{A321, B456}”. I also used "COPY ... FROM ..." sql to load a CSV >> file directly into Postgres database, it worked fine. >> >> >> I was wondering if this is something jooq hasn’t supported yet; if yes >> would the team support it in the future release? >> >> >> Look forward to getting some help. Thanks a lot. >> >> -- >> 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] <javascript:>. >> 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.
