This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-14
Channels
- # ai (24)
- # announcements (36)
- # babashka (15)
- # babashka-sci-dev (8)
- # beginners (18)
- # biff (4)
- # calva (24)
- # cider (13)
- # clj-kondo (1)
- # clj-on-windows (2)
- # clojars (15)
- # clojure (120)
- # clojure-dev (13)
- # clojure-europe (69)
- # clojure-nl (1)
- # clojure-norway (8)
- # clojure-uk (2)
- # clojurescript (4)
- # core-logic (2)
- # cursive (6)
- # datomic (193)
- # dev-tooling (4)
- # emacs (1)
- # hyperfiddle (57)
- # lsp (56)
- # malli (11)
- # missionary (15)
- # nbb (61)
- # off-topic (8)
- # polylith (8)
- # practicalli (2)
- # proletarian (1)
- # reitit (3)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (13)
- # spacemacs (1)
- # specter (2)
- # sql (17)
- # tools-deps (3)
- # vim (38)
Has anyone ever tried to use the copy command from a stream inside clojure? In other words, generating the data programmatically and streaming it to the command, instead of to a file and then reading it into the copy command. I see the STDIN
option, but not sure how to wire that into a Clojure stream, or if it’s even possible.
So you did it without using the filesystem, just streams within clojure?
That looks like what I need. I assume I could use a lazy sequence in place of the async call.
The 2 PG classes look important as well. Where can I find those?
Any jdbc for postgres?
Yeah, just replace the loop
with doseq
perhaps. The imports are:
(org.postgresql PGConnection)
(org.postgresql.copy PGCopyOutputStream)
Perfect. I’ll give them a try!
Thanks!
From the Clojure deref I saw this https://github.com/igrishaev/pg Haven't tried it yet, but I will
I saw that as well. Bookmarked!
@U061KMSM7 It's possible now with pg 0.1.9, please check out the docs: https://github.com/igrishaev/pg/blob/master/doc/090-copy.md
Briefly, there are a couple of functions that take a seq of rows/maps and send them to the database without having an intermediate stream
@U1WAUKQ3E Excellent, thank you!