Fork me on GitHub

I have a question about awyeah-api. The README specifies a specific git hash to use for the dependency on it and a specific git-hash for the dependency on org.babashka/spec.alpha. Is the idea I use those specific versions only forever? Or am I supposed to take the git-hash from current master or is there some other strategy I must use?


@U2G3G2S6S Yes, just take the SHAs from both master branches and upgrade when necessary


Is prepare supposed to download pods? I'm seeing some inconsistencies which I don't understand. (I'm posting shell output in the thread.)


% ../target/layer/bin/bb version
babashka v0.8.158-SNAPSHOT

% ../target/layer/bin/bb --config ./bb.edn prepare

% stat $BABASHKA_PODS_DIR       
stat: cannot statx '/home/pieter/.../.pods-dir': No such file or directory

% ../target/layer/bin/bb --config ./bb.edn -e "(require '[babashka.pods]) (babashka.pods/load-pod 'tzzh/mail \"0.0.2\")"  
Downloading pod tzzh/mail (0.0.2)
Successfully installed pod tzzh/mail (0.0.2)
#:pod{:id "pod.tzzh.mail"}

% cat bb.edn
{:paths ["src"]
 :deps  {}
 :pods  {tzzh/mail {:version "0.0.2"}}}

% stat $BABASHKA_PODS_DIR                                                                                               
  File: /home/pieter/.../.pods-dir
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 10302h/66306d   Inode: 10485967    Links: 3
Access: (0775/drwxrwxr-x)  Uid: ( 1000/  pieter)   Gid: ( 1000/  pieter)
Access: 2022-07-05 15:01:45.531117414 +0200
Modify: 2022-07-05 15:01:45.531117414 +0200
Change: 2022-07-05 15:01:45.531117414 +0200
 Birth: 2022-07-05 15:01:45.531117414 +0200


It should, yes:

prepare                       Download deps & pods defined in bb.edn and cache their metadata.


I'm not exactly sure what I'm looking at. Can you explain?


I have a bb.edn that contains a reference to a pod I want to use. I'm in the same directory as this file. I set BABASHKA_PODS_DIR and run prepare but it does not download anything. If I eval (load-pod ...) then the download happens, and it's using the correct BABASHKA_PODS_DIR.


so the prepare does not trigger the downloading of the pod


Can you just try:

bb -e '(+ 1 2 3)'
This should have the same effect as prepare



% ../target/layer/bin/bb --config ./bb.edn -e "(+ 1 2 3)" 

% ../target/layer/bin/bb --config ./bb.edn -e "(require '[babashka.pods]) (babashka.pods/load-pod 'tzzh/mail \"0.0.2\")"
Downloading pod tzzh/mail (0.0.2)
Successfully installed pod tzzh/mail (0.0.2)
#:pod{:id "pod.tzzh.mail"}


so that did work?


no, it does not download the pod in the bb.edn if I just eval a simple expression


I feel like such an idiot. I'm sorry... the mistake was on my side. There was an extra } in the bb.edn file, which messed things up


I was like it's almost like it's ignoring the bb.edn file and that was because the file was invalid.


Thanks for looking, sorry for wasting space.


extra } is the clojure equivalent of the extra ; problem in other languages i think :rolling_on_the_floor_laughing:


esp when I' just quickly using nano to edit, rather than something with smartparens...


humans balancing parens is just inhuman

bigfoot 1

might be nice to spit out a warning in this case like: "I found a file named bb.edn but I couldn't use it because X"?


Yeah, good idea. So what actually happened, the config file got ignored silently?


yes, the bb.edn file had unbalanced brackets of many kinds and if it showed a warning about that, I might have not bothered anybody here about it.

sheluchin15:07:08 from #sql... Has anyone used babashka along with Postgres COPY FROM to populate their DB from EDN? One suggestion was to convert the EDN to CSV using bb with data.csv first. Just wondering if someone has experience at this intersection of Postgres + jdbc and potentially babashka as the FROM PROGRAM.


You could also maybe use bb + honeysql to produce sql statements


I have been using HoneySQL in my program. Even with prepared statements and :auto-commit false, inserting a large number of records is pretty slow. I'm hoping COPY FROM can be of help, but it doesn't look like it can be, so I don't think HoneySQL has much of a role here. But I haven't been using next.jdbc for very long and I'd be happy to learn that I'm mistaken.


This may or may not suit your use case, but I have a (admittedly incomplete) library that uses Clojure protocols + jdbc connection to do postgres COPY for bulk import:

🙏 2

I doubt it works on bb, but I’ve also never tested


Thanks @U0AUQ25KP! I'll try that out and read through the source.