This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-22
Channels
- # beginners (42)
- # boot (73)
- # cider (17)
- # clara (1)
- # cljs-dev (47)
- # cljsrn (9)
- # clojars (4)
- # clojure (241)
- # clojure-italy (11)
- # clojure-norway (5)
- # clojure-russia (93)
- # clojure-spec (28)
- # clojure-uk (32)
- # clojurescript (170)
- # core-async (20)
- # cursive (62)
- # data-science (2)
- # datomic (47)
- # dirac (4)
- # events (1)
- # funcool (12)
- # gsoc (1)
- # hoplon (59)
- # immutant (8)
- # lambdaisland (4)
- # luminus (3)
- # lumo (11)
- # off-topic (13)
- # om (81)
- # onyx (1)
- # pedestal (47)
- # planck (30)
- # re-frame (2)
- # reactive (1)
- # reagent (2)
- # ring-swagger (15)
- # rum (1)
- # slack-help (5)
- # specter (5)
- # testing (5)
- # uncomplicate (8)
- # untangled (16)
- # vim (71)
- # yada (16)
this is probably a silly question but if I have a fn that transacts, then derefs the future of the transaction, and then calls datomic.api/db
on the db connection, is that call to datomic.api/db
guaranteed to reflect a db value consistent with the tx, or would I need to use the db-after
from the transaction to ensure the tx is reflected in the db value? for instance (defn test-tx [tx-data] @(d/transact (:conn db) tx-data) (d/db (:conn db)))
I generally use db-after
, but wondering if that is strictly necessary
Db-after is the db immediately after the tx. D/db is some db after the tx (could possibly be after other later txs). The fact that the deref completed means that tx is now visible to the peer and any d/db on that peer will now include it @djjolicoeur
@djjolicoeur assuming the txn is successful. If it fails or times out your call to d/db might still succeed (depending on how you handle, or don't handle, the failure)
Timed out or failed txn will throw when you dereference the future http://docs.datomic.com/clojure/#datomic.api/transact
thanks @favila @marshall wasn’t sure, assuming a successful tx, whether the the peer was guaranteed to reflect that tx when a value was requested. I generally use db-after anyways to isolate from other tx’s in the system anyways, but we were having a discussion in the office today and I wasn’t sure on whether it was strictly necessary.
https://github.com/Datomic/day-of-datomic/blob/master/tutorial/schema_queries.clj#L18-L20 :db/id doesn't show up in this query, is it considered "special"?
@dominicm You mean in the result of this query? Yes, there is no such attribute, it's just the e in the eavt indices.
@dominicm Also count
an entity, and you won't see ;db/id
counted, or seq
it. It's a special field in the entity.
hi all , is it possible to rename a field when using the pull api , i am fetching deeply nested data and would like to alias it , the nested value is returned something like {:person {:company {:location "somewhere}}} , when accessing the pull'd data i would prefer to access person-location instead of (:location (:company (:person data))) , hope that makes sense
@rc1140 pull can only do two transformations: limit cardinality-many results, and default cardinality-one values
right , i get why that would be a bad idea as well , im happy doing a long form extraction out of the map for now
If you are unfamiliar with the clojure.,walk
namespace, it is very handy for post-processing pull expression results
not familiar with it , but will go read up on it , any links you have on hand that you think would be a good intro
using d/pull and then passing it to the walk stuff , i have only using the pull api by calling d/q and then passing in i a query vector
vague question here. using the tx-pipeline from best practices (http://docs.datomic.com/best-practices.html#pipeline-transactions) i’m getting clojure.lang.PersistentArrayMap cannot be cast to java.util.List
. I can see that I’m passing a map to transactAsync within the pipeline, but I would expect that to work. Does this sound familiar to anyone?
yeah, I’m wishing I would delete that embarrassing question … but it’s good to humble oneself periodically
Hi, there is some way to same datomic's :db/txInstant
in other atribute?
(Example: I want to save {:db/id (d/tempid :db.part/user) :msg/txt "Hello" :msg/inst <#C03RZMDSH|datomic>/inst}
)
Yes, I now that I can make a query where [?msg-id :msg/txt _ ?tx][?tx :db/txInstant ?v]
, but it's the only way?
You can get the current datomic t
value (before your transaction) by calling (d/basis-t db)
...which would give you "transaction before this one" as a potential (d/as-of)
target for historical data
(Assuming that no other new data is transacted from a different process in between the time your call to (d/db conn)
completes and when your {:msg/txt "Hello"}
transaction completes)
Good idea 😉