Simplest way to get all database names


#1

Hey all,

What is the simplest way to interact with Datomic in a general way? For example, I would like to see all the database names on my local dev setup, just to make sure I am not duplicating one of my backups… maybe the backup DB already exists. In this example, bin/datomic is useless haha. It tricks you because it says datomic. Anyways let’s ignore that. Now I found this: https://docs.datomic.com/on-prem/clojure/index.html#datomic.api/get-database-names. Exactly what I am looking for, but how do I run it? I can run a Clojure REPL, require datomic.api and execute the get-database-names function. That’s fine, but it’s time consuming for a quick admin task. With PostgreSQL you connect and run \dt. That’s 2 steps instead of 3! You can even do it in 1 step with the -c flag. Much easier in my opinion. Are there any plans to support common functionality in a higher level context, like a command line script (e.g. bin/datomic get-database-names uri) ?

Thanks!


#2

Hi Lucas,

We don’t currently have a specific built-in script to run something like that. You can use Clojure’s CLI to run the process from the command line:

clojure -Sdeps '{:deps {com.datomic/datomic-pro {:mvn/version "0.9.5697"}}}' -e '(require (quote [datomic.api :as d])) (d/get-database-names "datomic:dev://localhost:4334/*") (System/exit 0)'

That is admittedly not the prettiest option.
I’ve added “Built-in command-line support” for this kind of operation as a feature request in our Suggest Features portal


#3

I have a docker image for datomic-utility for running shell scripts like what Marshall described, including backup/restore.


#4

Thanks marshall,

Just checking in case I missed something on the docs. Hopefully this question helps anyone else wondering the same thing. I have tried to access the link you provided. It seems I need an account already and there isn’t a straightforward way to create one. Is the Datomic issue tracker public? Can I give my opinion on feature requests there? Edit: I received an invitation link in my email.


#5

Hey dustingetz,

Is your docker image public? Do you have a link? Thanks.


#6

I took the liberty of creating an account for you in the feature request portal. You can also access it via your my.datomic.com account by clicking the “Suggest Features” link in the top navigation bar.

-M