Question: Is there a library that can generate specs from a schema tx?

Asked By
Asked At
2017-11-22 15:14:39

Found 15 possible answers.

User Answered At Possible Answer
ghaskins 2017-11-22 15:19:54 Yeah, I had read about the :with clause and it wasnt helping me…then I realized that my result was the same with or without the :with clause because I wasnt targeting it properly Once I figured that out, its all working now…but thank you!
souenzzo 2017-11-22 19:23:39 /subscribe this topic
kbaribeau 2017-11-22 19:40:11 Hey all, is there a way to free up resources associated with a datomic connection so that my process doesn't hang on exit? It prints "connected" and then hangs for a very long time before exiting. I thought maybe datomic.api/release would help, but it appears not to, and I can't find docs around it.
  (println "connected"))
  (d/connect "datomic:dev://localhost:4334/test-database-nov-22-2017" dev://localhost:4334/test-database-nov-22-2017%22 )
  (d/create-database "datomic:dev://localhost:4334/test-database-nov-22-2017" dev://localhost:4334/test-database-nov-22-2017%22 )
  (println "about to connect")
(defn -main []
  (:require [datomic.api :as d])
(ns slow-lein-because-datomic.core I have a lein task that looks just like this:
favila 2017-11-22 20:01:15 @kbaribeau The hang is caused by the clojure agent pool, which things in datomic use. (This is a general clojure problem, not datomic specific). See docs for datomic.api/shutdown, which may help you. also clojure's shutdown-agents function
kbaribeau 2017-11-22 20:02:10 Aha, thanks!
jfntn 2017-11-22 22:58:46 generating specs for scalar attributes is pretty trivial, but refs get complicated pretty quick say we a unary ref, its spec would have be an s/keys but it doesn’t feel right to statically define which keys are required and which are optional because we often have different “schemas” on read or write
boldaslove156 2017-11-23 11:33:32 Do you guys think it's okay to expose eid to client as part of a url?
val_waeselynck 2017-11-23 11:34:44 No, consider them internal
kirill.salykin 2017-11-23 11:48:09 so, it is better to have some uuid or int id which can be exposed?
pesterhazy 2017-11-23 15:16:45 yes. lookup refs can be used everywhere an eid can, e.g. [:perdon/id <#uuid> "asdf-asdf-asdf-asdf"]
zignd 2017-11-24 00:32:44 may I ask why it's not okay? i'm building an http service and returning them to the service's client
favila 2017-11-24 00:45:43 They are not guaranteed to be unchanging. So there should be no long-lived weakly-referenced entity ids in your system (eg in a url, or in a json blob stored somewhere). In your example, your urls night break one day. Using eids in short-lived contexts is ok
zignd 2017-11-24 01:41:33 thanks for the explanation! i'll look into this lookup refs
pesterhazy 2017-11-24 08:08:08 eid haven't changed in practice so this may not be important practically speaking but remember that if you re-create a database in some way other than restoring (i.e. re-inserting datoms), you won't have control over eids
zignd 2017-11-24 11:31:53 yeah, that's what i noticed reading the docs on Identity and Uniqueness, thanks for confirming it works just like an identity column in a relational database configured auto increment

Related Questions