Fork me on GitHub
#datomic
<
2019-01-09
>
Ben Hammond11:01:32

I have a datalog query that returns 10e6 rows. I wish to process these lazily I've been using the sample datalog function to work on subsets of data at a time but now I'm timing how long the sample takes and I'm not sure its any faster than a simple (take 256 (d/q ...)

Ben Hammond12:01:28

its not any faster

eoliphant13:01:46

q doesn’t return a lazy seq, but datoms does

Ben Hammond13:01:49

but now I've tried the datalog approach

Ben Hammond13:01:01

I shall get down and dirty with the datoms

eoliphant13:01:12

yeah q is generally what you want to start with, but in your case, sounds like just traversing one of the indicies might make more sense. Are you using on-prem or cloud? If it’s the former, you can say filter the db, then grab your datoms

Ben Hammond13:01:23

ooh I hadn't considered doing that. interesting

m_m_m13:01:19

Hi. I have problemy with my query: https://pastebin.com/bGRMKfxm it is really small. The error is: Caused by: java.lang.ClassCastException: mount.core.DerefableState cannot be cast to datomic.Connection I don't understand what is wrong with that. Any help? I am using datomic with Luminus framework.

Ben Hammond14:01:36

you are passing something unexpected as the parameter conn ?

Ben Hammond14:01:54

it needs to be a datomic.Connection

Ben Hammond14:01:25

but it is getting a mount.core.DerefableState whatever that is

Ben Hammond14:01:49

oh its probably a system state, isn't it

Ben Hammond14:01:25

so you would need to pluck your datomic Connection value out of the mount Derefable state

Joe Lane15:01:15

Hi friends, when reading the docs (https://docs.datomic.com/cloud/ions/ions-reference.html#parameters-example) it states NOTE The datomic-shared prefix is readable by any Datomic system. If you want more granular permissions, you can choose your own naming convention (under a different prefix!), and explicitly add permissions to the IAM policy for your Datomic nodes.

Joe Lane15:01:42

Does this mean any datomic system in my aws account or truly that a different org has access to whatever I put under that prefix?

marshall16:01:48

no, only within your account

Joe Lane16:01:38

Thanks @marshall, I know it seemed silly but I wanted to confirm.

marshall16:01:07

@joe.lane take a look at DatomicSharedParams in IAM

marshall16:01:12

it’s a role that gets created

👍 5
marshall16:01:24

"Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ssm:GetParametersByPath"
            ],
            "Resource": [
                "arn:aws:ssm:us-east-1:879742242852:parameter/datomic-shared/*"
            ],
            "Sid": "DatomicSharedParameters"
        }
    ]

marshall16:01:07

and if you look at the <stack-name>-<region> IAM role you’ll see a similar permission ^ under get-parameters

marshall16:01:17

"Statement": [
        {
            "Action": [
                "ssm:GetParametersByPath"
            ],
            "Resource": [
                "arn:aws:ssm:us-east-1:879742242852:parameter/datomic-shared/*"
            ],
            "Effect": "Allow"
        }
    ]

marshall16:01:32

notice, scoped to ARN

marshall16:01:46

all nodes will get a similar role

enn16:01:13

I'm attempting to work through the Datomic on-prem tutorial here: https://docs.datomic.com/on-prem/tutorial.html. The example of d/transact throws a ClassCastException for me:

(d/transact
    conn 
    {:tx-data [{:db/ident :red}
               {:db/ident :green}
               {:db/ident :blue}
               {:db/ident :yellow}]})
If I get rid of the containing map and the :tx-data and just pass the vector of idents, it seems to work as expected. Am I misunderstanding something?

matthavener16:01:36

that tutorial seems wrong to me

matthavener16:01:35

unless there’s some newer datomic om-prem API that accepts a map instead of tx data

enn16:01:31

OK, that was my instinct as well.

matthavener16:01:32

I’m running ‘0.9.5561.50’ and I get the same ClassCastException

enn16:01:33

Thank you.

enn16:01:53

Yes, I'm running 0.9.5661.

matthavener16:01:33

I think that must be a copy/paste error from a tutorial written for the client API https://docs.datomic.com/client-api/datomic.client.api.html

marshall16:01:05

yes, that’s client syntax

marshall16:01:10

i’ll fix the example. thanks for catching it

marshall16:01:51

oh. actually that tutorial is intended for use with the client lib

marshall16:01:03

based on the prior page that gets you connected with a client

marshall16:01:41

a similar walkthrough for using the peer API can be found here: https://docs.datomic.com/on-prem/peer-getting-started.html

matthavener16:01:03

the confusion probably came from the URL which contains “on-prem” https://docs.datomic.com/on-prem/tutorial.html

marshall16:01:17

On-prem supports both client and peer API access

matthavener16:01:26

ooh, didn’t know that 🙂

enn16:01:35

Ah, yeah, I just googled "datomic on-prem tutorial" so I didn't see the previous page.