Code Monkey home page Code Monkey logo

datomic-storage-proxy's Introduction

Datomic storage proxy (dsp)

This repository answers a question you probably never wanted to know :-

  • Could Datomic's storage layer use other KV stores aside from the officially supported ones?
  • How would you hack together a terrible JDBC driver?

Compile the JDBC Datomic Storage Proxy Driver

This driver needs to be available on the classpath for both the Datomic transactor and the Datomic peer

clj -M:build-driver

Copy the resulting target/net.xlfe.dsp.jdbc.driver-<VERSION>.jar to the lib path for the Datomic transactor as well as the project where you're using the associated Datomic Peer

Supported KV Stores

GCP Datastore

Datastore

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json
(ns peer
  (:require [datomic.api :as d]))

(def gcp-datastore-connection-map
  {:protocol :sql
   :sql-driver-class "net.xlfe.dsp.jdbc.Driver"
   :db-name "datomic-database-name"
   :sql-url "gcp-datastore://project-id/datastore-id?namespace=datastore-namespace"})

(defn -main
  []
  (d/create-database gcp-datastore-connection-map)
  (let [conn (d/connect gcp-datastore-connection-map)]
    (run-tests conn)

Datastore emulator

gcloud beta emulators datastore start --use-firestore-in-datastore-mode
(ns peer
  (:require [datomic.api :as d]))

(def gcp-datastore-connection-map
  {:protocol :sql
   :sql-driver-class "net.xlfe.dsp.jdbc.Driver"
   :db-name "datomic-test-db"
   :sql-url "gcp-datastore-emulator://localhost:8081/test-project?namespace=datomic123"})

(defn -main
  []
  (d/create-database gcp-datastore-connection-map)
  (let [conn (d/connect gcp-datastore-connection-map)]
    (run-tests conn)

Datalevin server

Datalevin has a standalone commandline client that runs a server which we can connect to over a network

(ns peer
  (:require [datomic.api :as d]))

(def datalevin-connection-map
  {:protocol :sql
   :sql-driver-class "net.xlfe.dsp.jdbc.Driver"
   :db-name "datomic-test-db"
   :sql-url "dtlv://datalevin:datalevin@localhost:8898/my-kv-store?table=datomic-table"})

(defn -main
  []
  (d/create-database datalevin-connection-map)
  (let [conn (d/connect datalevin-connection-map)]
    (run-tests conn)

Note the sql url is actually the Datalevin's server url with the addition of a query param ?table=datomic-table to indicate the table

datomic-storage-proxy's People

Contributors

xlfe avatar

Stargazers

Markus Penttilä avatar Justin Tirrell avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.