Fork me on GitHub
#datomic
<
2018-03-27
>
joshwolter01:03:44

Thanks @jaret! I had to run, will do tomorrow morning.

iarenaza10:03:20

Is it possible to have database functions if using the Client API? Does it depend on whether you are using Datomic On-Prem or Datomic Cloud?

stijn20:03:39

Is it possible to run in-mem with the client lib?

stijn20:03:03

I can't seem to find anything in the docs

donmullen20:03:41

@stijn - no in-mem with client lib

donmullen20:03:30

Sorry @stijn - was thinking cloud client - Jaret / Marshall obviously correct!

Wes Hall20:03:57

Anyone know if the datomic cloud client library works in cljs? Or if there is a cljs port?

donmullen20:03:51

@wesley.hall - no - I believe there is somewhere you can vote for new client libraries - cljs is one people (including myself) have been asking about. There is an issue with security that would need to be addressed.

Wes Hall20:03:05

Ok, thanks. I will look for the vote. It's only really that I want to access from AWS lambda. I can build the lambda on the JVM but startup time is a bit of a PITA when it comes to JVM lambdas, node is better.

stijn20:03:28

ok, no in-mem then, but how do you develop with rapid schema changes when trying out stuff?

marshall20:03:58

@stijn yes, you can run an in memory db with peer server using on-prom and connect to it with client

jaret20:03:41

@stijn

$ bin/run -m datomic.peer-server -h localhost -p 8998 -a myaccesskey,mysecret -d baskethead,datomic:

jaret13:03:32

Np! Note that I left in “baskethead” that’s whatever you want to serve the DB as. I copied over from a project where I am in the process of messing with schema and didn’t remove that.

jaret20:03:29

(def cfg {:server-type :peer-server
          :access-key "myaccesskey"
          :secret "mysecret"
          :endpoint "localhost:8998"})
(def client (d/client cfg))
(d/list-databases client {})
(def conn (d/connect client {:db-name "your-db-name"}))

markbastian21:03:34

How might I use datomic’s history to get key-value pairs over time? For example, suppose I have a series of weather measurements that look like this:

{:weather/temp 105.0,
 :time/toa #inst"2018-01-03T00:00:00.000-00:00",
 :db/id 1,
 :weather/location "Eagle, ID"}
What I want is to do two things: 1. Get the current weather at a given location. This is easy enough: (d/pull (d/db conn) '[*] 1) 2. Get a time series of all :time/toa to :weather/temp values. I tried a couple of things:
;;This returns every combination of toa and temp.
(d/q
'[:find ?toa ?temp
:in $ ?e
:where
[?e :time/toa ?toa]
[?e :weather/temp ?temp]]
(d/history (d/db conn)) 1)
;;This returns combinations where the transaction is the same, but doesn't quite do what I want.
(d/q
'[:find ?toa ?temp
:in $ ?e
:where
[?e :time/toa ?toa ?t]
[?e :weather/temp ?temp ?t]]
(d/history (d/db conn)) 1)
Any idea as to the right query? Alternatively, is the right answer to just map over my history and take those pairs?

adammiller22:03:32

I'm building an app that will eventually deploy on Datomic Cloud (or that is the intent). However, my tests I like to spin up in memory db on demand. There are of course slight differences in using the cloud vs. peer api so I was wondering how people typically handle this? I saw Robert's solution in his Clojure bridge code he is building but was wondering what others do in this situation?

Datomic Platonic23:03:21

@adammiller you can use the peer api in production as well, so if you'd like to use the same api for dev and production just still with peer api, that's what we're doing

steveb8n23:03:03

@adammiller I’m building my own version of Roberts solution, based on component. basically the same idea, without dynamic binding

adammiller23:03:03

@clojurians873 you can't use the peer api with datomic cloud though, correct?

adammiller23:03:08

@steveb8n I'd be interested in seeing what you come up with. I think whatever end result that can be achieved would be nice to have a very small open source lib we can pull into new projects to handle this. I'd think it would be a common issue.

👍 8