node.js has a similar feature for ensuring the version of the runtime (and even the OS and the CPU arch): https://docs.npmjs.com/cli/v7/configuring-npm/package-json#engines it's not necessarily the best place to copy ideas from, but might give u some ideas.
@richiardiandrea Maybe you are wrapping the arguments inside a vector while they should not be?
the first param is a vector that I want to store as json, the second and third two uuids
can you show the entire query, not just the result from the database?
oh I see
the vector should be saved as json?
there are docs for this: https://github.com/babashka/babashka-sql-pods/#json
let me know if this works for you
yeah that is the goal, i initially tried with the metadata but it was spitting that error then worked around it with json/generate-string
show me the original query with metadata that failed please
let me share that yeah, just a sec
because this should work and if not, I'ld like to know why
this is what it is not working
(defn update-diagnostic-report-descriptors!
[db-or-tx image]
(let [target-report (:target-report image)
query "UPDATE diagnostic_reports SET image_descriptors = (?::jsonb) WHERE id = ? AND version_id = ?"
sqlvec [query
^{:pod.babashka.sql/write :jsonb} (:image-descriptors image)
(:id target-report)
(:version-id target-report)]]
(db/execute-one! db-or-tx sqlvec)))
you need to write:
(with-meta (:image-descriptors image) {:pod.babashka.sql/write :jsonb} )
but in hindsight, I think I will change this, because this isn't very nice to writeI think I'll just offer (db/json ...)
and (db/jsonb ...)
that will handle this for you
ok let me try that...and why is that the case? I actually remember that I had to wrap some of my params in a function for attaching metadata once..
looks like that worked
this also works
> (def v ^{:pod.babashka.sql/write :jsonb} [])
#<SciVar@28395993: []>
> (meta v)
{:pod.babashka.sql/write :jsonb}
anyways, thank you for the hint 😄
yes, that works, but (meta ^{:m 1} (conj [] nil))
doesn't work
so I think it's better to just offer some function that handles these details
https://github.com/babashka/babashka-sql-pods/issues/31
I want to use https://github.com/retro/graphql-builder with babashka. It has dependencies which use java.util.concurrent...
stuff. What are my options here? Put graphql-builder in a pod? Rebuild babashka with java.util.concurrent?
I'd prefer to just add the necessary classes to upstream babashka. I assume the downsides are this expands the bb
binary size?
@gdwarner You can make an issue where you request the class with some evidence that this is useful for scripting and I'll take a look
why does a graphql lib need java.concurrent?
@gdwarner I tried this myself and this is needed in clj-antlr which in turn needs the java ANTLR library which is not supported in babashka
That's right. And that makes sense why it wouldn't work. Thank you.
Hi there, question about pods, is there a way to have load-pod
save to a local folder? I like the structure of ~/.babashka/pods/repository/org.babashka
and I would like to replicate it and then tar everything for distribution.
@richiardiandrea Currently not, but we could make this configurable perhaps, via some env var?
I'm also still conflicted between ~/.babashka
and ~/.bb
. In the future people might have a bb.edn
there too...
We could also add this to bb.edn
yeah, cause it's a bit cumbersome to download stuff manually like in this approach
https://github.com/eccentric-j/idle-parens/blob/8f4142d66698adadb321ace92da9ed79bbcbcedc/resources/blog/2021-01-27-clojure-like-its-php.md#the-clojure-files
Additionally, given pods are OS dependent, you would need to specify the target...
Yeah specifying pods in bb.edn
is a good option..what about this
{:paths ...
:deps ...
:pods {org.babashka/postgresql :github/version "0.0.5"}
And then
bb dump-pods <dir> <arch>
Yeah, something like that might work. Perhaps:
bb pods install /tmp/pods --arch ....
but then also:
{:pods {:dir "/tmp/pods" ....}}
if you want to load the pods from some specific diroh yes right good idea!
gonna open a feature request and start checking how difficult that would be to implement 😄
ok :)