xtdb / 2x-playground

Developer Experience experimentation for 2.x
MIT License
6 stars 5 forks source link

Dependency of com.xtdb.labs causes conflict #3

Open MichaelBBTiger opened 7 months ago

MichaelBBTiger commented 7 months ago

When starting the program, the following error will be reported:

clojure.lang.ExceptionInfo: Conflicting data-reader mapping {:url #object[java.net.URL 0x2b4c1d96 "jar:file:/C:/Users/xlawin/.m2/repository/com/xtdb/xtdb-api/2.0.0-SNAPSHOT/xtdb-api-2.0.0-SNAPSHOT.jar!/data_readers.clj"], :conflict xt/runtime-err, :mappings {xt/runtime-err #'xtdb.error/-runtime-err-reader, xt/interval-ym #'xtdb.serde/interval-ym-reader, xt/interval-mdn #'xtdb.serde/interval-mdn-reader, xt.tx/delete #'xtdb.serde/delete-op-reader, xt.tx/sql #'xtdb.serde/sql-op-reader, xt.tx/xtql #'xtdb.serde/xtql-op-reader, xt.tx/erase #'xtdb.serde/erase-op-reader, xt/interval-dt #'xtdb.serde/interval-dt-reader, xt/period-duration #'xtdb.serde/period-duration-reader, xt/tx-key #'xtdb.serde/tx-key-read-fn, xt.tx/put #'xtdb.serde/put-op-reader, xt/illegal-arg #'xtdb.error/-iae-reader, xt.arrow/type #'xtdb.types/->arrow-type, xt.tx/call #'xtdb.serde/call-op-reader, xt/clj-form #'xtdb.api/->ClojureForm}}

I found that when the dependency is replaced with the com.xtdb/xtdb-api library (like https://github.com/xtdb/sakila-playground), it works fine.

;; for testing only - run XTDB as a server for production(!) ;; com.xtdb.labs/xtdb-core {:mvn/version "2.0.0-SNAPSHOT"} ;; com.xtdb.labs/xtdb-http-server {:mvn/version "2.0.0-SNAPSHOT"} ;; com.xtdb.labs/xtdb-pgwire-server {:mvn/version "2.0.0-SNAPSHOT"}

;; XTDB API and http client ;; com.xtdb.labs/xtdb-api {:mvn/version "2.0.0-SNAPSHOT"} ;; com.xtdb.labs/xtdb-http-client-clj {:mvn/version "2.0.0-SNAPSHOT"}

;; works fine com.xtdb/xtdb-api {:mvn/version "2.0.0-SNAPSHOT"} com.xtdb/xtdb-core {:mvn/version "2.0.0-SNAPSHOT"} com.xtdb/xtdb-http-server {:mvn/version "2.0.0-SNAPSHOT"}

refset commented 7 months ago

Hi @MichaelBBTiger thanks for the report, and for persevering to find the fix! I can confirm that the com.xtdb.labs namespace is now considered deprecated (at least as far as the core of v2 is concerned) - apologies for the confusion - we'll tidy up the examples in due course :slightly_smiling_face:

justone commented 7 months ago

I hit this as well, thank you for showing a fix.

I also had to change the submit-tx code to this, and then the rest of the Clojure/Clerk code worked well:

(xt/submit-tx my-node (concat
                       (for [doc my-persons]
                         [:put-docs :persons doc])
                       (for [doc my-movies]
                         [:put-docs :movies doc])))