This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-06
Channels
- # beginners (90)
- # boot (83)
- # cider (39)
- # clara (4)
- # cljs-dev (124)
- # cljsrn (10)
- # clojure (208)
- # clojure-boston (1)
- # clojure-italy (13)
- # clojure-nlp (3)
- # clojure-russia (34)
- # clojure-spec (63)
- # clojure-uk (101)
- # clojurescript (65)
- # community-development (13)
- # copenhagen-clojurians (1)
- # core-async (1)
- # cursive (24)
- # datascript (1)
- # datomic (65)
- # emacs (20)
- # graphql (20)
- # hoplon (21)
- # instaparse (18)
- # jobs (5)
- # jobs-discuss (2)
- # leiningen (8)
- # luminus (32)
- # midje (1)
- # mount (3)
- # off-topic (18)
- # om (10)
- # parinfer (6)
- # pedestal (2)
- # planck (2)
- # precept (22)
- # protorepl (7)
- # re-frame (45)
- # reagent (9)
- # ring (1)
- # ring-swagger (4)
- # rum (2)
- # spacemacs (5)
- # sql (2)
- # unrepl (13)
- # untangled (8)
- # yada (5)
hey all, newbie question regarding the pull api.
when resolving a ref entity in the pull api, the value returned is a map of attributes (e.g. pull [*]
-> {:my-ref-attribute {:db/id 12345} ...}
, pull [* {:my-ref-attribute [*]}]
-> {:my-ref-attribute {:db/id 12345 :db/ident :my-ns/my-ident} ...}
).
when resolving a ref entity in the query api, the actual ident is returned. (e.g. find ?eid ?my-ref-attribute
-> [12345 :my-ns/my-ident]
).
is there any way to return the actual ident for a ref from a pull (as in the query api), as opposed to a map of attributes? so the return value would be {:my-ref-attribute :my-ns/my-ident}
.
this thread – https://groups.google.com/forum/#!topic/datomic/xxoYiko2muY – on the datomic user mailing list gets at what I’m trying to do. just wanted to check if that’s still something unsupported by the api
thanks for any input or advice!
do people usually default to include project names in their :db/ident
keywords? for example, do you use :myapp.user/first-name
or just :user/first-name
@mss The query api does not automatically change ids to idents. I am not sure how you got that impression
you’re right, my mistake. meant to say that there’s an easy syntax for specifying how to return an ident
the only api that implicitly treats entities-with-idents as keywords is the entity api
with pull results, a common strategy is to walk the results with clojure.walk/prewalk and replace any maps with :db/ident in them with the ident itself
I'm a bit confused about datomic starter and free. (I'm developing an app for a small ngo, so the pro version is certainly a no-go due to the pricing. small ngo's can't afford it). I do understand the Client not available on the free version and limited to 2 peers etc. But, it's about the updates: the free version can be updated at any time (meaning: install a new version and start using it), while using the starter version, this is not possible? Am I right?
i believe starter is free upgrades for a year but then you need to pay. not sure if you get a perpetual license for the latest version at the end of that year but it seems that way
So, free is unlimited updates, starter only for 1 year and than you need to upgrade to pro to receive updates... Too bad.
@kurt-o-sys @spieden starter has perpetual licensing so you can continue using versions released prior to the expiration of your starter license indefinitely.
@jaret Right, but no updates, meaning, after a few years, you'll probably lacking some features/security updates/ ... . Not a good idea, experience tells me.
Yeah, thankfully for any reasonably sized money making enterprise the license cost is pretty affordable
right... that's it: > any reasonably sized money making enterprise the license cost is pretty affordable I'm talking about small non-profit organizations/associations, working with 1-3 FTE and a lot of volunteers (from 30 to >100). It's really not affordable for them. They are financially very small, but they are not small at all in terms of tech needs. Their 'business' is often pretty complex compared to usual businesses and they need to fall-back to poorer tech, which isn't really helping them either. (Yes, I know, the free edition, but in this use case, the client library makes much more sense.)
@kurt-o-sys maybe talk to them and they’ll cut you a deal(?)
A late thank you for the discussion about enforcing constraints in transactions. I'm not sure what the practical conclusion might be, and my question was for the sake of understanding, not a particular use case.
I can't help but wonder though, how people make sure their data doesn't get corrupt, when constraints are expected in the data. I guess only smart and proactive testing might allow smooth sailing....
But the cost of an error would be eternally corrupt data, given the write-only nature of datomic, which is a bit more than with an RDBMS, where the cost of an error is more transient (in the non-pathological case). Just a thought.
@matan Hi! There was a discussion on precisely this topic yesterday (or the day before yesterday?) on this channel
The gist of it was that you cannot enforce constraints directly. If enforcing them in your application code is not enough, you can enforce them in a “transaction function” which runs on the transactor, but this relies on your application code using that transaction function (it could bypass it)
Another approah could be to either inspect backups or inspect the transaction log live on the lookout for constraint violations
you can always excise data, commit a transaction which fixes the issue, or in extreme scenarios I guess you could even re-build your whole database
and you realise that an event has occured today which has corrupted your data in a non-fixable way
you could restore to yesterday’s backup, then apply every transaction that was ran before yesterday and today
Do you have a kind of constraint in mind that would be enforced by a relational DB and, if not enforced, would lead to “unrecoverable” data corruption?
By the way, in clojure core, we do have validators built-in to the api, for the state handling constructs (atoms, agents...) I wonder why this concept was not carried over to the flagship database being datomic
matan: well, generally speaking, Datomic's authors' line of conduct has always been to be minimalistic about adding new features in order to keep things simple, and I think it's a good strategy. Now, specifically, you can emulate validators using a transaction function as shown above - it does require a the Peer to be cooperative about it, but that's not too much of a hassle IMO
@matan unrelated but if you are assessing datomic, check this out: https://medium.com/@val.vvalval/what-datomic-brings-to-businesses-e2238a568e1c
@matan for you to judge. It was written by someone using Datomic in his startup, and the points are well justified imo
@matan I wrote it, and I confirm it's not marketing material. FWIW, I've also tried to assess the limitations of Datomic in the post.
(of course, do feel free to challenge the content, it can only help me make it better)
@U06GS6P1N thanks again for all the assistance