Fork me on GitHub
Kris C11:03:06

How do you use :xform on a map specification [{:user/type [:db/ident]}]? I want to :xform the resulting {:db/ident :something}


[{(:user/type :xform fn) [:db/ident]}]


I don’t know how “undefined behavior” this is though


but it does work

Kris C13:03:10

huh, how did you figure this one out?!


it fits the grammar


it’s an attribute spec where a bare attribute would be


that’s the pattern

Kris C13:03:23

Thanks again, @U09R86PA4, you're the man! 😉

Shuky Badeer15:03:21

Hi guys! I'm using presto SQL CLI to query Datomic from the terminal using sql. Now the output here makes some sense. One thing i noticed here is that it appends "v1/statement" to the original server url (as shows in the first line of the error). I'm not sure what I'm doing wrong but would appreciate some feedback.

Joe Lane16:03:13

@U033V0AJFU4 Can you show you're client config in your etc/catalog/<catalog>.properties?

Shuky Badeer16:03:00

Hi @U0CJ19XAM I suppose I'll need to ssh into the Datomic EC2 server for that. Since I currently don't have the private pem key I'll get back to you on that tomorrow?

Joe Lane16:03:05

Why would you need to do that? datomic analytics can be run from your local laptop and connect to your cloud nodes.

Shuky Badeer16:03:37

Oh ok sorry i'm new to the clojure/datomic world. So in my local db there's no catalog folder in the etc folder

Shuky Badeer16:03:13

That's why i thought u were talking about the ec2 server

Shuky Badeer16:03:21

@U0CJ19XAM etc/catalog/ is a folder that was supposed to be set up?

Joe Lane16:03:30

Check out that configuration page, it should have the information you need. And yes, the catalog folder and it's contents need to be set up when you configure your trino cluster.

Shuky Badeer16:03:23

Roger that! Will get going on it in the morning and will let u know what happened. Thanks a lot @U0CJ19XAM much appreciated!

👍 1
Shuky Badeer12:03:17

Hello from the future, anyone reading this thread, turns out Windows has WSL (Windows subsystems for Linux) which allows you to run Ubuntu on Windows! Incredibly amazing! After setting that up, and following the tips from @U0CJ19XAM I was able to run Presto on the Ubuntu subsystem and querying Datomic using SQL - Pretty cool! Big thank you @U0CJ19XAM for the support!

👍 1

hello everyone, how can I find all transactions that happen to a specific entity on datomic?


(into #{} (map :tx) (d/datoms (d/history db) :eavt specific-entity)) possibly


I have a function like so:

(defn by-id
  "take an id, return the instance of it"
  [id & [_db]]
  (let [_db (or _db (_d))]
      (d/entity _db id)
      (catch Exception _ nil))))
it returns the entity if I give it an id: (by-id 12123413535) => #:db{:id 12123413535 } But it returns this for every id, even the ones that were retracted. How do I identify if an id was retracted?


“id was retracted” — you need to narrow down what this means for your application


datomic does not come with a notion of existence, that’s a domain concept. It only models assertions and retractions, and entity maps are a projection of those into map form by filtering+joining all datoms which share the same E value.


if you have a unique public id you put on your entities, and the presence of that assertion means the entity “exists” in your domain model (very common), you can test for the presence or absence of that assertion and filter; or you can use it directly as a lookup ref [:my-id 123] and the lookup will simply not resolve to an entity id if it isn’t there.