datomic

Ask questions on the official Q&A site at https://ask.datomic.com!
Oliver George 2021-04-02T06:08:29.153100Z

I'm researching how Datomic cloud functionality fits with a user extending or constraining the schema. Simple things like adding attributes is fine. Attribute and entity predicates sound useful. Question about entity predicates... it seems they are designed to reference predicates implemented as code and deployed. Are there ways the predicate could be defined or configured without redeploying (e.g. transacting an s-expr to use as a predicate)?

Oliver George 2021-04-02T08:48:44.155200Z

Pretty sure the answer is no for sensible reasons. One workaround might be some generic predicates configured by data accessible via the db arg.

Joe Lane 2021-04-02T14:21:28.163Z

Hi @olivergeorge, I think what you're asking for is "How can I supply an arbitrary predicate in a transaction along side the data it should operate upon" Correct?

Oliver George 2021-04-02T20:47:17.168700Z

Sounds like an interesting approach

Oliver George 2021-04-02T08:48:44.155200Z

Pretty sure the answer is no for sensible reasons. One workaround might be some generic predicates configured by data accessible via the db arg.

enn 2021-04-02T13:37:50.159200Z

Good morning. Can someone confirm that I’m correctly understanding the following quality of composite tuple attrs? Let’s say I have a composite tuple attr :thing/foo+bar of two attrs :thing/foo and :thing/bar. Once this attr exists, I can never create a new attr :thing/foo, even if I first rename the existing :thing/foo to something else beforehand, because the original :thing/foo participates in the composite tuple attr under its original name. In practice this seems to be the case--I get a :db.error/cannot-retarget-ident. I’m wondering if there is any workaround here.

enn 2021-04-02T13:42:19.161700Z

For example, maybe I could: 1. rename :thing/foo to :thing/foo-old 2. update the :db/tupleAttrs of :thing/foo+bar from [:thing/foo :thing/bar] to [:thing/foo-old :thing/bar] (is this possible?) 3. add new attr :thing/foo 4. update the :db/tupleAttrs of :thing/foo+bar back to [:thing/foo :thing/bar] But I can’t tell from the documentation if it’s even possible to change the :db/tupleAttrs on an existing attribute.

prnc 2021-04-02T14:02:27.162900Z

Hello 👋 Assuming that I have quite a bit of urls i.e. :db.type/uri in Datomic and want to be able to query them, say by host. Is this OK (1) (idiomatic, performance etc.) or should I be “unpacking urls” into attributes (2)?

;; e.g. (1) "query the object"
  '[,,,
    :where
    [(.getHost ?url) ?h]
    [(= "<http://en.wikipedia.org|en.wikipedia.org>" ?h)]]

  ;; OR e.g. (2) "store expanded", and query `:uri/host`
  {:uri/host "<http://en.wikipedia.org|en.wikipedia.org>",
   :uri/path "/wiki/Safari_(web_browser)",
   :uri/full-uri
   #object[com.cognitect.transit.impl.URIImpl 0x58ec6b0c "<https://en.wikipedia.org/wiki/Safari_(web_browser)>"]}
  

Joe Lane 2021-04-02T14:21:28.163Z

Hi @olivergeorge, I think what you're asking for is "How can I supply an arbitrary predicate in a transaction along side the data it should operate upon" Correct?

prnc 2021-04-02T15:23:02.163500Z

Thanks Joe! It’s a new project so I’m just getting a sense of what’s needed, experimenting w/ cloud/solo topology atm—to learn how things work. Just wanted to get a sense if both approaches are valid and get a better grasp of trade-offs, which you kindly provided 😉 So, thanks again!

Joe Lane 2021-04-02T15:25:30.163700Z

Glad to help, always happy to talk about this kind of stuff!

shields 2021-04-02T17:05:49.164400Z

Hello, I have a question about using Datomic Cloud along with https://docs.aws.amazon.com/msk/latest/developerguide/what-is-msk.html. I've https://docs.aws.amazon.com/msk/latest/developerguide/create-cluster.html the Kafka clusters in my Datomic VPC and added them to the subnets. I understand that the bastion just gives access to the Client API if I'm not mistaken. Is there a way to dev locally w/ the created "bootstrap.servers" in MSK? Any additional steps? Or is it not possible? Apologies if I'm missing anything obvious, but any suggestions would be helpful. Thanks.

kenny 2021-04-02T18:20:51.166100Z

Under "https://docs.datomic.com/cloud/releases.html#current" there is this bullet point: > Ion libraries (`ion` and `ion-dev`) are available on the https://docs.datomic.com/cloud/ions/ions-reference.html#libraries. The link https://docs.datomic.com/cloud/ions/ions-reference.html#libraries seems to take you to the wrong stop (just the top of the "Ions Reference" page). That doesn't seem like the desired location.

csm 2021-04-02T19:29:30.168100Z

AIUI MSK is only accessible within your VPC, so to connect from your local you either need your own bastion or a VPN connection

Oliver George 2021-04-02T20:47:17.168700Z

Sounds like an interesting approach