Fork me on GitHub
#datomic
<
2024-01-28
>
hifumi12304:01:51

Does Datomic’s pull syntax support wildcards with a namespace? My intent is to pull all attributes with a given namespace, rather than pulling everything then dissoc-ing or manually tracking and specifying attribute names.

favila14:01:58

No. Also I caution you against wildcards except in development. Listing every attribute enumerates what your code consumers may expect, and this allows you to change the names of attributes in schema without breaking deployed code.

hifumi12320:01:19

A bit unfortunate but I can see why what I want is a bad idea now. Thanks

hifumi12309:01:51

There seems to be a typo in https://docs.datomic.com/pro/schema/schema.html#entity-specs In particular, “checkes” in > :db/ensure is a virtual attribute. It is not added in the database; instead it triggers checkes based on the named entity.

Andrew Berisha16:01:38

Quick question: How to run a client?

Andrew Berisha16:01:36

I have a remote postgres instance acting as storage, I have a local transactor, and I have successfully connected to it using the repl with peer. I'm trying to set up something like the legacy REST server but I see that that's outdated and it's recommended that I use the Client API. I was wondering if that's an executable with the datomic-pro folder? I reason that it might be there because I am running transactor like

./bin/transactor -Ddatomic.printConnectionInfo config/heroku-postgresql-transactor.properties
and I can run the rest service like
bin/rest -p 8001 sql 'datomic:sql://?jdbc:postgresql://:5432/?user=&password='
(although with the REST running, I can see my database but it says Resource not found. when trying to get info on it)
datomic-pro-1.0.7075 % curl /-/
Resource not found.%     

Andrew Berisha16:01:03

I think I found the answer https://nextjournal.com/vgautam/getting-started-with-datomic-and-postgres#b.-1---starting-a-peer-server It looks like I need to start a peer server first

bin/run -m datomic.peer-server -h localhost -p 9004 -a myaccesskey,mysecret -d hello,datomic:

Joe Lane17:01:03

Why start a client instead of a peer if you’re using Pro? Any particular reason you want the client API?

Andrew Berisha17:01:16

I'm running a flask server with python, so I was reading pydatomic https://docs.datomic.com/pro/reference/languages.html#third-party-libraries and it uses the legacy REST API. The REST API page says that new projects should user the Client API https://docs.datomic.com/pro/api/rest.html So I'm just going down the chain of links as I'm learning

👍 1
Andrew Berisha14:01:52

So my blunder was the following:

bin/rest -p 8001 sql 'datomic:sql://<DB-NAME>?jdbc:postgresql://<HOST>:5432/<DB-NAME>?user=<USER>&password=<PASSWORD>'
it should have been
bin/rest -p 8001 sql 'datomic:sql://?jdbc:postgresql://<HOST>:5432/<DB-NAME>?user=<USER>&password=<PASSWORD>'
which is similar to how the console is run (by removing the leading <DB-NAME> from the db-url