Fork me on GitHub
#datomic
<
2017-02-16
>
kardan05:02:08

I know there is a feature request for "Google Cloud Datastore” support. I guess now when Spanner became public this changes things a bit on how one could run Datomic in the Google cloud. Anyone know if Spanner would work out of the box as a SQL backend? I admit to not thought enough about this, but I’m as I said a little curious.

pesterhazy08:02:59

I think spanner doesn't support INSERT statements

pesterhazy08:02:30

From what I've read on hacker news, may not be accurate

casperc12:02:21

I am just wondering, given that :db/retract takes [:db/retract entity-id attribute value], what happens when I retract a value that is not the current value of the attribute on the entity?

lucascs12:02:01

it asserts that that fact is not valid

lucascs12:02:11

since it wasn't, nothing happens

niquola13:02:27

Hi, i’m newbie to datomic - could you explain current state of planner & statistic in datomic?

Lambda/Sierra13:02:11

@nicola Not sure, what exactly do you mean by "planner & statistic"?

niquola13:02:47

I mean, is there planner in datomic or not yet 🙂

niquola13:02:23

i’ve seen “most selective clause” in docs - which means - i’m a planner as developer?

Lambda/Sierra13:02:32

@nicola That is correct. Datomic datalog queries execute clauses in the order they are written. To ensure your query performs well, you should order the clauses so as to keep the "working set" of results as small as possible.

niquola13:02:57

But what if effective plan depends on data distribution?

Lambda/Sierra13:02:23

The datalog query engine has some optimizations built-in, such as range queries and predicates, but it does not attempt to analyze the distribution of your data.

niquola13:02:19

this means if my data is not the same shape - some query runs will be fast and some extremely slow?

baptiste-from-paris13:02:45

@nottmey working indeed for 0.9.5372 with the free version

Lambda/Sierra13:02:57

@nicola It means that you are responsible for monitoring and optimizing the performance of your queries based on your data. Future releases of Datomic may be bundled with tools to assist in this analysis, but they are not part of the current release.

niquola13:02:33

There are to edges of this problem - black magic of planners or manual optimisation - i hope clojurians will come up with something interesting in this area!

Lambda/Sierra13:02:12

Yes, the query-order execution in Datomic's datalog engine is by design: query behavior is completely deterministic.

niquola13:02:01

i.e. - now it’s isomorphic to execution plan, may be build next more declarative level abstraction on top of it

karol.adamiec16:02:44

how can one extract pull pattern outside of query? (d/q '[:find (pull ?tx [:db/txInstant]) (pull ?e order-pattern)` where order-pattern is ie [*] ?

karol.adamiec16:02:46

i have some more less hairy pull expressions that i would like to fold into one, and reuse, but it seems to escape me 😕

misha16:02:34

@karol.adamiec what do you want to achieve with this query? (I am having hard time to understand what it'd actually do)

karol.adamiec16:02:42

i want to def a pull pattern like [*] outside of query

misha16:02:12

why do you even use pull inside a query?

karol.adamiec16:02:17

(d/q '[:find (pull ?e [*]) i want to be (d/q '[:find (pull ?e my-def)

karol.adamiec16:02:36

well i need to tell it to pull stuf that is not a component

karol.adamiec16:02:37

of course IRL the [*] pattern is more complicated 🙂

misha16:02:13

why not:?

(let [ids (d/q [:find [?e ...] ...])
      entites (d/pull db ppattern ids)])

karol.adamiec16:02:48

well that definitely escapes the quoting issue

misha16:02:59

(and map/reduce afterwards, if you need interleave/group/etc.)

misha16:02:41

anyway, did you try (pull ?e ?my-def)?

karol.adamiec16:02:48

hmm, no, that has not occured to me. in that case ?my-def is argument to query that must also be referenced in the :in clause right?

karol.adamiec16:02:46

:db.error/invalid-pull Invalid pull expression (pull ?e ?pattern)

karol.adamiec16:02:52

seems not to work

karol.adamiec16:02:42

full q:

(d/q '[:find (pull ?tx [:db/txInstant]) (pull ?e ?pattern)
          :in $ ?pattern
          :where [?e :order/number _ ?tx]]
        db
        [*])

misha16:02:05

I'd like to hear from some one "official" pros/cons of pull within query, compared to (->> q pull-many (map/reduce))

karol.adamiec16:02:37

i have none to offer, maybe my style of writing queries is a takeover from REST endpoint…. 🙂

misha16:02:04

you are still doing both on client, there is no shame in doing grouping outside the query - it'the same machine, and no extra round trips to "db" or leveraging external CPU power

karol.adamiec16:02:41

on one hand yes, on other hand we move from declarative query into code territory 🙂

misha16:02:15

something like

(let [my-pp '[*]]
  (->> db
    (d/q '[:find [?i ?e]
           :where [?e :order/number _ ?tx
                   ?tx :db/txInstant ?i]])
    (map (fn [[t id]]
           [t (d/pull db my-pp id)]))))

misha17:02:50

what declarative actually does for you in this case?

karol.adamiec17:02:06

i see how that would work, but still would like to make the unqouting work. the query is a ‘[], there must be a way to unroll a datastructure inside somehow using ~

misha17:02:06

you might not need to specify pp in :in then (can't test it now, don't have datomic nearby)

misha17:02:43

this might be useful for you too:

As people ponder experimenting with ahead-of-time planners, I'll remind you that: 

 '[:find ?desc 
  :in $ % 
  :where 
   [?root :num 100] 
   [descendant ?root ?desc] 
   [?desc :num 4]] 

is just sugar for: 

 '{:find [?desc] 
  :in [$ %] 
  :where 
  [[?root :num 100] 
   [descendant ?root ?desc] 
   [?desc :num 4]]} 

karol.adamiec17:02:30

looks good, thx. had no luck with that today. I am missing some fundamental thing here…

misha17:02:21

http://docs.datomic.com/query.html#sec-4-2

Query
find-elem                  = (variable | pull-expr | aggregate)
pull-expr                  = ['pull' variable pattern]
pattern                    = (input-name | pattern-data-literal)

timgilbert20:02:35

@dazld: forgot to mention another tutorial resource: http://www.learndatalogtoday.org/

dazld20:02:22

thanks tim

dazld20:02:32

that site is down though...?

dazld20:02:53

nevermind! it's back :)

timgilbert20:02:45

Sweet. I haven't actually looked at it much, but I've heard people mention it and tutorials are pretty thin on the ground

gardnervickers22:02:05

We’re currently trying to stand up a Datomic transactor in the cn-north-1 AWS region. The DynamoDB endpoint for that region is . I understand the transactor.properties file allows for setting an override endpoint for things like ddb-local. Doing that won’t allow me to set an aws-dynamodb-region, and removing the region won’t let me use the ddb protocol.

gardnervickers22:02:33

Are there any workarounds for this? ddb-local used against real Dynamo causes the transactor to crash.

jdkealy22:02:42

is it possible to get an entity's created time from an entity itself ( not from a query )? e.g. (:tx-time entity) or something like that?

pesterhazy23:02:56

@jdkealy I don't think it's possible using d/entity or d/pull

jdkealy23:02:01

cool thanks