Fork me on GitHub
#datomic
<
2019-10-06
>
jumar05:10:48

Looking at https://aws.amazon.com/marketplace/pp/Cognitect-Inc-Datomic-Cloud/prodview-otb76awcrb7aa it seems that in the Fullfillment Options section each option is duplicated. I'm wondering why is that 🙂.

jaret12:10:33

We’re working with AWS to correct this, but with the recent release they duplicated the listing. One option is the most recent release and the other is all previous. We’re working with them to correct this so they roll up.

👍 4
cjsauer13:10:03

Has anyone been making use of the newer entity predicates and attribute constraints? I’m doing some data modeling and am curious how others have been using these features, and also how they might integrate with spec.

keymone17:10:36

is this call supposed to work: (d/transact conn {:tx-data [{:db/doc "hello world"}]})? docs suggest that second arg should be a list of lists

keymone17:10:12

ok, apparently datomic.api is not datomic.client.api

keymone17:10:04

is there a document that explains when to use one over the other?

keymone19:10:50

did anybody get ClassNotFoundException about org.eclipse.jetty.util.thread.ThreadPoolBudget? just trying to connect to peer server

jaret12:10:18

Hi. Have you tried setting your creds by sourcing a file with the following?:

aws_access_key_id=<access-key-id>
aws_secret_access_key=<secret-access-key>

jaret12:10:40

You can also export them one by one if putting that in a file isn’t your jam.

MegaMatt13:10:58

i have the above creds suggested in my ~/.aws/credentials.

jaret13:10:52

Could you try to explicitly export them in the terminal you’re using to push as a test to confirm that the env vars are in that terminal

MegaMatt13:10:22

i’ve done aws configure --profile myprofile is that what you mean?

MegaMatt13:10:21

i tried export aws_access_key_id=abc123 with no change

jaret14:10:07

@U5136PEE6 The credentials you source need the ability to be able to read S3. Can you confirm your credentials being sourced have s3 permissions?

MegaMatt15:10:20

assuming it is using the credentials i’m expecting, this is its permissions

MegaMatt17:10:57

i’ve tried specifying a server in m2 settings but that doesn’t help either unfortunately

MegaMatt18:10:21

furthermore i’ve tried creating an s3 bucket with the datomic pom it is having difficulty getting to in my own s3 in the same path and it still is unable read artifact

MegaMatt18:10:14

well, even making my bucket public doesn’t solve the issue. I’m guessing it is something other than aws permissions. I seem to be on clojure 1.10.0

MegaMatt18:10:18

well, i got it working by manually creating directories in .m2/repositories and using aws cli to manually download the files. :man-shrugging: if this ever gets close to prod i’ll revisit this

bartuka23:10:07

I have a field with cardinality set to many. Having the ID of the parent entity, Can I filter to get only the child entities that pass some rule? For example:

[;; person schema
 {:db/ident :person/cars
  :db/valueType :db.type/ref
  :db/cardinality :db.cardinality/many}
 {:db/ident :person/name
  :db/valueType :db.type/string
  :db/cardinality :db.cardinality/one}

 ;; cars schema
 {:db/ident :cars/model
  :db/valueType :db.type/string
  :db/cardinality :db.cardinality/one}
 ]
Imagine the data inside the database:
[{:db/id "A"
  :person/name "Bart"}
 {:cars/model "Model1"
  :person/_cars "A"}
 {:cars/model "Model1"
  :person/_cars "A"}
 {:cars/model "Model2"
  :person/_cars "A"}]
I have only the name "Bart" and "Model2" at hand. I want to get back only the fields {:person/name "Bart" :person/cars {:cars/model "Model2"}}

Keith01:10:09

You could use pull with [:person/name {:person/cars [:cars/model]}]

Keith01:10:16

Ah, after starting to write the query, I realised what your problem was and my previous answer doesn't solve it. That said, you could simply write a rectangular query and transform the values after the fact.

bartuka02:10:01

Sorry, I am new to datomic. Could you explain more about your last suggestion?

Keith10:10:48

Sure, you would want to write a query that finds all entities with a :cars/model attribute with a value of "Model2", then use that to find the parent entity with a • :person/cars attribute with a value that matches the first entity you found • :person/name attribute with a value of "Bart"

Keith10:10:26

I imagine there's more data that you would want to retrieve besides {:person/name "Bart" :person/cars {:cars/model "Model2"}} since you stated that you have both "Bart" and "Model2" at hand. Here's an example query:

(d/q '[:find ?name ?model
       :in $ ?name ?model
       :where
       [?car :cars/model ?model]
       [?person :person/cars ?car]
       [?person :person/name ?name]]
     db
     "Bart"
     "Model2")

Keith10:10:34

You would take the result of that query, and transform it into the shape that you need it to be in, so if you wanted to get back something like {:person/name "Bart" :person/cars {:cars/model "Model2"}}

(let [query-result [["Bart" "Model2"]]]
  (first (map (fn [[name model]]
                {:person/name name :person/cars {:cars/model model}})
              query-result)))
=> #:person{:name "Bart", :cars #:cars{:model "Model2"}}

Keith10:10:15

Or using :keys,

(first (map (fn [{:keys [person/name cars/model]}]
              {:person/name name :person/cars {:cars/model model}})
            (d/q '[:find ?name ?model
                   :keys person/name cars/model
                   :in $ ?name ?model
                   :where
                   [?car :cars/model ?model]
                   [?person :person/cars ?car]
                   [?person :person/name ?name]]
                 db
                 "Bart"
                 "Model2")))

bartuka12:10:11

great @U424XHTGT thank you for the detailed examples

👍 8