datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
Lukas 2020-08-20T12:54:22.003500Z

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.

marshall 2020-08-20T12:55:29.004100Z

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

Lukas 2020-08-20T12:56:09.005100Z

oh the return is actually the mapping 😅 thanks!

marshall 2020-08-20T12:56:15.005300Z

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

1👍
2020-08-20T15:25:52.006100Z

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.

marshall 2020-08-20T16:20:30.006600Z

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

marshall 2020-08-20T16:20:36.006800Z

you need to update to at least that version

marshall 2020-08-20T16:21:02.007Z

but you should go to latest

donyorm 2020-08-20T17:57:56.007700Z

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'} ?

2020-08-20T18:55:42.011400Z

@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.

marshall 2020-08-20T18:59:07.012400Z

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

marshall 2020-08-20T18:59:24.012900Z

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

2020-08-20T19:00:14.013600Z

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

tvaughan 2020-08-20T19:58:41.021300Z

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?

marshall 2020-08-20T19:59:33.021600Z

you've created a composite tuple

marshall 2020-08-20T20:00:33.022700Z

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

marshall 2020-08-20T20:01:22.023700Z

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

marshall 2020-08-20T20:01:45.024300Z

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

marshall 2020-08-20T20:02:00.024800Z

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

marshall 2020-08-20T20:02:39.025600Z

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

marshall 2020-08-20T20:03:14.025800Z

@tvaughan ^

marshall 2020-08-20T20:03:59.026600Z

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

marshall 2020-08-20T20:04:06.026900Z

instead of :db/tupleAttrs

tvaughan 2020-08-20T20:06:14.027500Z

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

tvaughan 2020-08-20T20:07:00.028200Z

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

marshall 2020-08-20T20:07:23.028600Z

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

tvaughan 2020-08-20T20:10:13.030200Z

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)

marshall 2020-08-20T20:21:25.031200Z

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

tvaughan 2020-08-20T20:36:00.032100Z

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

marshall 2020-08-20T20:45:25.032300Z

:thumbsup:

stuarthalloway 2020-08-20T21:49:11.033400Z

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

9🎉