This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-22
Channels
- # announcements (88)
- # autochrome-github (2)
- # babashka (26)
- # beginners (5)
- # biff (2)
- # cider (73)
- # clj-kondo (4)
- # cljsrn (6)
- # clojure (54)
- # clojure-art (3)
- # clojure-europe (73)
- # clojure-germany (5)
- # clojure-new-zealand (1)
- # clojure-nl (13)
- # clojure-norway (16)
- # clojure-uk (8)
- # clojurescript (73)
- # conjure (1)
- # core-async (10)
- # cursive (17)
- # datahike (51)
- # datalevin (21)
- # datomic (4)
- # emacs (2)
- # events (3)
- # fulcro (35)
- # honeysql (6)
- # introduce-yourself (1)
- # jackdaw (3)
- # jobs (1)
- # leiningen (4)
- # lsp (3)
- # malli (17)
- # off-topic (60)
- # other-languages (5)
- # pathom (17)
- # pedestal (3)
- # polylith (19)
- # portal (2)
- # practicalli (1)
- # rdf (14)
- # reitit (3)
- # releases (1)
- # reveal (9)
- # sci (1)
- # shadow-cljs (26)
- # spacemacs (17)
- # sql (4)
- # testing (10)
- # tools-build (6)
- # tools-deps (16)
- # vim (9)
I'm scripting the creation of Datalevin database for testing. Is this the preferred method to create a new database with schema using dtlv
?
$ dtlv exec << EOF
(def conn (get-conn "/tmp/test-db"))
(close conn)
EOF
With an associated update-schema
call?
https://github.com/juji-io/datalevin/blob/master/doc/dtlv.md#shell-commandThe (help) for dtlv
indicates:
Datalevin (version: 0.5.28)
Type (help) to see available functions. Clojure core functions are also available.
Type (exit) to exit.
user> (help)
In addition to Clojure core functions, the following functions are available:
In namespace datalevin.core
So clojure.core
functions should be available. But
user> (load-file "demo.edn")
Could not resolve symbol: clojure.core/load-file
sorry, i should rephrase it, it’s not clojure.core, but rather the part of clojure.core functions that are implemented by sci
thx for letting us know. If people really need some functions, we can probably implement them, either in sci or datalevin.
babashka implements load-file just by slurping the file and then calling sci/eval-string on that, while binding sci/file to the filename
@URMJAL866 I would like to see a use case where load-file
is necessary for using Datalevin
Hi @U0A74MRCJ
I wanted to use dtlv
to set up a database via a bash script:
dtlv exec << EOF
(def c (get-conn "${DATABASE_DA:?}"))
(def schema ${schema:?})
(update-schema c schema)
(close c)
EOF
I wanted to load the schema from an edn
file. As a workaround, I created a bash variable and assign it as above. Direct loading would be much nicer.https://clojurians.slack.com/archives/C01RD3AF336/p1645571301374099?thread_ts=1645546081.277929&cid=C01RD3AF336
@U04V15CAJ I read about this in the babashka docs but it's not clear to me which features are exposed within the dtlv
interpreter:
Datalevin (version: 0.5.28)
Type (help) to see available functions. Clojure core functions are also available.
Type (exit) to exit.
user> (require 'sci/file)
Could not find namespace sci/file.
user> file
Could not resolve symbol: file
These things are not exposed in the interpreted scripts, but exposed in the interpreter API for creating script environments.
So it is something that needs to be exposed via Datalevin rather than a script I would write independently?
Please file issues in addition to discussing here, as I normally work through the issues when I get some time to work on Datalevin. Thanks!
Congratulations! And, thank you!