datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
daniel.spaniel 2020-11-27T09:24:44.018400Z

I am trying to set up a composite tuple index for lets say an account entity and I am doing this ( which is like something straight out of the docs )

{:db/ident       :account/company+number
 :db/valueType   :db.type/tuple
 :db/tupleAttrs  [:account/company :account/number]
 :db/cardinality :db.cardinality/one
 :db/unique      :db.unique/value
 }
where the account/company is a ref and the account/number is a long. the problem is that the account/number value (that datomic is filling in) is always -> nil. it seems like this tuple will be filled in by datomic correctly when the attrs are anything BUT ref and something else. if i do keyword and long its fine, but ref and anything else does not work. is this a known issue ?

souenzzo 2020-11-27T12:22:35.018700Z

I tryied to reproduce this issue here https://gist.github.com/souenzzo/3ba161909006ef08d53ac63a1d622fa2 But I can't understand where you are seeing this nil

daniel.spaniel 2020-11-27T12:52:22.020900Z

i am going to run this gist in my db and see if i can alter it to show good reproduction of issue

👍 1
daniel.spaniel 2020-11-27T13:17:09.021200Z

this does work on my db so that was interesting. thanks. i now have to correlate this with my schema and see what is different. Muchos thanks again!

jcf 2020-11-27T14:35:59.023900Z

Is anyone here using AssumeRole/STS to delegate access to sub-accounts in AWS, and successfully connecting to a running Datomic system with the Datomic CLI?

./datomic cloud list-systems --profile example-dev
WARNING: When invoking clojure.main, use -M
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Execution error (ExceptionInfo) at datomic.tools.ops.aws/invoke! (aws.clj:83).
AWS Error: Unable to fetch credentials. See log for more details.
Running aws --profile example-dev s3 ls works as expected so I think this might be a problem in the Datomic CLI side of things. My ~/.aws/config looks good to me:
[profile example]
region=eu-west-2

[profile example-dev]
role_arn=arn:aws:iam::111111111111:role/developer
source_profile=example
Credentials should be inherited from the example profile… the AWS CLI appears to get this right so I think my ~/.aws stuff is kosher.

jcf 2020-11-27T14:37:06.024Z

I vaguely remember a problem with some Datomic tooling and use of assumed roles. The workaround was to juggle your AWS config about so you're not using profiles but this won't work here as I have to STS my way into the sub account. No direct access possible.

jcf 2020-11-27T14:41:41.024200Z

I've added the SSH ingress rule to the bastion security group, and I've attached the Datomic Admin policy to the role that gets assumed when you switch into the sub-account.

jcf 2020-11-27T14:42:46.024400Z

I don't know what the "log" is that the error refers to. I've seen that in cognitect-labs/aws-api too and didn't know what log was being referred to there either. 🙈

daniel.spaniel 2020-11-27T16:39:46.024700Z

i found the problem .. we are doing this

{:db/ident       :accounting-category/company+number
                           :db/valueType   :db.type/tuple
                           :db/tupleAttrs  [:entity/company :accounting-category/number]
                           :db/cardinality :db.cardinality/one
                           :db/unique      :db.unique/value
                           }

daniel.spaniel 2020-11-27T16:40:00.024900Z

and this attribute entity/company is shared with other entities.

daniel.spaniel 2020-11-27T16:40:17.025100Z

seems like datomic trying to make this tuple for any entity with that attirbute and not just accounting-category entity

daniel.spaniel 2020-11-27T16:48:35.025300Z

is there a way to stop that and only make this constraint tuple when this exact entity is created / edited ?