datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
Jake Shelby 2021-02-04T02:07:13.121100Z

I'm seeing some behavior in datomic cloud (both remote connection, and when deployed in ions), that is contrary to what I've been led to believe as "the database as a value". When I acquire a "current" DB value from a connection, their hash is new every time I ask for it, even though the DB values have the same t basis. When I run the same test with dev-local, I do see the desired behavior, that in fact, 2 DBs of the same basis are equal. Does anybody know why the client API behaves this way, and why it's different from dev-local?

;; dev-local connection, using dl/divert-system
  (let [c   (conn)
        db1 (d/db c)
        db2 (d/db c)]
    {:db1      db1
     :db2      db2
     :db1-hash (hash db1)
     :db2-hash (hash db2)
     :eq?      (= db1 db2)
     :type     (type db1)})
  ;; => {:db1
  ;;     #datomic.core.db.Db{:id "import-202123-1720", :basisT 3151, :indexBasisT -1, :index-root-id nil, :asOfT nil, :sinceT nil, :raw nil},
  ;;     :db2
  ;;     #datomic.core.db.Db{:id "import-202123-1720", :basisT 3151, :indexBasisT -1, :index-root-id nil, :asOfT nil, :sinceT nil, :raw nil},
  ;;     :db1-hash -1795899545, ;; These stay the same as long as nothing more is transacted
  ;;     :db2-hash -1795899545, ;; These stay the same as long as nothing more is transacted
  ;;     :eq? true, ;; This was intended
  ;;     :type datomic.core.db.Db}

  ;; Remote connection, using :server-type :ion
  (let [c   (conn "core-prod" "XXXX.core.prod")
        db1 (d/db c)
        db2 (d/db c)]
    {:db1      db1
     :db2      db2
     :db1-hash (hash db1)
     :db2-hash (hash db2)
     :eq?      (= db1 db2)
     :type     (type db1)})
  ;; => {:db1
  ;;     {:t 3150, :next-t 3151, :db-name "XXXX.core.prod", :database-id "de0a365c-eb28-4cf4-a490-bd0bcfff8104", :type :datomic.client/db},
  ;;     :db2
  ;;     {:t 3150, :next-t 3151, :db-name "XXXX.core.prod", :database-id "de0a365c-eb28-4cf4-a490-bd0bcfff8104", :type :datomic.client/db},
  ;;     :db1-hash 256930107, ** New hash values everytime I acquire **
  ;;     :db2-hash 8175244, ** New hash values everytime I acquire **
  ;;     :eq? false, ;; ** This is not intended **
  ;;     :type datomic.client.impl.shared.Db}

Jake Shelby 2021-02-04T15:55:49.130600Z

This was one of the biggest benefits that I saw early on: https://youtu.be/4iaIwiemqfo?t=3755

joe smith 2021-02-04T05:41:53.121500Z

What is a Query group? If I'm in production, do I also need to launch a Query group server as well? For development, is the Solo instance missing any features from the production Datomic?

danieroux 2021-02-04T10:05:32.130200Z

The solo instance misses https://docs.datomic.com/cloud/ions/ions-tutorial.html#http-direct and for development, I would start with https://docs.datomic.com/cloud/dev-local.html

danieroux 2021-02-04T10:06:45.130400Z

A query group is a separate cluster that reads and caches the data, so it doesn’t affect your other clusters. It becomes useful when you have different workloads on the system

tatut 2021-02-04T05:59:46.122200Z

It is a value in the sense that passing the same db to a query will give the same results… but not in more strict senses

tatut 2021-02-04T06:00:23.122400Z

I wouldn’t rely on the identity or hash of the db handle

joe smith 2021-02-04T06:56:50.126700Z

is it possible to build a REST api around Datomic so that it can be called by other API end points sort of like microservice architectures? I want to have a serverless (AWS Lambda) web facing API for handling application logic and then use datomic to keep track of financial transactions (in particular double entry ledger). I want to be able to do /datomic/ledger/user234/credit/1000 and it should make that changes on the datomic. I guess this is where the lambda proxies come in that can expose datomic functions on AWS API Gateway/Lambda ? With the above scenario, do I lose any performance benefits for reading, (I have a vague understanding of Peer and caching) by calling everything over the wire (rest api)? If so, how should I be architecting here? Lastly, what AWS Database do you recommend for storage? If I use RDS MySQL instance, will I be able to do SQL queries as well? Or is it completely opaque regardless of what underlying DB you use? Thanks again!

danieroux 2021-02-04T10:02:29.129900Z

It is completely opaque, you cannot specify storage but: https://docs.datomic.com/cloud/analytics/analytics-concepts.html will give you SQL view into the database https://www.youtube.com/watch?v=thpzXjmYyGk is a deep dive on Datomic Ions, worth watching

joe smith 2021-02-05T01:51:35.136300Z

thanks guys!

tatut 2021-02-04T07:58:30.129100Z

You certainly can make a REST API around your Datomic stuff

tatut 2021-02-04T07:58:50.129300Z

Datomic cloud doesn’t allow you to specify what storage to use afaict

eraad 2021-02-04T19:52:48.131900Z

Hi! I would appreciate pointers on how to avoid an IAM user from deleting a database

Schmoho 2021-02-04T20:13:19.134Z

I am super confused by the Datomic product range ... I just want to develop a personal project that needs to run only locally on my machine using Datomic. Now I understand I should either use Datomic Free or Datomic Starter, but now I've also come across dev-local which apparently provides the Client API - does that then not entail any storage? What exactly is dev-local?

alexmiller 2021-02-04T20:17:16.134600Z

dev-local has storage and is probably a great match for this if it's a personal project

✔️ 3
kenny 2021-02-04T20:17:49.134800Z

Have you seen https://docs.datomic.com/cloud/dev-local.html?

Schmoho 2021-02-04T20:29:29.135100Z

Ok thanks ... why are there three "free to use" versions of Datomic? Is it all about licensing?

Schmoho 2021-02-04T20:32:13.135400Z

Ah yeah reading this a little more thoroughly would have answered the storage question ... the "why the diversity" question not really though. 😉 thanks

alexmiller 2021-02-04T20:32:58.135600Z

I would defer to someone on the Datomic team to answer that more fully so that I don't say something dumb :)

kenny 2021-02-04T20:35:46.135800Z

There's two different products -- Cloud and On-Prem. Datomic free is mostly deprecated, I think.