This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-21
Channels
- # adventofcode (24)
- # announcements (1)
- # beginners (122)
- # braveandtrue (9)
- # calva (45)
- # cider (24)
- # cljdoc (8)
- # cljs-dev (23)
- # clojure (112)
- # clojure-europe (2)
- # clojure-india (2)
- # clojure-italy (36)
- # clojure-nl (3)
- # clojure-spec (32)
- # clojure-uk (35)
- # clojurescript (52)
- # core-typed (12)
- # cursive (4)
- # datomic (61)
- # emacs (4)
- # figwheel-main (2)
- # fulcro (14)
- # hoplon (5)
- # hyperfiddle (1)
- # jobs-discuss (6)
- # kaocha (5)
- # leiningen (2)
- # nrepl (15)
- # off-topic (62)
- # re-frame (26)
- # reagent (39)
- # ring (3)
- # shadow-cljs (56)
- # spacemacs (8)
- # specter (5)
- # tools-deps (1)
- # yada (2)
@dustingetz how is that’s possible in Datomic I wonder?
While reading up on Web Ions I see that they are supposed to return a ring map, does this mean that anything like server side events or websockets are not supported?
@kardan I haven't tested it myself, but ions run behind aws gateway, which recently got support for websockets. So I think you can support websockets that way.
I was thinking about the Ion web API (https://docs.datomic.com/cloud/ions/ions-reference.html#sec-7). But I have to say that I have not chewed on Ions enough to understand how it all hangs together. But I got the impression that the Ion itself wanted a ring request / response workflow.
So ions are simple clojure functions which are inserted into your datomic cluster. AWS Gateway can send events to your ions as a ring request. AWS Gateway now supports websockets, which means that it in theory can send a request on user connection, user message and user disconnect. It essentially converts websockets communication to a request/response thing. I would assume that you can give each user an ID and so do asynchronous message sends, but I haven't looked to closely at it yet.
Hi 🙂 anybody know what's the role of "preload database" and what it adds on top of the deploy life-cycle ? in the deploy reference (https://docs.datomic.com/cloud/ions/ions-reference.html#deploy-outputs) it says Ensure that active databases are present in memory before routing requests to newly updated nodes.
.
I still cannot solve my problem. Imagine I have a model: an account with a set if interests.
{:db/ident :account/id
:db/valueType :db.type/long
:db/cardinality :db.cardinality/one
:db/unique :db.unique/identity}
{:db/ident :account/interests
:db/valueType :db.type/string
:db/cardinality :db.cardinality/many
:db/index true}
Now I need to query all the accounts that have ALL the interests I’ve got from request. What I tried (for a single account):
(d/q
'[:find ?id ?interest
:in $ ?a [?interest ...]
:where
[?a :account/id ?id]
(not [?a :account/interests ?interest])]
(d/db conn)
[:account/id 1]
["foo" "bar" "baz"])
or
(d/q
'[:find ?id ?interest
:in $ ?a [?interest ...]
:where
[?a :account/id ?id]
(not-join
[?a ?interest]
(not [?a :account/interests ?interest]))]
(d/db conn)
[:account/id 1]
["foo" "bar" "baz"])
It works partially yet I still have wrong data. How can I improve that?@igrishaev - I have a similar problem: I have a thing with a :db.cardinality/many
attribute & I need to query for all having two kinds of values e.g. this thing can have multiple colours and I want all the things having red and green colours
@igrishaev One way to do it would be to dynamically generate a and clause with all the interests you're looking for:
(and
[?a :account/interest ?i1]
[?a :account/interest ?i2]
...)
what if :account/interest
was another entity which you wanted to ensure there were 2 instances of which each had attributes ?i1 and ?i2
You can add clauses with intermediate vars for those entities. If that gets too long you can abstract the set of clauses with a rule.
I tried that, but it didn't work
[(d/entity $ ?e) ?ent]
[(:interests ?ent) ?interests]
[(subset? #{"cars" "games"} ?interests)]
You're not taking advantage of your indexes with something like that. You have to pull every single account and do the subset?
operation on it.
which aws instance types are supported by datomic on-prem? ensure-cf fails for m5.large
@U0ESP0TS8 I believe all legal instance types are supported ( http://aws.amazon.com/ec2/instance-types/). I just tested by ensuring a my-cf.properties file with aws-instance-type=m5.large
in us-east-1 and the ensure did not fail.
$ bin/datomic ensure-cf my-cf.properties my-cf.properties
{:success my-cf.properties}
$ bin/datomic ensure-cf cf-template.properties cf-template.properties
java.lang.Exception: Key not found: m5.large
at datomic.common$getx.invokeStatic(common.clj:191)
at datomic.common$getx.invoke(common.clj:184)
at datomic.memory$aws_transactor_settings.invokeStatic(memory.clj:174)
at datomic.memory$aws_transactor_settings.invoke(memory.clj:170)
...
hmmm I am not seeing that at all. Would you mind logging a ticket to support or sharing your properties file with me? I’d like to try with your file.
<mailto:[email protected]|[email protected]> e-mail should generate a ticket that I can look at
Please let me know when you send the e-mail, I want to make sure I jump on this when it comes in. 🙂
@igrishaev In case you don't know about it. It's probably easier to dynamically generate queries using the map form. https://docs.datomic.com/on-prem/query.html#list-vs-map
@me1740 sure, I used to compose complicated queries, for example: https://github.com/igrishaev/highloadcup/blob/master/src/highloadcup/db.clj#L161
@igrishaev @me1740 Rules to test if a collection of players are a subset of the players in a roster https://gist.github.com/dustingetz/66e493e87a99b9656e2cfe96bf6a51cc cc @cjsauer
@igrishaev here's what I meant (I haven't tested, but it should work): https://gist.github.com/eraserhd/c918cd1fa8cf06694b071c135e532125
@dustingetz yes, recursive rule should work too
I am collecting this stuff in https://www.reddit.com/r/datomic/ btw
I had a bad surprise with using clojure core functions on the transactor a while back. Never got an answer as why it fails https://forum.datomic.com/t/conj-in-a-rule-fails-on-the-transactor/413
I would be very curious to figure out why this fails. And since then I try to stay away from this kind of queries that build clojure data.
interesting
"This only happens in the transactor and not with d/with. "
I had an issue much like this. I thought Datomic was reordering clauses, which they tell me they don't do.
It had two characteristics of yours: calling a function that takes $, followed by calling regular clojure code.
In my case, IIRC (I've lost the commit hash), the function which takes $ checked a precondition and failed, but the clojure code following it seem to run before the precondition was checked.
friday pre-holiday brain melt.. can i test a transaction against a db using d/with-db
? it returns a db, but d/transact
requires a connection.
no, of course not. just explaining my disconnect. i recall someone testing transactions against a with-db
'ed version of the database and then checking the results, but only in memory.
yes, you can do that. I don't understand what the connection argument to d/transact
has to do with it