Fork me on GitHub
#datomic
<
2020-08-20
>
Lukas12:08:22

Hello 👋 is there a way to get the entity ID of a entity that was created using the clojure d/transact function? The function returns the tempids, but I need the actual entity IDs as I use these as unique identifiers and need a reference to a user I just created.

marshall12:08:29

@lukasmoench1113 the return from transact includes a :tempids map that provides the mapping from the tempids to the final entity IDs

Lukas12:08:09

oh the return is actually the mapping 😅 thanks!

marshall12:08:15

the :tempids key - there is an example of doing that just below the table

👍 3
maxt15:08:52

I get the following error while trying to upgrade datomic cloud storage. Is it known?

The runtime parameter of nodejs8.10 is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs12.x) while creating or updating functions.

marshall16:08:30

@maxt Datomic cloud 569-8835 moved to using nodejs 10.x

marshall16:08:36

you need to update to at least that version

marshall16:08:02

but you should go to latest

donyorm17:08:56

Hey I'm trying to get a codebuild instance to be able to push up ions with datomic cloud. What permissions would the codebuild role need in order to run {:op 'push'} ?

maxt18:08:42

@marshall I was able to upgrade my (all 44) lambdas using the aws cli tools, and then I could update my other compute node. But the one I started with, got stuck in UPDATE_ROLLBACK_FAILED , and then I can't rerun the upgrade. The rollback also fails, because the old version is ofcourse also using old nodejs, and is not allowed to proceed anymore.

marshall18:08:07

@maxt can you please file a support ticket (<mailto:[email protected]|[email protected]>) Manually altering components of the system is not recommended and we may need to help you work through how to resolve that

marshall18:08:24

upgrading the system overall (storage stack and compute stack) should have done it automatically for you

maxt19:08:14

ok, I thought that part maybe wasn't automatic. Sure, I'll file a ticket, thanks.

tvaughan19:08:41

I'm running across a strange problem. I have this in my schema (abbreviated):

{:db/ident :length/mm
  :db/valueType :db.type/double
  :db/cardinality :db.cardinality/one}
{:db/ident :dash-space/mm
  :db/valueType :db.type/tuple
  :db/tupleAttrs [:length/mm :length/mm]
  :db/cardinality :db.cardinality/one
  :db/unique :db.unique/value}
I never transact :dash-space/mm, but I do transact other things like:
{:radius/key unique-string-1 :length/mm 254.0}
{:length/key unique-string-2 :length/mm 254.0}
At some point (still more digging required) I get a unique constraint error on :dash-space/mm for the values of [254.0 254.0] . I can't say I really understand this problem. Getting rid of :dash-space/mm in the schema does eliminate it, but I assume there's something incorrect about the use of :db/tupleAttrs above, right?

marshall19:08:33

you've created a composite tuple

marshall20:08:33

your :`dash-space/mm` attribute is automatically created on any entity with either of the attrs in the :db/tupleAttrs vector

marshall20:08:22

because you have it set to :db.unique/value if you ever try to transact data that would create a composite with the same value (254 254 in this case), you get the unique value error

marshall20:08:45

if it were set to :db.unique/identity it would "upsert" instead

marshall20:08:00

and if it were not set to any uniqueness, it would create a new entity

marshall20:08:39

all that said, i'm not sure the purpose of making a composite tuple with a repeated attr

marshall20:08:59

if you just wanted a tuple that would hold two arbitrary longs, unrelated to other attributes on that entity, you'd need to use :db/tupleTypes or :db/tupleType

marshall20:08:06

instead of :db/tupleAttrs

tvaughan20:08:14

Awesome @marshall! Thanks for the quick and clear response!

tvaughan20:08:00

FYI, I didn't create this part of the schema so I can't say why it was done this way

marshall20:08:23

do you know what the intended use/purpose of that attribute is?

tvaughan20:08:13

I suspect it's trying to capture the length of the dash and space, and place a unique constraint on the pair of values (which are really references)

marshall20:08:25

incidentally, using doubles as identity is pretty iffy; given the semantics of doubles / precision / comparison /etc, i'd definitely be wary of using them as any kind of identifier Thanks to @alexmiller for mentioning it

tvaughan20:08:00

Oh, I'm aware, thanks. The values shouldn't have a unique constraint. This is definitely an error on our part

stuarthalloway21:08:11

#rebl and Datomic dev-local are now free as part of Cognitect dev-tools https://cognitect.com/dev-tools/

🎉 27