Fork me on GitHub
#datomic
<
2019-09-06
>
Chris Bidler01:09:21

@brian.rogers I think you want to look at having an API Gateway proxy resource and configuring the ion with the API Gateway :integration, in that way your whole request path will be available in the context object. I haven’t gotten to revisit ions and API Gateway in months so this is faint memory backed up by a quick review of the docs page.

Jacob O'Bryant03:09:29

Re: my problem above--I've taken out all the deps that were easy to take out, but no dice. I'm going to see if I can somehow replace a large-but-important dep I have and hope that works. However, is it possible on the solo topology to upgrade the compute stack to use a larger ec2 instance instead of the default t3.small? (I'm assuming that would fix the issue). I'd upgrade to production topology, except I just can't afford two i3.large instances at the early stage I'm in right now.

henrik09:09:27

Unfortunately, for Solo, you’re stuck with the default option. Try doing some profiling on your code to see what is eating the resources.

👍 4
johnj17:09:44

An alternative is to move to on-prem and use the client lib.

igrishaev07:09:51

I got stuck a bit with the following problem. When shifting a predicate clause inside not, the query stops working. For example, this query works fine:

[:find ?e ?id
 :where
 [?e :user/pg-id ?id]
 [(< ?id 5)]]
But the second is not:
[:find ?e ?id
 :where
 [?e :user/pg-id ?id]
 (not [(< ?id 5)])]
Of cause I can flip the predicate in such a way so it returns opposite value. But I rather interested in common approach.

igrishaev07:09:52

The error message I’m getting in console is

processing rule: (q__198 ?e ?id), message: processing clause: ["not" [(< ?id 5)]], message: :db.error/invalid-lookup-ref Invalid list form: [(< ?id 5)]

benoit14:09:48

Both queries work for me with the on-prem version.

Adrian Smith09:09:59

What's a good way of getting secrets up on to datomic cloud? (details here: https://ask.clojure.org/index.php/8554/how-to-store-secrets-in-datomic-cloud)

adamtait18:09:26

I’m trying to deploy a Datomic Ion application and it’s failing in datomic.client.api/client (creating the client).

{
 "Type": "java.lang.AssertionError",
 "Message": "Assert failed: cfg",
 "At": [
        "datomic.client.impl.local$create_client",
        "invokeStatic",
        "local.clj",
        208
        ]
 }
I assume that cfg implies the configuration map (the one parameter that datomic.client.api/client accepts) and that AssertionError implies it doesn’t exist. I have verified that it exists and is valid. The same code works flawlessly from my local machine at the REPL, which is how I understand that Datomic is expecting it (https://github.com/Datomic/ion-event-example/blob/e08c59d0cac1a100251232a462dd77194d83e48a/src/datomic/ion/event_example.clj#L58) even though it swaps out the configuration for the local Datomic client. Any help on how to proceed through this non-descriptive error from a black box would be most appreciated!

adamtait18:09:41

Here’s the full CloudWatch trace:

[
  "datomic.client.impl.local$create_client",
  "invokeStatic",
  "local.clj",
  208
  ],
 [
  "datomic.client.impl.local$create_client",
  "invoke",
  "local.clj",
  205
  ],
 [
  "clojure.lang.Var",
  "invoke",
  "Var.java",
  384
  ],
 [
  "datomic.client.api.impl$dynarun",
  "invokeStatic",
  "impl.clj",
  24
  ],
 [
  "datomic.client.api.impl$dynarun",
  "invoke",
  "impl.clj",
  21
  ],
 [
  "datomic.client.api.impl$dynacall",
  "invokeStatic",
  "impl.clj",
  31
  ],
 [
  "datomic.client.api.impl$dynacall",
  "invoke",
  "impl.clj",
  28
  ],
 [
  "datomic.client.api$client",
  "invokeStatic",
  "api.clj",
  84
  ],
 [
  "datomic.client.api$client",
  "invoke",
  "api.clj",
  46
  ],
 [
  "datomic.client.api$client",
  "invokeStatic",
  "api.clj",
  76
  ],
 [
  "datomic.client.api$client",
  "invoke",
  "api.clj",
  46
  ]

Joe Lane19:09:10

I lost a day to this same error message about 2 weeks ago.

adamtait19:09:37

Thanks Joe! I’m surprised that my searching didn’t find that result before. I’ve already lost a day so hopefully no more!

Joe Lane19:09:32

NP, currently the vase-datomic-cloud interceptor does this connection on ns load. If you're using it, let me know and I'll send you a rewritten version of the interceptor to fix that issue.

adamtait19:09:49

I actually didn’t know about https://github.com/cognitect-labs/vase but I am already using pedestal and datomic so I’ll give it a look. I was using stuartsierra/component and creating the Datomic client when I started the system on ns load.

Joe Lane19:09:09

I'd say stick with pedestal and datomic for now. We actually backed off from vase on our project for now until it gets some TLC.

eggsyntax19:09:41

Hey y'all 👋 . I'm curious to hear y'all's opinion about when you would choose to use a Datomic enum as opposed to a keyword. One obvious distinction is that an enum is only suitable for a closed set, but are there other factors you consider? What if you have a closed set in terms of what values can be added at any given time, but expect that set to potentially grow in the future? Thanks!

johnj19:09:08

datomic has enums?

johnj19:09:15

Can see how that title is confusing, but the gist is to use :db/ident to model "enum-like" stuff

johnj19:09:59

why do you think that is a closed set?

eggsyntax20:09:24

Mainly because that's the usual convention for enums. And because unless I'm misremembering, you couldn't transact (to use their music DB example)

[<some-entity> :artist/country :country/NONEXISTENT-VALUE]

johnj20:09:09

If you read past the title of the link you gave you'll see there is no enum type.

johnj20:09:55

For your transact "issue", that's not how you model entities in datomic, read this carefully https://docs.datomic.com/cloud/whatis/data-model.html

johnj20:09:02

it applies to on-prem

eggsyntax20:09:58

Thanks for the feedback!

Quest22:09:23

performance on heterogenous vs homogenous tuples Say I have a tuple of [type spec], where both values are strings. This vector is guaranteed to be length = 2. I can model this as a homogenous tuple of strings - :db/tupleType :db.type/string or a heterogenous tuple - :db/tupleTypes [:db.type/string :db.type/string] I suspect performance+storage will be better on the homogenous tuple. However, the heterogenous tuple more accurately models the data as it forces count = 2. Are these correct assumptions?