Fork me on GitHub
#datomic
<
2018-09-17
>
caleb.macdonaldblack01:09:44

Is it recommended we use the peer? I have some old terraform that creates Datomic infrastructure for a peer. At first glance the docs seem to be in favour of using the client API these days. As far as I know though, querying in the client API is more limited than in the peer. Like for example the peer can run defined functions in data log queries. Is it fine to continue using the peer API and to be using this way?

clarice02:09:50

I am going through the examples in the docs (https://docs.datomic.com/on-prem/query.html#function-expressions) and came across

(d/q '[:find ?celsius .
       :in ?fahrenheit
       :where
       [(- ?fahrenheit 32) ?f-32]
       [(/ ?f-32 1.8) ?celsius]] db 212)
which gives me a ClassCastException datomic.db.Db cannot be cast to java.lang.Number clojure.lang.Numbers.minus (Numbers.java:137) Do you know why this could be happening? I hope it is just me that typed something in incorrectly.

bkamphaus03:09:34

@cbillowes first arg to :in clause when present needs to be data source (i.e. the db), so using :in $ ?fahrenheit should fix that. (right now since db is first query arg and no data source is in the :in query will use var db for ?fahrenheit

👍 4
clarice04:09:00

Ah I see, thanks. It works.

caleb.macdonaldblack05:09:27

Can I automate the creation of Datomic Cloud infrastructure? For example through bash or terraform? We want to be able to spin up infra without needing to navigate through the AWS Marketplace

jeroenvandijk14:09:33

I'm curious about this too

jeroenvandijk15:09:16

@U3XCG2GBZ I'm guessing you can use the template url provided in the cloudformation interface as a nested stack in a cloudformation template. Not sure if that url get's updated a lot. I'm assuming it shouldn't as it would mean there is a change in Datomic Ion configuration and you have to update anyway (=> getting a new url). That being said i'm curious for the official answer

jeroenvandijk16:09:47

It seems the public Datomic Ion template url is publically available (just did a test). This means the above is very likely to work

stuarthalloway17:09:27

@U0FT7SRLP we understand we can do more in this area and await your experience reports!

👍 8
caleb.macdonaldblack23:09:19

@U0FT7SRLP Thanks for the response. That’s what I’m going to do. Pull that cloud formation template url and use it in terraform.

kenny19:09:28

What is the recommended way to handle async operations in an Ion?

kenny19:09:41

For example: a service that needs to interact with an external service to create the proper response.

kenny19:09:32

I see in the event example project that <!! is used: https://github.com/Datomic/ion-event-example/blob/master/src/datomic/ion/event_example.clj#L106. Is this the recommended approach? Will you end up locking up the system in a high load situation?

spieden19:09:21

could exhaust the core.async thread pool for sure

spieden19:09:44

some kind of core.async/CSP support baked into ions would be nice

kenny20:09:10

That's what I figured. This seems like a pretty common use case and would certainly be a blocker for ours.

slipset20:09:04

Hi, sorry totally datomic cloud n00b

slipset20:09:48

I’ve been following the tutorial for setting up datomic cloud, and I’ve gotten to where I want to (d/create-database client {:db-name "users"})

slipset20:09:00

My config cfg looks like:

slipset20:09:21

(def cfg {:server-type :ion
          :region "eu-west-1" ;; e.g. us-east-1
          :system "datomic-test"
          :endpoint ""
          :proxy-port 8182})
;; => #'datomic-test.core/cfg
datomic-test.core> (def client (d/client cfg))
2018

slipset20:09:38

(d/create-database client {:db-name "users"})
ExceptionInfo Forbidden to read keyfile at . Make sure that your endpoint is correct, and that your ambient AWS credentials allow you to GetObject on the keyfile.  clojure.core/ex-info (core.clj:4739)
datomic-test.core>

slipset20:09:52

what am I missing?

slipset20:09:22

I have my socks proxy up and running and

slipset20:09:42

22:17 $ curl -x  .$DATOMIC_SYSTEM.$
{:s3-auth-path "datomic-test-storagef7f305e7-1bpzuyaf5d-s3datomic-1wgl6uvtl9bei"}✔ ~/Documents/datomic-test
22:21 $

slipset20:09:06

the socks proxy seem to be ok.

marshall20:09:22

the environment you’re running the REPL needs AWS credentials

marshall20:09:37

are you using Cursive or how are you launching your REPL?

slipset20:09:56

emacs/cider

marshall20:09:16

so however you setup your env vars / AWS credentials, you’ll need to make sure the env that you use to launch the REPL has them

marshall20:09:35

whether that’s sourcing in your shell before launching or whatever your tooling supports

slipset20:09:41

Ok, got it, I thought that was sortof taken care of by the socks proxy

marshall20:09:58

nope. the socks proxy env needs creds too

marshall20:09:05

but for different things

slipset20:09:18

ok. could be a thing to mention in the docs.

eraserhd20:09:23

We need to associate some computed data with each successive database value, but I can't find a way to do it. It's needed for performance reasons.

eraserhd20:09:21

We are using Clara Rules for checking database constraints for a Datomic on-prem system. Loading the whole database into Clara is too slow, so we want to incrementally add facts to Clara.

eraserhd20:09:50

We are using d/with, so we can't use basis-t as a unique identifier of a database value.

slipset20:09:06

@marshall setting the environment variables did the trick, thanks!