babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2021-02-24T11:17:02.061200Z

This could be useful in case you want to port a babashka script to deps.edn and want to compile it with GraalVM, perhaps.

anthony-galea 2021-02-24T13:21:44.063200Z

I'm trying to write a babashka script that involves reading data from postgres. Some of this data is in a json column. When my query runs I see: Cannot read EDN: ... #object[org.postgresql.util.PGobject .... :cause "No reader function for tag object" I've noticed that sql-pods uses the next.jdbc library so I tried following the advice here: https://cljdoc.org/d/seancorfield/next.jdbc/1.0.445/doc/getting-started/tips-tricks#working-with-json-and-jsonb but I get: Could not find namespace: next.jdbc.result-set.

borkdude 2021-02-24T13:23:12.064100Z

@anthony-galea I think this should be improved in the sql-pods probably. Feel free to post an issue. For now you could maybe coerce the JSON into a string in the query first

borkdude 2021-02-24T13:24:30.065200Z

What causes the issue: a json(b) field is represented by some PGobject, but this PGobject isn't converted into EDN automatically so it's trying to be sent over the wire as EDN but this doesn't work when you read it back in

borkdude 2021-02-24T13:25:36.065900Z

We can decide to automatically convert the PGobject to a Clojure value, but this would involve making some pre-determined choices which might cause surprises for the user?

borkdude 2021-02-24T13:26:14.066300Z

so instead you can select the field as text using ::text and then do the conversion yourself

borkdude 2021-02-24T13:26:48.066600Z

We should either fix this or document this. Happy to hear your feedback.

anthony-galea 2021-02-24T13:31:31.068300Z

I think the ::text route should be fine in my case @borkdude, thanks!

borkdude 2021-02-24T13:53:58.068700Z

@anthony-galea Added some docs here: https://github.com/babashka/babashka-sql-pods/#troubleshooting

πŸ‘ 1
anthony-galea 2021-02-24T14:05:17.069900Z

Great, thanks @borkdude Meanwhile I can confirm that the ::text route worked fine for my usecase

anthony-galea 2021-02-24T14:08:21.071100Z

Just out of curiosity, is there some reason that the next.jdbc nss are not available though?

borkdude 2021-02-24T14:08:45.071600Z

It's just that someone hasn't asked about it before probably

borkdude 2021-02-24T14:09:08.071900Z

Please post an issue of what you need + optionally a PR

anthony-galea 2021-02-24T14:10:18.072100Z

Will do, thanks again

borkdude 2021-02-24T15:54:54.072400Z

πŸ’― 1
πŸš€ 8
πŸ˜„ 1
borkdude 2021-02-24T15:55:04.072700Z

@emilien ^ :)

grazfather 2021-02-24T15:58:41.072900Z

that’s beautiful