Fork me on GitHub
#datomic
<
2021-10-19
>
Kris C07:10:18

How can I start Datomic (in-memory) within a JVM application (Java/Kotlin) for integration testing? Are there any docs regarding this?

Linus Ericsson12:10:21

in On-Prem: Use a database uri on the form "datomic:<mem://some-mem-db-1>" and make d/create-database etc just as if it was an external db with a transactor.

souenzzo14:10:17

;; on-prem
(defn memory-conn
  [db-name]
  (-> (str "datomic:mem://" db-name)
    (doto d/delete-database
          d/create-database)
    d/connect))
;; cloud
(defn memory-conn
  [db-name]
  (let [client (d/client {:server-type :dev-local
                          :system      (str db-name)})]
    (-> client
      (doto (d/delete-database {:db-name (str db-name)})
            (d/create-database {:db-name (str db-name)}))
      (d/connect {:db-name (str db-name)}))))

(let [;; Do not be afraid to generate many names 
      conn (memory-conn (UUID/randomUUID))
      {:keys [db-after]} (d/transact conn tx-schema)]
  (do-thing {::conn conn} ...))
Also take a look at https://github.com/vvvvalvalval/datomock

Kris C07:10:31

Thanks! šŸ‘

Daniel Jomphe19:10:36

Upgrading Datomic Cloud storage will delete too many resources, why?

Daniel Jomphe19:10:24

From 884-9095 to 936-9118, switching Reuse Existing Storage from false to true since this is this stack's first upgrade ever. This yields a very dubious change set, wherein important EFS, DDB and etc. resources are to be removed.

Daniel Jomphe19:10:44

If I flip the argument to Reuse Existing Storage = false, then it yields a more reasonable changeset. It's as if it yields the reverse of what it should yield.

Daniel Jomphe19:10:16

I manage several Datomic Cloud systems in different AWS accounts. An hour ago I upgraded my first environment. It yielded a 2-changeset like the last screenshot above. The upgrade went fine.

Daniel Jomphe19:10:19

Why is it that this other AWS account's CloudFormation seems to read the reverse of my Restart/Reuse Existing Storage parameter?

Daniel Jomphe19:10:08

It's now been one year that I track each Datomic Cloud release in a few AWS accounts. It's the first time I see the upgrade process propose to do the reverse of what we want in an upgrade.

Daniel Jomphe19:10:45

This is one of our newest AWS accounts, and this CloudFormation stack's first upgrade. Before I came to update it, its Reuse Existing Storage was still at its pristine false value, and I obviously switched it true but the ChangeSet yielded showed me CF is about to delete my storage if I proceed. I suspect the new CF Yaml to react badly to our changing the Reuse Existing Storage parameter on a never-before-upgraded stack!?

Daniel Jomphe19:10:46

The other account I successfully upgraded an hour ago already had its Reuse Existing Storage param set to true during last summer's update. And it went fine without proposing to delete my storage.

Daniel Jomphe19:10:18

Thanks for any help. Should I proceed asking for the reverse of what I want so that I get what I truly want? A quick read of the CF template tells me this might be a bad idea, even though the change set then looks reasonable.

Daniel Jomphe21:10:27

To help not duplicate efforts with Cognitects, please know that I submitted a support request (#3334).

Daniel Jomphe14:10:52

For posterity's sake, we found out that since this is a new stack that was never upgraded before, the change set built is bigger (compared to the other stack that had already gone through an update). That's normal. So I applied the update as instructed and all went fine...

Daniel Jomphe19:10:19

Why is it that this other AWS account's CloudFormation seems to read the reverse of my Restart/Reuse Existing Storage parameter?

Ty21:10:47

This is not a datomic-specific question but rather a bit more general. I've been eyeing some of the RDF implementations from afar for a while, and I've finally wrapped my head around them over the last month or so. I've hit a point recently where I've started to think that RDF (and when I say RDF I specifically mean something like Datomic/XTDB flavors of RDF) can be used to model any type of data. So my questions to folks who are more familiar with it and have battle-tested it in the real world: 1. Where, if anywhere, does this approach fall down from your perspective? 2. What are the most important lessons that you wish you had learned earlier when taking this type of approach to domain modeling? 3. Do you think this type of approach can model any data domain? If so, is it actually the best fit for everything? Or are there situations in which it doesn't make sense to use.

favila21:10:54

xtdb is actually a document storeā€¦

Alex Miller (Clojure team)21:10:37

I am not a Datomic expert, but have done several projects with it, and also worked for several years building RDF-based products. I find Datomic EAV to be a fantastic fit for things that are "mostly tabley" (entities that mostly have the same set of attributes but maybe sparse), but a little graph-y (particularly hierarchies). In general, I think those capabilities are extremely flexible for modeling a wide range of human information systems. For working with very structured data (columnar, aggregate star schema rollups, time series, etc) designed for specific access patterns and very high performance, those custom fit structures are probably going to be better than the relational approach. And on the other end, things that are very graphy (non-hierarchical networks), probably graph-first dbs have support for things like nearest-neighbor queries that would not be as good in Datomic.

Michael Stokley23:10:33

this query

'[:find ?e
  :in $ [?vs ...]
  :where
  (not (not [?e :some-card-many-attr-of-type-ref ?vs]))]
would mean something like "get me any entity ?e that is not related to any v outside of the group ?vs", is that right? "exclude any ?e related to a v outside of ?vs"