Fork me on GitHub
#datomic
<
2020-10-07
>
cjmurphy00:10:06

Is there a library out there such that whether using :peer or :client is mostly unknown from your application code's point of view?

Lennart Buit06:10:59

You can use the client library to connect to an on-prem peer server. The client library is the lowest common denominator in that sense ^^

cjmurphy08:10:15

Yes, in a sense the peer library is on the way out?? I was asking because I use such a peer/client ambivalent library internally, and was thinking to make it open source.

Lennart Buit09:10:05

Well I’m not at cognitect, so I can’t answer that. But if you intend to migrate from on-prem to the cloud at some point, you are better off with the client api, so it appears to be ‘good advice’ to start new projects with the client api

Lennart Buit09:10:52

Also; there are quite a few subtle differences between the api’s. The query dialect is slightly different (most notably, not all :find specs in peer are supported in client), and many functions have slightly different arguments/return values (for example, many functions return deref’able things in peer, but direct results in client).

cjmurphy14:10:38

I must have ignored the 'good advice' initially, hence the compatibility library. For the :find differences I've just changed all the queries to work for the client, which means they can work for both. Other subtleties I've found have just been taken care of by the library - basically it is a map that includes some wrapper functions that choose to use one function or the other - for example either one of the two variants of transact , depending on the 'mode' being used.

xceno12:10:44

Can't I build/push a datomic ion that includes an alias? Meaning: I have an application and bundle datomic-ion specific stuff under a :datomic alias. I then want to push it like this: clojure -M:datomic:ion-dev '{:op :push}', but when I check the zip file that's generated all the stuff from my alias (specific namespaces & resources) is missing. Am I doing something wrong or is this just not supported?

marshall13:10:29

@rob703 I believe you want -A:aliases

xceno13:10:07

I actually tried both and various combinations thereof yesterday. My initial cmd was clojure -A:datomic -M:ion-dev ... and I also tried the variant straight from the docs: clojure -A:datomic:ion-dev -m datomic.ion.dev '{:op :push (options)}' to no avail. But I can double check again. On another note: Right now, I've pulled all my deps from the alias into my main deps so I can at least try the deployment of my lambda proxy. Now I'm a step further, I see in the Api Gateway console that my app is returning a proper ring response, but the lambda crashes with a 502 error: > Wed Oct 07 13:51:50 UTC 2020 : Execution failed due to configuration error: Malformed Lambda proxy response > Wed Oct 07 13:51:50 UTC 2020 : Method completed with status: 502 The only thing I don't see in my response body is the isBase64Encoded flag, so maybe that's the issue right now

Alex Miller (Clojure team)14:10:41

which doc was clojure -A:datomic:ion-dev -m datomic.ion.dev '{:op :push (options)}' from ?

xceno15:10:41

From what I've seen so far it's every command in the ion tutorials, e.g. https://docs.datomic.com/cloud/ions/ions-reference.html#push

xceno15:10:05

The ion tutorials would also need some updates regarding the new AWS Api-Gateway Options, see here: https://clojurians.slack.com/archives/C03RZMDSH/p1601380150089100

Alex Miller (Clojure team)15:10:45

thanks those commands seem wrong - if using :ion-dev with a :main-opts, the -m datomic.ion.dev isn't need there /cc @U05120CBV

marshall15:10:38

I’ve updated the commands in the reference doc. Thanks @rob703

👍 3
xceno13:10:27

Ah yeah and I updated to the latest clj yesterday

xceno13:10:50

so that's why I converted to -M

Alex Miller (Clojure team)14:10:29

yes, that clj syntax is fine with the new clj (but I don't think that has anything to do with your issue)

vncz14:10:47

Hey, how do I create a new database in Datomic-Local?

marshall14:10:40

If you mean dev-local, once you’ve made a client (https://docs.datomic.com/cloud/dev-local.html#using) you can use it exactly the same way as you would using client against cloud (i.e. you can call create-database https://docs.datomic.com/client-api/datomic.client.api.html#var-create-database)

vncz14:10:37

I do recall creating the database from the cmd line argument when using Datomic on premise locally on my computer

vncz14:10:42

My memory might be flaking though

marshall14:10:32

generally that would not be the case unless you were just using peer-server with a mem database

vncz14:10:03

Totally my memory flaking then

marshall14:10:15

@rob703 what versions of the various ion tools are you using? I’m going to try to reproduce/investigate

xceno14:10:09

Thank you! This is part of my deps edn:

xceno14:10:45

So initially, all those deps where under my :datomic alias

xceno14:10:49

Oh and I'm using the latest ion-dev tools as an alias in my user config

xceno14:10:58

basically just following the tutorial

marshall14:10:28

@rob703 the zip file that is created will not contain all of your deps themselves

marshall14:10:38

it only contains your ion code The deps are fetched when you deploy

marshall14:10:45

were you seeing a problem with your actual deploy

xceno14:10:28

> it only contains your ion code Yes, that's the other part of my problem, it's not only the deps but also the additional paths. For example:

:aliases {:datomic {:extra-paths ["src/datomic"]}}
My entire code in the datomic folder is missing

marshall14:10:56

yep, I’ve reproduced that behavior. looking into it further now

xceno14:10:47

Thank you!

marshall14:10:15

for now I would say you’ll want to put those extra paths in the main body of the deps, not in an alias

xceno14:10:50

Yeah I moved everything from my alias up for now. I'm now battling with AWS itself, trying to get the lambda proxy to work. But that's another issue in itself

m0smith23:10:49

Is there a clear example of using :db.entity/preds? I have defined it as {:db/ident :transaction/pred :db.entity/preds 'ledger.transaction/existing-transaction-entity-pred}

m0smith23:10:55

When I try and transact with (d/transact conn {:tx-data [{:transaction/user-id #uuid "9550f401-fb16-4e42-8940-d683dbad3a3d" :transaction/txn-hash "Pl3b9f7ba2-eb0d-412d-b305-f76b5150c711" :db/ensure :transaction/pred}]})

m0smith23:10:39

I get Execution error (IndexOutOfBoundsException) at datomic.core.datalog/bound-consts$fn (datalog.clj:1570).

m0smith23:10:42

Any hints?

m0smith23:10:39

After taking a closer look at the stack trace, the predicate is being called but erroring