This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-23
Channels
- # announcements (6)
- # aws (4)
- # babashka (66)
- # beginners (70)
- # calva (2)
- # cider (62)
- # clara (1)
- # clojars (5)
- # clojure (101)
- # clojure-dev (67)
- # clojure-europe (1)
- # clojure-nl (3)
- # clojure-uk (13)
- # core-async (15)
- # datomic (11)
- # defnpodcast (10)
- # duct (22)
- # emacs (6)
- # events (1)
- # fulcro (34)
- # kaocha (3)
- # off-topic (20)
- # pathom (1)
- # re-frame (8)
- # reagent (14)
- # remote-jobs (1)
- # shadow-cljs (58)
im a bit confused about the relation of ~/.m2/repository/com/datomic/client-cloud/0.8.81/client-cloud-0.8.81.jar
to the /Users/onetom/.m2/repository/com/datomic/client-api/0.8.38/client-api-0.8.38.jar
library.
the later seems to provide the datomic.client.api
namespace, but it's not mentioned in the cloud docs:
https://docs.datomic.com/cloud/client/client-api.html
the on-prem docs only mentions the com.datomic/client-pro
lib.
both of them seem to provide the datomic.client.api
namespace, but if i look into the client-cloud
jar, it only contains code for a datomic.client.impl.cloud
ns.
there is also no documentation for the :cloud
value for the :server-type
key in the client api config data structure, only for the :ion
type:
https://docs.datomic.com/cloud/ions/ions-reference.html#server-type-ion
which library should i include into my project?
i would like to develop locally offline too, so im starting a peer-server and i would connect to it via the com.datomic/client-pro
lib and a {:server-type :peer-server}
config,
but if i would want to connect to the cloud version too with the :ion
server type, what should i do?
ah, i see the same transitive dependency is there in both libraries:
<dependency>
<groupId>com.datomic</groupId>
<artifactId>client</artifactId>
<version>0.8.87</version>
</dependency>
and the datomic.client.api/client
function understands all server-types:
(case (:server-type arg-map)
:ion
(client (assoc arg-map :server-type (impl/ion-server-type)))
(:cloud :peer-server)
(impl/dynacall 'com.datomic/client
'datomic.client.api.sync/client
arg-map)
(:peer-client)
(impl/dynacall '(or com.datomic/datomic-pro com.datomic/datomic-free)
'datomic.peer-client/create-client
arg-map)
:local
(impl/dynacall 'com.datomic/client-impl-local
'datomic.client.impl.local/create-client
arg-map)
(throw (impl/incorrect ":server-type must be one of :cloud, :local, :peer-client, or :peer-server")))
or not?
Execution error (FileNotFoundException) at datomic.client.api.impl/dynaload (impl.clj:15).
Could not locate datomic/client/impl/pro__init.class, datomic/client/impl/pro.clj or datomic/client/impl/pro.cljc on classpath.
also, the https://docs.datomic.com/on-prem/getting-started/connect-to-a-database.html page doesn't mention the need for the :validate-hostnames false
option,
while the https://docs.datomic.com/on-prem/peer-server.html#connecting page does.
I was getting a No name matching localhost found
error otherwise, or when I changed localhost to 127.0.0.1
, it was throwing a No subject alternative names present
error.
@onetom The on-prem client and cloud client libraries are different dependencies but have some shared internals (As you determined)
I’ll fix that missing validate-hostnames
part in the docs, thanks for finding that
You’ll need to use a different dependency in your project to connect to cloud than to connect to peer-server; I don’t think you can have them both active at the same time (CP and name conflicts); but you could use an alias in your deps and have the different config maps available in your code depending on which you’re connecting to
I have some queries that all retrieve a common set of properties from a few entities, but each query adds a few different fields. I'm wondering if it is a good idea to add helpers to write parts of the query, something like this:
(def my-query
{:find
(conj (select-fields-symbols) '?property)
:keys (conj (select-fields-keys) 'property)
:where (conj (select-fields-query '?project)
'[?project :project/d ?d]
'[?project :my-other/property ?property])}
;; =>
'{:find [?a ?b ?c ?d ?property]
:keys [a b c d property]
:where [[?project :project/a ?a]
[?project :project/b ?b]
[?project :project/c ?d]
[?project :project/d ?d]
[?project :my-other/property ?property]]}
Where we always want the fields (a, b, c, d), but depending on the situation also want to add a few additional fields, or join to other entities.
Is there some other way to go about this? Should I just duplicate the fields and not overthink things?
One other strategy I'm considering is to make multiple queries, the first one to get a set of common properties and then another to add on the additional fields I want.