Is there a library out there such that whether using :peer
or :client
is mostly unknown from your application code's point of view?
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.
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
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).
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.
Is there an alternative for this? ^
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 ^^
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?
@rob703 I believe you want -A:aliases
not -M
not with new clj ...
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
Ah yeah and I updated to the latest clj yesterday
so that's why I converted to -M
yes, that clj syntax is fine with the new clj (but I don't think that has anything to do with your issue)
Hey, how do I create a new database in Datomic-Local?
@rob703 what versions of the various ion tools are you using? I’m going to try to reproduce/investigate
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)
I do recall creating the database from the cmd line argument when using Datomic on premise locally on my computer
My memory might be flaking though
Thank you! This is part of my deps edn:
So initially, all those deps where under my :datomic
alias
Oh and I'm using the latest ion-dev
tools as an alias in my user config
basically just following the tutorial
@rob703 the zip file that is created will not contain all of your deps themselves
it only contains your ion code The deps are fetched when you deploy
were you seeing a problem with your actual deploy
generally that would not be the case unless you were just using peer-server with a mem
database
Totally my memory flaking then
> 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 missingwhich doc was clojure -A:datomic:ion-dev -m datomic.ion.dev '{:op :push (options)}'
from ?
yep, I’ve reproduced that behavior. looking into it further now
Thank you!
for now I would say you’ll want to put those extra paths in the main body of the deps, not in an alias
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
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
The ion tutorials would also need some updates regarding the new AWS Api-Gateway Options, see here: https://clojurians.slack.com/archives/C03RZMDSH/p1601380150089100
thanks those commands seem wrong - if using :ion-dev with a :main-opts, the -m datomic.ion.dev
isn't need there /cc @marshall
I’ve updated the commands in the reference doc. Thanks @rob703
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}
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}]})
I get Execution error (IndexOutOfBoundsException) at datomic.core.datalog/bound-consts$fn (datalog.clj:1570).
Any hints?
After taking a closer look at the stack trace, the predicate is being called but erroring