sql

Nadav Benyamini 2023-12-26T09:35:41.688739Z

Hi, can anyone help me with fetching arrays/JSONs from Snowflake? 🙏 I tried following the documentation but couldn't get it to work, see screenshots

igrishaev 2023-12-26T09:37:39.666719Z

Perhaps you need to extend JDBC protocol to decode PGObject: https://github.com/seancorfield/next-jdbc/blob/44b3cc206fe4635702331814da0860e63261e9ec/doc/tips-and-tricks.md?plain=1#L364

Nadav Benyamini 2023-12-26T09:41:10.862449Z

Thanks, that's what I tried to follow, but it's all about Postgress and I'm using Snowflake

igrishaev 2023-12-26T09:44:59.929539Z

sorry, I didn't notice Snowflake. Anyway, I still think you need to extend the protocol as described in the document. You need to check what parameters you have in the read-column-by-label method.

Nadav Benyamini 2023-12-26T09:45:27.522239Z

Ok I'll look into it, thanks a lot

igrishaev 2023-12-26T09:47:00.751409Z

namely, the second parameter is ResultSetMeta object, and the third is an integer index. Using these two, you can get a type of the column, and if it's "json" or something, decode the value from a string.

👍 1
seancorfield 2023-12-26T23:24:22.658389Z

Anyone using MySQL and also using virtual threads?

seancorfield 2023-12-26T23:25:30.349579Z

I decided to try the virtual threads option for Jetty 12 and enabled short stacktraces for pinned vthreads... and got thousands of these:

Thread[#62,ForkJoinPool-1-worker-1,5,CarrierThreads]
    com.mysql.cj.protocol.ReadAheadInputStream.read(ReadAheadInputStream.java:180) <== monitors:1
    com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:889) <== monitors:1
    com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:968) <== monitors:1
which suggests that the MySQL DB driver won't play nice with vthreads?

seancorfield 2023-12-26T23:49:30.058729Z

Yeah, just found two bugs in the MySQL driver tracker about it -- and an article saying the MySQL driver is just about the least virtual thread friendly one out there, for now 🙂

seancorfield 2023-12-26T23:50:30.686139Z

At least they're working on it. But I'm already having "fun" with New Relic and Jetty 12 (even without vthreads) so this may end up being moot anyway...