Fork me on GitHub
#datomic
<
2020-01-13
>
csm05:01:45

hi! is there a way to rotate the Datomic Cloud access keys (stored in S3)? I did something stupid with one of my access keys, and even though it’s a test solo install, would rather not delete & recreate it

skuttleman17:01:41

Hello. I'm having trouble writing/using a custom transaction fn. Specifically, it seems to choke only on attributes that are :db.cardinality/many. From the repo that contains the function I can can inovke:

(my-namespace/my-db-fn (datomic.api/db conn) {:test-entity/id "my-unique-id"
                                              :test-entity/coll ["foo" "bar"]})
And I get an output I expect:
[[:db/add "DBID23569" :test-entity/id "my-unique-id"]
 [:db/add "DBID23569" :test-entity/coll "foo"]
 [:db/add "DBID23569" :test-entity/coll "bar"]]
When I pass the output to datomic.api/transact , it transacts and I can query it and very that it's there. However, when I try to invoke the function running on the transactor:
(datomic.api/transact conn [['my-namespace/my-db-fn {:test-entity/id   "my-unique-id"
                                                     :test-entity/coll ["foo" "bar"]}]])
I get this error:
:db.error/wrong-type-for-attribute Value [foo bar] is not a valid :string for attribute :test-entity/coll
I would appreciate any pointers in a helpful direction, because I'm completely lost as to what to do. Thanks!

favila19:01:18

Maybe a Dumb Question, but are you sure that the transactor has the same version of the function as what is in your repl?

favila19:01:16

perhaps it has an earlier version that returned [:db/add "DBID23569" :test-entity/coll ["foo" "bar"]] ?

skuttleman20:01:24

I only ever deployed one version, so that couldn't be it. On the bright side I found the answer (for posterity's sake): sending vectors to the transactor get deserialized as java.util.ArrayList. I was using clojure.core/coll? to detect collections, but java.util.ArrayLists respond false to clojure.core/coll?. I switched to check for java.util.Collection and it all seems to work now.

👍 1
favila20:01:20

out-of-the-box clojure.data.fressian does the same thing

eoliphant20:01:32

Hi are there any more complete examples of the analytics metaschema around? (e.g. for mbrainz)

jaret18:01:20

Hi @U380J7PAQ here is my metaschema which I use on the subset of mbrainz-1968-1973.

;;mbrainz subset metaschema
{:tables ;; :membership-attr->opts
 {:abstractRelease/gid {}
  :artist/gid {}
  :country/name {}
  :artist.type/name {}
  :artist.gender/name {}
  :label.type/name {}
  :label/gid {}
  :language/name {}
  :medium.format/name {}
  :release.packaging/name {}
  :medium/format {}
  :release/gid {}
  :script/name {}
  :track/name {}}

 :joins ;;ref-attr -> tablename
 {:abstractRelease/artists artist
  :label/country country
  :label/type label_type
  :release/country country
  :release/language language
  :release/script script
  :release/packaging release_packaging
  :release/artists artist
  :release/labels label
  :artist/country country
  :artist/gender artist_gender
  :artist/type artist_type
  :medium/format medium_format
  :medium/tracks track
  :track/artists artist}}

eoliphant21:01:12

ah great thanks man

eoliphant21:01:52

it’d be great if you guys added that to the docs 🙂