Fork me on GitHub

hmmm, so... I want a query that returns a list of all items that match a predicate and a list of all items that do not match that same predicate... is that something that's possible with the datomic datalog?


as in, with a single query


I think the most common advice would be to do the split outside of the query, e.g. using group-by and your predicate.


It’s possible with a single query using or-join, but two queries is fine


(Or rules)


interesting.. or-join


will be studying that


hmm... anyone know what the problem here is?


#error {:message "Cannot parse rule-vars, expected [ variable+ | ([ variable+ ] variable*) ]"


The first argument to an or-join needs to be the set of variables to join with the rest of the query


in your case it would be [?address]


Hi, is it possible to insert a datom for a given db instant? I want to backfill historical data


You can set the tx instant of a tx in the past, but not before other tx instants


So if you already have newer data you can’t change history


If this is a one-time thing you can replay the tx log of the old db into a new one, injecting your historical txs as appropriate


This technique is called “decanting” for google


But if making stuff in the past is a regular thing you might have a separate domain of time and you should model that explicitly


@favila yes, I can inject in cronological order, how can I supply the tx instant when transacting?


geez thanks, I searched for that


e.g. {:db/id "datomic.tx" :db/txInstant #inst"2018-01-01"}


thanks again!


is there a good way to guarantee that an attribute can not appear on an entity unless another attribute is present?


in your application code or a transaction function


the only types of consistency datomic can maintain by itself are attribute value-type, unique-value (unique a+v asserted among all datoms), and any precondition (NOT postcondition!) you can test in a transaction function


gotcha, that makes sense


What's the best way to filter with a date range in a Datomic query? :where [(.after ?time-a ?x)]? something else?


you can use < and > with dates, e.g. :where [(> ?time-a ?x)]


cool. thanks!

Ethan Miller22:09:58

I have an app that I migrated to use datomic cloud, but have only used on my local dev machine so far. This is mostly just a toy app. What's the easiest, most advisable way to run it elsewhere. I've been using a docker stack running on a single machine to run the app, and I thought I might try to run the datomic-socks-proxy script in a docker container, but this is proving more challenging that I thought. Any suggestions?


use datomic ions


As above, use It uses CodeDeploy under the hood. From a usage perspective, it’s just a push command and a deploy command to have your app up and running in the same instance as Datomic.


For serving web pages, you set up API Gateway to call a lambda, which in turn calls a function in your app to serve the page.

Ethan Miller15:09:37

Hi, Sorry I missed this. I'll take a look at the ions. Just saw Rich Hickey's talk about it in NYC. But I had the impression that it would require significant re-engineering especially around the api layer.


If you're using ring, you're more or less ion ready.

Ethan Miller15:09:41

Ahh okay. I'll give it a shot then.

Ethan Miller17:09:40

@U0H2CPW6B I remembered you need to be using tools.deps to use datomic ions. Currently, this project just uses project.clj for deps.


Porting deps from Lein to tools.deps is pretty straightforward.

Ethan Miller18:09:14

Maybe this is a good bridge?

Ethan Miller18:09:49

Just a bit wary here because in moving to datomic cloud by far the most trouble I had related to dependency conflicts.


Yeah, if you're using overlapping dependencies, Datomic is going to override them, and inform you. You might as well stick to the versions it's using.

Ethan Miller19:09:43

Got the application to run locally anyway with lein-tools-deps. Only oddness is that I get errors if I declare clj-time in the deps.edn file and not in project.clj. (lein-deps-tools merges deps from deps.edn with dependencies specified in project.clj).


Is there any published version of Rich's slides from his Sep 12 clojure/nyc talk on Datomic Ions?


Hmm. Looks like at least some of them are the same from Stu's video on, but that recording makes them more easily readable. Reason for asking: I was planning to publish a transcript of Rich's Datomic Ions talk, and wanted to include images for at least some of the slides, similar to the transcripts that are already available here:

👏 12