Fork me on GitHub
#datomic
<
2019-10-29
>
pvillegas1200:10:00

I want to upgrade from Solo -> Production, but my datomic database is currently serving a paid product. Is there a way to make this operation reversible in case it does not work as expected?

dmarjenburgh07:10:41

You can probably update the stack with the solo template to revert.

pvillegas1200:10:59

Has anyone encountered a problem where your whole system goes down when a code deploy is initiated by a Autoscaling group action? This event is taking down our system which is then restored if we use another deployment.

xiongtx05:10:18

I'm wondering why the #db/fn reader macro doesn't work with clj code, only EDN.

#db/fn {:lang "clojure"
        :params []
        :code (inc 1)}
when evaluated gives
Can't embed object in code, maybe print-dup not defined:
   clojure.lang.Delay@33ccca49
which IIUC means that it's trying to eval the delay, which I'm not sure why is happening. The has been asked previously here, but w/out an answer: https://clojurians-log.clojureverse.org/datomic/2016-01-02/1451699503.001427

hiredman05:10:58

because the compiler generates bytecode and doesn't know how to embed arbitrary objects (like the delay) in bytecode. if there is no special casing of how to embed some object in bytecode, the compiler falls back to calling pr, embedding the string, and then calling read-string when the bytecode is run

hiredman05:10:37

same thing

user=> (defmacro f [] (delay nil))
#'user/f
user=> (fn [] (f))
Syntax error compiling fn* at (REPL:1:1).
Can't embed object in code, maybe print-dup not defined: clojure.lang.Delay@205b132e
user=>

sooheon09:10:20

I’m not getting results binding :db.type/float values, like (d/q '[:find ?e :where [?e :some/attr 1.0]] db), only for some values. I.e. I know that valid values are (1.0 2.0 3.5), and only 2.0 returns results in that query. What could I be missing?

sooheon09:10:59

I now see that the following query works:

(d/q '[:find (pull ?e [*])
       :where 
       [?e :some/attr ?v]
       [(> ?v 3.4)] 
       [(< ?v 3.6)]]
     db)
So it seems like a floating point error issue for exact comparisons. I guess I should be using :db.type/bigdec if I care about writing queries for exact values?

pvillegas1211:10:01

Our Datomic Cloud Solo System is failing completely, the API times out with a 504. How can we go about debugging this in AWS?

dmarjenburgh12:10:51

Try to pinpoint where it goes wrong first and whether it’s a Datomic issue or an ApiGateway configuration. - What happens when you invoke the lambda directly instead of through apigw? - Can you connect to the database through the bastion? - Do the datomic CloudWatch logs have anything unusual?

pvillegas1212:10:22

CloudWatch logs don’t show anything, that is the unusual part, they start not reporting anything about datomic

pvillegas1212:10:48

I’m going to try 1-2 to replicate

marshall12:10:33

if your datomic system cloudwatch logs just “stop” you should forcibly restart your compute instance

madstap17:10:33

I'm trying to shovel some data from kafka into datomic cloud. Is there a ready made kafka connect sink for datomic cloud or should I write my own?

Brian18:10:50

I'm wondering what the best way is to validate my data when working with Datomic Cloud. I have a sha-256 hash that I want to check if it is actually a valid sha-256 before inserting it. I have a function written. Should I do that check manually before inserting it or is there a way to have rules on certain attributes?

Brian18:10:48

Thank you!

Brian18:10:05

@marshall I get a 'hash/sha-256?' is not allowed by datomic/ion-config.edn - {:cognitect.anomalies/category :cognitect.anomalies/forbidden, :cognitect.anomalies/message \"'hash/sha-256?' is not allowed by datomic/ion-config.edn\", :dbs [{:database-id \"<id>\", :t 24, :next-t 25, :history false}]}"}}. Does this indicate that I need to push that function up as a transaction function?

marshall18:10:08

@brian.rogers yes, “Attribute predicates must be on the classpath of a process that is performing a transaction.” - for Cloud that means they need to be ions

Brian18:10:47

Sweet thank you =]

jjttjj19:10:14

Is there a way to combine the results of these two queries in a single query? providing a default value for "status" when the join cannot be made? I've been missing with get-else but I don't think it's exactly what I need here

;;find placed orders requests that have not been acknowledged with a
;;received status message
(d/q
 '[:find ?oid
   :where
   [?e :iboga.req.place-order/order-id ?oid]
   (not [?status-msg :iboga.recv.order-status/order-id ?oid])]
 (d/db DB))

;;find placed orders requests that have been acknowledged with a
;;received status message and join with status
(d/q
 '[:find ?oid ?status
   :where
   [?e :iboga.req.place-order/order-id ?oid]
   [?status-msg :iboga.recv.order-status/order-id ?oid]
   [?status-msg :iboga.recv.order-status/status ?status]]
 (d/db DB))

benoit20:10:09

Something like this might work:

(d/q
 '[:find ?oid ?status
   :where
   [?e :iboga.req.place-order/order-id ?oid]
   (or-join [?oid ?status]
            (and [?status-msg :iboga.recv.order-status/order-id ?oid]
                 [?status-msg :iboga.recv.order-status/status ?status])
            (and (not [?status-msg :iboga.recv.order-status/order-id ?oid])
                 [(ground :none) ?status]))]
 (d/db DB))
But I wonder why your status message entity cannot point directly to the order entity. Why do you have to do this "join" on the order id value.

benoit20:10:23

This (not [?status-msg :iboga.recv.order-status/order-id ?oid]), in particular, might be inefficient.

jjttjj20:10:49

That works, thanks! So you mean just having the order-id be a :db/unique attribute so all the attributes above point to the same entity, then just doing get-else for the status?

benoit22:10:44

No, I mean having an attribute :iboga.recv.order-status/order that directly points to the order entity. Why having to use the "order id" value to connect the two entities?

schmee21:10:40

can you use attribute predicates with database functions, or does it only work with functions on the classpath?