datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
babardo 2021-02-25T13:45:21.035800Z

simple question, what datomic.client.api/delete-database does in Datomic Cloud ? • is the operation revertable? • do we still keep past transactions in s3?

donavan 2021-02-25T14:13:25.036600Z

What’s the easiest way to insert ref entities; I’d imagine doing something like this but it doesn’t work:

(d/transact
     conn
     {:tx-data
      '(#:sub-thing{:some-field "some-data"
                    :_thing/sub-things [:thing/id "some-application-level-id"]})})

donavan 2021-02-25T14:19:58.036700Z

I guess this is it

(d/transact
     conn
     {:tx-data
      [{:thing/id "some-application-level-id"
        :thing/sub-things '(#:sub-thing{:some-field "some-data"})}]})

kenny 2021-02-25T14:29:53.037300Z

I don’t believe it is reversible. https://ask.datomic.com/index.php/550/does-deleting-database-permanently-remove-stored-database

babardo 2021-02-25T14:30:35.037600Z

oh I missed that thx 🙏 I guess we have the same behavior for datomic cloud

souenzzo 2021-02-25T15:31:18.038Z

Hey @donavan As far I know, you can always use [] '() are just more complex to write Here your examples expanded

;; first try
{:tx-data [#:sub-thing{:some-field        "some-data"
                       :_thing/sub-things [:thing/id "some-application-level-id"]}]}
=> {:tx-data [{:sub-thing/some-field "some-data"
               :_thing/sub-things    [:thing/id "some-application-level-id"]}]}
;; Second try
{:tx-data [{:thing/id         "some-application-level-id"
            :thing/sub-things [#:sub-thing{:some-field "some-data"}]}]}
=> {:tx-data [{:thing/id         "some-application-level-id"
               :thing/sub-things [{:sub-thing/some-field "some-data"}]}]}

souenzzo 2021-02-25T15:32:43.038200Z

In the first case, I think that you miswrite the "reverse reference" I think that you tryied to write this:

{:tx-data [#:sub-thing{:some-field  "some-data"
                       :_sub-things [:thing/id "some-application-level-id"]}]}
=> {:tx-data [{:sub-thing/some-field  "some-data"
               :sub-thing/_sub-things [:thing/id "some-application-level-id"]}]}

donavan 2021-02-25T15:33:27.038400Z

Thanks, yeah I just copied that from a much larger tree that I was generating programatically, I don’t normally write manual lists 😄

1✔️
donavan 2021-02-25T15:34:04.038700Z

Good spot re. the reverse reference…

donavan 2021-02-25T15:34:35.038900Z

Again, mixing up data that was from repl output with hand written modifications

donavan 2021-02-25T15:35:06.039100Z

So are the reverse references valid in tx-data entities like that? (I will test later regardless)

souenzzo 2021-02-25T15:43:20.039300Z

I think that yes, but I already had some issues using lookup references in some places. Sometimes it feels intuitive to use them, but in pratice you need to resolve and use "the db id" For example I had issues with [:db/cas e a v0 v1] when v0 is an entity, I tryied to use lookup ref and datomic do not accept its IMHO it's a bug from datomic and not sure if in newer versions it's fixed. lookup reference - when you do [:an-unique-attr "it's value"]

donavan 2021-02-25T15:46:12.039600Z

Ah cool, thanks for the info! 🙂 I didn’t know if it was possible so just reverted to the second approach above without thinking too hard about it.

souenzzo 2021-02-25T15:49:44.039800Z

i reported that cas bug in a portal that i think that do not exists anymore 😅

xceno 2021-02-25T19:09:57.041500Z

Does anyone know if the https://github.com/uncomplicate/neanderthal stack (specifically the intel-MKL dependency `[org.bytedeco/mkl-platform-redist "2020.3-1.5.4"]`) "just works" on a datomic ion project, or would I have to tinker with the EC2 Compute Instances/Templates?

Joe Lane 2021-02-25T19:16:56.042400Z

intel-MKL uses AVX operations. Just make sure you're using an instance that supports that. Please don't "tinker" with the instance templates.

xceno 2021-02-25T19:40:51.042900Z

Alright thanks! I asked because i specifically don't want to mess with the templates, so no worries! 😉

Joe Lane 2021-02-25T19:45:41.043100Z

FWIW, this isn't a green light expecting everything to work perfectly out of the box. I think you should try it and report back.

xceno 2021-02-25T19:47:10.043300Z

Got it! I'll just try and see how it goes then