Fork me on GitHub

A different question: I like the feature that allows me to query a datastructure directly, eg (d/q ‘[:find …] ‘[[:foo :foo/bar 42] [:bar :foo/bar 43]])


Is it possible to query a nested datastructure in any way? Eg, converting the nested structure to a list of datoms somehow?


yes, for example, you have the following {:foo {:bar 4}}


if you make :foo a reference then you can directly store this in datomic


will need to provide :db/ids for both maps, however, if you can make :foo a component and datomic will delete the children when you remove foo


when you query you just follow the join: [[?e :foo ?foo] [?foo :bar ?bar]]


@grav I think I missundersood you question


If you're passing in a data-structure rather than a db then you would need to do something like flatten it to datoms.


@bahulneel: yes, exactly, I need to convert it to datoms somehow. I cannot find an api for it.


@grav so, the shape you need is a triple of [E A V] this would mean flattening out the data structure so that each map becomes an entity and then you assign ids to those.


depending on the complexity of the data structure and how much you know about it in advance you may want to consider using datascript as any implementation will eventually become some implementation of this


or you can use the in memory datomic but you'll have to specify all the schema rather than just the references


@grav: Haven't tried, but you can just create an empty dummy db in your app, then use (d/with ) on it to get back a proper db (it always keeps the database empty). Needs a schema though.


@grav: looks like @conaw has some code to help you, the transactions he produces should be directly queriable by d/q


Hi - I am sending a lot of transactions to my database, and many of them are timing out because of the load. I assume that even if there is a timeout, the transaction will still go through as long as the queue on the transactor is not full. Is there a way to detect if the transactor actually starts rejecting transactions? Not sure what to look for in the logs


yes, I did it but I forgot the part about using transactAsync instead of transact - so I ended up having a bunch of timeouts and wanted to figure out if there was a way to detect actual transaction failures at the transactor level. I'm not using CloudWatch so I don't see alarms either


Alarms should be reported in your txor logs as well