<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Datomic Knowledgebase - Questions without answers in Client API</title>
<link>https://ask.datomic.com/index.php/unanswered/client-api</link>
<description>Powered by Question2Answer</description>
<item>
<title>java.lang.IllegalArgumentException: Cannot resolve key: 24a96e20-f526-4f7f-ba38-4f684caa5607</title>
<link>https://ask.datomic.com/index.php/720/illegalargumentexception-resolve-24a96e20-4f684caa5607</link>
<description>&lt;p&gt;I am trying to implement resursive rule (loglcal OR) by following this video - Lucas Cavalcanti &amp;amp; Edward Wible - Exploring four hidden superpowers of Datomic&lt;/p&gt;
&lt;p&gt;Here the code&lt;/p&gt;
&lt;p&gt;(defn owns? [cid pid db]&lt;br&gt;
  (d/q &#039;{:find [?pur]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;     :in [$ ?cus-id ?pur %]
     :where
     [(owns? ?cus-id ?pur)]}
db cid [:purchase/id pid] owner-rules))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(comment&lt;br&gt;
  (owns?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#uuid &quot;0fb7ea94-44af-46fa-98ca-0ddb5eb23123&quot;
#uuid &quot;24a96e20-f526-4f7f-ba38-4f684caa5607&quot;
(d/db bank-conn)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;While running the above example I am getting this error: &lt;br&gt;
java.lang.IllegalArgumentException Cannot resolve key: 24a96e20-f526-4f7f-ba38-4f684caa5607&lt;/p&gt;
&lt;p&gt;Here is the full code:&lt;/p&gt;
&lt;p&gt;(def purchase-schema&lt;br&gt;
  [{:db/ident :purchase/id&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:db/doc &quot;The purchase ID&quot;
:db/unique :db.unique/identity
:db/valueType :db.type/uuid
:db/cardinality :db.cardinality/one}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;   {:db/ident :purchase/account&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:db/doc &quot;Purchase Account&quot;
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one}])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(def account-schema&lt;br&gt;
  [{:db/ident :account/id&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:db/doc &quot;The Account ID&quot;
:db/unique :db.unique/identity
:db/valueType :db.type/uuid
:db/cardinality :db.cardinality/one}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;   {:db/ident :account/customer&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:db/doc &quot;Customer who own&#039;s this account&quot;
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one}])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(def customer-schema&lt;br&gt;
  [{:db/ident :customer/id&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:db/doc &quot;Customer ID&quot;
:db/unique :db.unique/identity
:db/valueType :db.type/uuid
:db/cardinality :db.cardinality/one}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;   {:db/ident :customer/name&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:db/doc &quot;Customer name&quot;
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;;;&lt;br&gt;
;; Create client&lt;br&gt;
(def client (d/client {:server-type :dev-local&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;                   :system &quot;dev&quot;}))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;;; Create connections&lt;br&gt;
(def bank-conn    (d/connect client {:db-name &quot;bank&quot;}))&lt;/p&gt;
&lt;p&gt;;; Transact schemas&lt;br&gt;
(comment&lt;br&gt;
  (d/transact  bank-conn {:tx-data purchase-schema})&lt;br&gt;
  (d/transact  bank-conn {:tx-data account-schema})&lt;br&gt;
  (d/transact  bank-conn {:tx-data customer-schema})&lt;br&gt;
  (d/tx-range  bank-conn {:start 6}))&lt;/p&gt;
&lt;p&gt;(comment&lt;br&gt;
  (java.util.UUID/randomUUID))&lt;/p&gt;
&lt;p&gt;;; Transact fake data&lt;br&gt;
(def cid #uuid &quot;0fb7ea94-44af-46fa-98ca-0ddb5eb23123&quot;)&lt;br&gt;
(def sample-customer {:customer/id cid&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;                  :customer/name &quot;Jon Snow&quot;})
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(def aid #uuid &quot;c579a9f6-f6c3-4718-8ecf-c3003021ee9a&quot;)&lt;br&gt;
(def sample-account {:account/id aid&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;                 :account/customer [:customer/id cid]})
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(def pid #uuid &quot;24a96e20-f526-4f7f-ba38-4f684caa5607&quot;)&lt;br&gt;
(def sample-purchase {:purchase/id  pid&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;                  :purchase/account [:account/id aid]})
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(comment&lt;br&gt;
  (d/transact bank-conn {:tx-data [sample-customer]})&lt;br&gt;
  (d/transact bank-conn {:tx-data [sample-account]})&lt;br&gt;
  (d/transact bank-conn {:tx-data [sample-purchase]}))&lt;/p&gt;
&lt;p&gt;(comment&lt;br&gt;
  (d/q &#039;[:find ?cus&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;     :in $ ?cid ?pid
     :where
     [?pur :purchase/id ?pid]
     [?pur :purchase/account ?acc]
     [?acc :account/customer ?cus]
     [?cus :customer/id ?cid]]
  (d/db bank-conn)
  (:customer/id sample-customer)
  (:purchase/id sample-purchase)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;;; owns v1&lt;br&gt;
(defn ownsv1? [cid pid db]&lt;br&gt;
  (d/q &#039;[:find ?cus&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;     :in $ ?customer-id ?purchase-id
     :where
     [?pur :purchase/id ?purchase-id]
     [?pur :purchase/account ?acc]
     [?acc :account/customer ?cus]
     [?cus :customer/id ?customer-id]]
db cid pid))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(comment&lt;br&gt;
  (ownsv1?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(:customer/id sample-customer)
(:purchase/id sample-purchase)
(d/db bank-conn)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;;; recursive rule (logical OR)&lt;br&gt;
(def owner-rules&lt;br&gt;
  &#039;[[(owns? ?cus-id ?e)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; [?e :customer/id ?cus-id]]
[(owns? ?cus-id ?e)
 [?e ?ref-attr ?r]
 (owns? ?cus-id ?r)]])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(defn owns? [cid pid db]&lt;br&gt;
  (d/q &#039;{:find [?pur]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;     :in [$ ?cus-id ?pur %]
     :where
     [(owns? ?cus-id ?pur)]}
db cid [:purchase/id pid] owner-rules))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;;;&lt;br&gt;
(comment&lt;br&gt;
  (owns?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(:customer/id sample-customer)
(:purchase/id sample-purchase)
(d/db bank-conn)))
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Client API</category>
<guid isPermaLink="true">https://ask.datomic.com/index.php/720/illegalargumentexception-resolve-24a96e20-4f684caa5607</guid>
<pubDate>Mon, 06 Jun 2022 19:37:30 +0000</pubDate>
</item>
<item>
<title>client api: clear cache when credentials change</title>
<link>https://ask.datomic.com/index.php/689/client-api-clear-cache-when-credentials-change</link>
<description>&lt;p&gt;I have my development program running and connect to datomic proper. How do I clear the caches because it brakes when I need new aws creds.&lt;/p&gt;
</description>
<category>Client API</category>
<guid isPermaLink="true">https://ask.datomic.com/index.php/689/client-api-clear-cache-when-credentials-change</guid>
<pubDate>Tue, 14 Dec 2021 08:30:00 +0000</pubDate>
</item>
<item>
<title>How to install transaction function using the [com.datomic/client-pro &quot;0.9.63&quot;]</title>
<link>https://ask.datomic.com/index.php/673/how-install-transaction-function-using-the-datomic-client</link>
<description>&lt;p&gt;How to install transaction function using the [com.datomic/client-pro &quot;0.9.63&quot;] ?&lt;br&gt;
I am following this example &lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.datomic.com/on-prem/reference/database-functions.html&quot;&gt;https://docs.datomic.com/on-prem/reference/database-functions.html&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;However there is no d/function to install the transaction function... And looking at the documentation there is only datomic dev local and datomic client pro libraries&lt;/p&gt;
&lt;p&gt;How can I create a transaction function using the client pro lib?&lt;/p&gt;
</description>
<category>Client API</category>
<guid isPermaLink="true">https://ask.datomic.com/index.php/673/how-install-transaction-function-using-the-datomic-client</guid>
<pubDate>Wed, 13 Oct 2021 16:27:12 +0000</pubDate>
</item>
<item>
<title>How to integrate library using datomic.client.api when using the peer library?</title>
<link>https://ask.datomic.com/index.php/663/integrate-library-using-datomic-client-when-using-library</link>
<description>&lt;p&gt;I am using the peer library for on-prem Datomic. Now I want to use a library - ragtime.datomic - that uses the datomic.client.api. How can I do that?&lt;/p&gt;
&lt;p&gt;Based on &lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.datomic.com/client-api/datomic.client.api.html#var-client&quot;&gt;https://docs.datomic.com/client-api/datomic.client.api.html#var-client&lt;/a&gt; it seems the only option is to run a separate peer process, exposed at a port and set up authorization between the two. But it seems wasteful to run a separate server when I already have the peer library. Is there a simpler way?&lt;/p&gt;
</description>
<category>Client API</category>
<guid isPermaLink="true">https://ask.datomic.com/index.php/663/integrate-library-using-datomic-client-when-using-library</guid>
<pubDate>Fri, 03 Sep 2021 17:33:57 +0000</pubDate>
</item>
<item>
<title>Additional keys on anomaly part of the API?</title>
<link>https://ask.datomic.com/index.php/608/additional-keys-on-anomaly-part-of-the-api</link>
<description>&lt;p&gt;Datomic sometimes attaches additional keys onto the anomaly in ex-data on the &lt;code&gt;ExceptionInfo&lt;/code&gt;s thrown. Is this additional data part of the API and able to be depended on? Further, could all keys returned be documented in the &lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.datomic.com/client-api/datomic.client.api.html&quot;&gt;api docs&lt;/a&gt;? The returned keys are typically quite helpful in dispatching on different Datomic error &quot;types.&quot;&lt;/p&gt;
&lt;p&gt;Here&#039;s an example.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def client (d/client {:server-type :dev-local
                       :storage-dir :mem
                       :system      &quot;aa&quot;}))
=&amp;gt; #&#039;compute.http-api.public.task/client
(d/create-database client {:db-name &quot;test&quot;})
=&amp;gt; true
(def conn (d/connect client {:db-name &quot;test&quot;}))
=&amp;gt; #&#039;compute.http-api.public.task/conn
(d/transact conn {:tx-data [{:db/ident       :user/id
                             :db/cardinality :db.cardinality/one
                             :db/valueType   :db.type/string
                             :db/unique      :db.unique/identity}
                            {:db/ident       :user/name
                             :db/cardinality :db.cardinality/one
                             :db/valueType   :db.type/string
                             :db/unique      :db.unique/identity}]})
=&amp;gt;
{:db-before #datomic.core.db.Db{:id &quot;47c8f6f7-26f9-4575-97ec-7fc0948823c1&quot;,
                                :basisT 5,
                                :indexBasisT 0,
                                :index-root-id nil,
                                :asOfT nil,
                                :sinceT nil,
                                :raw nil},
 :db-after #datomic.core.db.Db{:id &quot;47c8f6f7-26f9-4575-97ec-7fc0948823c1&quot;,
                               :basisT 6,
                               :indexBasisT 0,
                               :index-root-id nil,
                               :asOfT nil,
                               :sinceT nil,
                               :raw nil},
 :tx-data [#datom[13194139533318 50 #inst&quot;2021-05-09T01:32:25.677-00:00&quot; 13194139533318 true]
           #datom[73 10 :user/id 13194139533318 true]
           #datom[73 41 35 13194139533318 true]
           #datom[73 40 23 13194139533318 true]
           #datom[73 42 38 13194139533318 true]
           #datom[74 10 :user/name 13194139533318 true]
           #datom[74 41 35 13194139533318 true]
           #datom[74 40 23 13194139533318 true]
           #datom[74 42 38 13194139533318 true]
           #datom[0 13 73 13194139533318 true]
           #datom[0 13 74 13194139533318 true]],
 :tempids {}}
(d/transact conn {:tx-data [{:db/id     [:user/id &quot;a&quot;]
                             :user/name &quot;a&quot;}]})
Execution error (ExceptionInfo) at datomic.core.error/raise (error.clj:55).
:db.error/not-an-entity Unable to resolve entity: [:user/id &quot;a&quot;] in datom [[:user/id &quot;a&quot;] :user/name &quot;a&quot;]
(ex-data *e)
=&amp;gt;
{:cognitect.anomalies/category :cognitect.anomalies/incorrect,
 :cognitect.anomalies/message &quot;Unable to resolve entity: [:user/id \&quot;a\&quot;] in datom [[:user/id \&quot;a\&quot;] :user/name \&quot;a\&quot;]&quot;,
 :entity [:user/id &quot;a&quot;],
 :datom [[:user/id &quot;a&quot;] :user/name &quot;a&quot;],
 :db/error :db.error/not-an-entity}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Client API</category>
<guid isPermaLink="true">https://ask.datomic.com/index.php/608/additional-keys-on-anomaly-part-of-the-api</guid>
<pubDate>Sun, 09 May 2021 01:33:17 +0000</pubDate>
</item>
<item>
<title>Add default :timeout to client api ns docstring</title>
<link>https://ask.datomic.com/index.php/563/add-default-timeout-to-client-api-ns-docstring</link>
<description>&lt;p&gt;It&#039;d be great to have the default value for &lt;code&gt;:timeout&lt;/code&gt; (60000) included in the &lt;code&gt;datomic.client.api&lt;/code&gt; ns docstring. Currently this value can only be found in the &lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.datomic.com/cloud/client/client-api.html#timeouts&quot;&gt;docs on the website&lt;/a&gt;. As of client-cloud 0.8.102, the ns docstring specifies the default value for &lt;code&gt;:limit&lt;/code&gt;. &lt;/p&gt;
</description>
<category>Client API</category>
<guid isPermaLink="true">https://ask.datomic.com/index.php/563/add-default-timeout-to-client-api-ns-docstring</guid>
<pubDate>Thu, 24 Dec 2020 00:12:44 +0000</pubDate>
</item>
<item>
<title>Datomic Client API equivalent to on-prem tx-&gt;t, t-&gt;tx</title>
<link>https://ask.datomic.com/index.php/562/datomic-client-api-equivalent-to-on-prem-tx-t-t-tx</link>
<description>&lt;p&gt;The Datomic client API does not provider &lt;code&gt;tx-&amp;gt;t&lt;/code&gt; or &lt;code&gt;t-&amp;gt;tx&lt;/code&gt;. These functions can be useful for very specific scenarios (e.g., you have a tx id and want to know if the database has &quot;moved forward&quot;). &lt;/p&gt;
&lt;p&gt;This was also requested on &lt;a rel=&quot;nofollow&quot; href=&quot;https://forum.datomic.com/t/datomic-client-api-equivalent-to-on-prem-tx-t/851&quot;&gt;the forums&lt;/a&gt;. A workaround was provided for the user&#039;s specific case but the request is still relevant. &lt;/p&gt;
</description>
<category>Client API</category>
<guid isPermaLink="true">https://ask.datomic.com/index.php/562/datomic-client-api-equivalent-to-on-prem-tx-t-t-tx</guid>
<pubDate>Mon, 21 Dec 2020 00:25:17 +0000</pubDate>
</item>
<item>
<title>Client library for Python</title>
<link>https://ask.datomic.com/index.php/425/client-library-for-python</link>
<description>&lt;p&gt;Provide client implementation in Python&lt;/p&gt;
</description>
<category>Client API</category>
<guid isPermaLink="true">https://ask.datomic.com/index.php/425/client-library-for-python</guid>
<pubDate>Thu, 22 Oct 2020 16:45:51 +0000</pubDate>
</item>
<item>
<title>Client API: tx-report-queue equivalent</title>
<link>https://ask.datomic.com/index.php/424/client-api-tx-report-queue-equivalent</link>
<description>&lt;p&gt;One of the features I miss a lot in the client API is TX report queues. Would it be possible to add something like this to the client? Perhaps tx-range could get an option that, when no :end is given, keeps the channel open and waits for future transactions?&lt;/p&gt;
</description>
<category>Client API</category>
<guid isPermaLink="true">https://ask.datomic.com/index.php/424/client-api-tx-report-queue-equivalent</guid>
<pubDate>Thu, 22 Oct 2020 16:25:01 +0000</pubDate>
</item>
</channel>
</rss>