This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-03-04
Channels
- # adventofcode (6)
- # announcements (1)
- # aws (18)
- # beginners (104)
- # boot (11)
- # cljsrn (31)
- # clojure (49)
- # clojure-dev (16)
- # clojure-europe (2)
- # clojure-greece (9)
- # clojure-houston (1)
- # clojure-italy (12)
- # clojure-nl (3)
- # clojure-spec (46)
- # clojure-uk (148)
- # clojurescript (12)
- # community-development (13)
- # core-async (7)
- # cursive (35)
- # data-science (13)
- # datomic (70)
- # events (1)
- # fulcro (22)
- # hyperfiddle (1)
- # jobs-discuss (10)
- # kaocha (3)
- # off-topic (7)
- # om (2)
- # other-languages (32)
- # parinfer (1)
- # portkey (4)
- # re-frame (3)
- # reitit (12)
- # shadow-cljs (49)
- # spacemacs (1)
- # specter (6)
- # sql (5)
- # tools-deps (58)
is there a way to directly pull the :db/ident
of a :db.type/ref
? e.g. (pull ?e [:the/ref])
results in {:the/ref #:db{:id 123 :ident :ident-value}}
, and i’m looking for a way to just get {:the/ref :ident-value}
There is no way without postprocessing (see clojure.walk/walk) but please upvote this feature request if it strikes your fancy: https://receptive.io/app/#/case/49752
easy to do with scissors afterwards, just wondering if theres syntax in pull
to remove the extra step. separately: datomic is nuts
What is the idiomatic way to query entities for dates? I want to get all the posts with created-at
inst
that fall in range of dates. Would that be database asof
and since
filters or something else?
That article is important for getting clear what datomic's time features can and cannot do
I would say this: if you want "created-at" to be a business domain concept, make an indexed create-at attribute and query it
signs that it is a business domain concept: 1) you want to be able to change it ("oops, I got the created-at time on this thing wrong, it's supposed to be last week")
2) It's value comes from another system ("I need to copy this record's created-at time from the inventory to the accounting db")
If created-at is really more like a git "commit" time, then you can use some immutable attribute on the entity, and use its TX as the "created at" time
note that it will be a bit trickier to get that value, because TX entities are not reachable via pull expressions
@piotr.kurnik One option is to index the created-at
attribute and use a query.
We are seeing a intermittent timeouts from our client trying to connect to datomic cloud.
2019-03-04 08:56:49 ERROR middleware:286 - Exception encountered processing request
clojure.lang.ExceptionInfo: Datomic Client Timeout {:cognitect.anomalies/category :cognitect.anomalies/interrupted, :cognitect.anomalies/message "Datomic Client Timeout"}
If you run into this error is appears you'll need to restart the datomic cloud compute instances.
hi, is it possible to connect to the localhost transactor running on port 4334 for the ddb database type without going to dynamo to lookup the IP? (i want to use ssh port forwarding from remote 4334 to local 4334 and then connect using the ddb protocol to the local 4334 port). is that possible?
i tried using datomic:dev://...
but got Connection refused (likely due to either ddb v dev protocol mismatch or missing authentication or ??? )
@johanatan no; datomic writes the address of the transactor into storage
so even if i know the transactor is running on localhost, there's no way to connect to it directly?
the peer will connect to storage (whatever it is, in this case ddb), to look up the transactor endpoint
yes i know all of that. i know how it "normally" works. but what i want to do here is abnormal.
if you’re trying to connect to your cloud database from your laptop, you’re running a peer (or client)
if you can ssh to it, it must have a publicly accessible IP address (presumably the same address your cloud peer uses to connect)
so all you need to do is export AWS credentials locally that allow you to access dynamo
hmm, it would seem that it wrote a "private"/internal IP to storage. i would also rather not open my database port to the world (seems like asking for trouble)
you may need to use HOST & ALT-HOST to accomplish this if you cant resolve the address it is using from your laptop; alternatively you might be able to do something like a bastion server that handles port forwarding and remote dns resolution, but you’d have to have an instance in your VPC (or whatever) to do that with
is it possible to run a query that returns multiple different counts in a single query, where each count is for the specific attribute value, and not for the set of attribute values together, sort of like frequencies
does in clojure.core?
so I ended up doing this:
(d/q '[:find ?attr ?value (count ?i)
:where
[?i :inventory/store ?s]
[?s :store/short-code "demo-store"]
(or
(and
[(ground :model) ?attr]
[?i :item/model ?value])
(and
[(ground :size) ?attr]
[?i :item/size ?value]))]
(d/db (db/get-conn)))
Not sure if i’d be better off using rules in such a situation, or something else, so I’d appreciate any feedback if anyone has done the same sort of thing before. Ultimately, this code is going to move to a search engine, but I need it for the time being.That is how you would do it. Rules would encapsulate the logic better and make the intent clearer but it's no different from this ultimately. (or, or-join, and, and-join are ultimately just sugar for inlining anonymous rules)
Thanks for replying/validating my logic. I ended up switching to rules since it’s a bit clearer, as you mentioned. Sometimes it takes a bit of thinking to get to what you want, but I’m finding datalog queries to be incredibly expressive.
Are there any recommendations for batch size when doing a one-off data import to Datomic Cloud? I'm looking at about 100K entities that are logically part of the same group.
@marshall i think the following will do the trick (with my ssh tunnel in place) without having to open my db port to the world: http://www.vincecutting.co.uk/web-development/redirect-ip-address-back-to-localhost-on-mac-osx/