Fork me on GitHub
#datomic
<
2017-01-06
>
eoliphant01:01:56

hey guys quick question. I’ve got some datomic ‘enums’ i’ve created. do you know of any way to say list all of them with a certain prefix. say I’ve db/ident’ed :action/View, :action/Edit, etc and I want to get back a list of everything “:action"

potetm01:01:07

@eoliphant Not built-in AFAIK. Could probably use (comp #{"action"} namespace) as a predicate in a query or just a plain query+`filter`.

potetm01:01:51

(d/q '[:find [?i ...]
       :in $
       :where
       [?a :db/ident ?i]
       [((comp #{"artist"} namespace) ?i)]]
     (d/db (d/connect uri)))
=> [:artist/albums :artist/name]

potetm01:01:56

I'm a sucker for toy problems.

eoliphant01:01:26

lol i’ll bear that in mind thanks

eoliphant02:01:14

if any of you guys are still around @potetm , now running into a problem, i was using the collection binding to get going, but i need to pass in other variables, so I’ve switched over to a relation binding, but i’m getting a weird error.

(d/q '[:find ?e
       :in $ [[?subject ?scopes ]]
       :where 
       [?s :subject/identifier ?subject]
       [?e :assignment/subject ?s]
       [?e :assignment/contexts ?scopes]
       [?e :assignment/roles ?roles]

       [?roles :role/privileges ?privs]
       [?privs :privilege/action :action/View]
       [?privs :privilege/object :object/Award]
       ] db [["Andre Awarder"] scopeids] )
IndexOutOfBoundsException   clojure.lang.PersistentVector.arrayFor (PersistentVector.java:158)

I’ve got the 2 vars in the in clause and a list of 2 lists as the variable. But no idea why it’s complaining here

marshall03:01:00

Try :in $ ?subject [?scopes ...]

marshall03:01:03

And pass db "Andre Awarder" scopeids as args

marshall03:01:11

The form you have specified there indicates that the input should be a list of 2-tuples

eoliphant03:01:49

ah so you can mix and match bindings? I was wondering about that

eoliphant03:01:54

The Fixer strikes again.. Thanks!

tengstrand09:01:41

Is there a function that, like temp-id?, that checks if an id is a temp-id or not?

tengstrand09:01:08

I did this: (-> id last val neg?)

jonpither10:01:18

anyone used Packer to build DT AMIs?

karol.adamiec10:01:22

transactor or peers? have not done any, by the way 🙂, but could be interested...

karol.adamiec10:01:14

specifically for peers. i wrap them in docker atm, but sliding level down to packer and using systemd for lifecycle could be beneficial at some point :thinking_face:

jonpither10:01:00

Building a packer setup for the transactor... blog on it's way

jonpither10:01:20

then you can fine tune things like SSH access, log handling etc

karol.adamiec10:01:52

@jonpither fantastic. cant help but will read blog for sure 😄

jonpither10:01:05

it'll be short and sweet 🙂

karol.adamiec10:01:44

yeah, setting up transactor is a bit of kludgy atm. Even with terraform 😕

jonpither10:01:32

I think at least the packer bit can remove the fetching and installing of Datomic, if not the running with precise args (that last bit you'd still want Terraform)

jonpither10:01:50

Also with Packer you'd then have complete control of your AMI, so can choose to open up SSH etc

jonpither10:01:29

(you get complete control with Terraform also, but ideally the AMI should prebake as much as is sensible)

robert-stuttaford10:01:22

we’re using the stock AMI with TF

robert-stuttaford10:01:07

now that we’re no longer injecting the Datadog agent into the instance, it’s working great. for some reason it interfered with self-termination

souenzzo13:01:31

Hello, I'm having problems with some characters in the fulltext

(d/q '[:find ?e ?name
       :in $ ?search
       :where [?e :user/name]
       [(fulltext $ :user/name ?search) [[?e ?name]]]]
     db search)
When the search contains a !(and same other chars, in some positions), an exception occurs.

souenzzo13:01:30

Is this foreseen (I did not find anything in the docs)? Is there a blacklist of characters?

magnars13:01:24

When looking at :tx-data coming off the txReportQueue, it seems that :db/txInstant is always the first datom in the list. This makes it easy to find it. Is this part of the API proper, or should I not rely on it being like this?

magnars14:01:26

Right now I'm doing this:

(some (fn [[e a v]]
        (when (= :db/txInstant (:db/ident (d/entity db a))) v))
      tx-data)

marshall14:01:11

@magnars I don’t believe the API makes any guarantees about order

marshall14:01:18

I’d be wary of relying on it

magnars14:01:33

Thanks, @marshall - I shall keep the existing code then.