Fork me on GitHub
#datomic
<
2018-09-21
>
idiomancy02:09:54

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?

idiomancy02:09:45

as in, with a single query

donaldball02:09:52

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

favila02:09:30

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

favila02:09:01

(Or rules)

idiomancy02:09:22

interesting.. or-join

idiomancy02:09:30

will be studying that

idiomancy03:09:16

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

idiomancy03:09:39

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

marshall15:09:52

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

marshall15:09:01

in your case it would be [?address]

mping10:09:05

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

favila13:09:00

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

favila13:09:20

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

favila13:09:45

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

favila13:09:04

This technique is called “decanting” for google

favila13:09:09

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

mping14:09:44

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

mping15:09:22

geez thanks, I searched for that

favila15:09:34

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

mping16:09:55

thanks again!

idiomancy17:09:30

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

johnj17:09:17

in your application code or a transaction function

favila17:09:16

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

idiomancy18:09:24

gotcha, that makes sense

grzm19:09:00

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

csm20:09:37

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

grzm21:09:58

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?

rhansen06:09:12

use datomic ions

henrik09:09:28

As above, use https://docs.datomic.com/cloud/ions/ions.html 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.

henrik09:09:22

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.

rhansen15:09:34

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.

henrik17:09:52

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.

henrik18:09:42

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).

andy.fingerhut22:09:04

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

andy.fingerhut22:09:09

Hmm. Looks like at least some of them are the same from Stu's video on http://datomic.com, 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: https://github.com/matthiasn/talk-transcripts/tree/master/Hickey_Rich

👏 12