This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-07
Channels
- # adventofcode (114)
- # announcements (3)
- # aws (5)
- # babashka (62)
- # beginners (111)
- # calva (4)
- # cider (20)
- # clara (5)
- # clj-kondo (1)
- # cljs-dev (9)
- # clojure (255)
- # clojure-europe (75)
- # clojure-italy (10)
- # clojure-nl (3)
- # clojure-norway (5)
- # clojure-uk (6)
- # clojuredesign-podcast (5)
- # clojurescript (34)
- # community-development (28)
- # conjure (1)
- # cursive (3)
- # data-science (1)
- # datavis (1)
- # datomic (4)
- # figwheel-main (1)
- # fulcro (14)
- # graalvm (1)
- # graphql (8)
- # integrant (4)
- # introduce-yourself (2)
- # jobs (2)
- # juxt (4)
- # kaocha (2)
- # malli (6)
- # membrane-term (53)
- # mount (2)
- # nextjournal (2)
- # off-topic (27)
- # pathom (11)
- # polylith (3)
- # portal (11)
- # reagent (4)
- # reitit (4)
- # remote-jobs (1)
- # reveal (14)
- # shadow-cljs (22)
- # tools-deps (24)
- # vim (6)
- # xtdb (19)
Migration question - what is the easiest way to simulate created at and updated at and can I do it with one query/roundtrip to the db
Hi 🙂 so, something roughly like this you mean https://gist.github.com/refset/8439ceebf3c1f08c614b0c818266a140 ? Or are you asking about translating these times across a migration from another system to XT?
is that something i need to ::xt/put a transaction function for? (I’m fine for simple stuff - we already accept sql triggers for geting updated-at0
great, you just need to have those functions loaded in a namespace somewhere (in the gist I was working in (ns dev)
), see https://docs.xtdb.com/language-reference/datalog-queries/#custom-functions
just a sidenote, idk what part of my brain itches it would scratch to have these be explicitly sci, but its there
aha, well that's definitely possible! Perhaps you can use this other gist (which abuses eval
) for inspiration https://gist.github.com/refset/a7f86c8a3ad34aea5d20eac0b5720a28
> Or are you asking about translating these times across a migration from another system to XT? This would also be part of it, but i think I could derive some of it by saying “this is what i knew about the record at this point of time
like if the state of the table right now is
name: 'bob'
status: 'completed'
created_at: Jan 1st
updated_at: Jan 4th;
and i have a second table
status_from 'started'
status_to 'in progress'
created_at Jan 2nd
updated_at Jan 2nd
then i could represent it by the sequence of records
{:xt/id {:old-table/id 123}
:site/type :old-table
:old-table/status 'started'} <- Valid Jan 1st
{:xt/id {:old-table/id 123}
:site/type :old-table
:old-table/status 'in progress'} <- Valid Jan 2nd
{:xt/id {:old-table/id 123}
:site/type :old-table
:old-table/status 'completed'} <- Valid Jan 3rd
{:xt/id {:old-table/id 123}
:site/type :old-table
:old-table/status 'completed'
:old-table/name 'bob'} <- Valid Jan 4th
since i dont actually know what the name was before the newest record, that info was lost
One of my old roommates works on https://www.fluvio.io/ and, with kinda pretty little knowledge of how xtdb uses kafka, i was wondering if it might make sense to use it instead of kafka for xtdb
Nice, I hadn't seen Fluvio before but it sounds promising! Looks like it supports the two key properties required to implement the tx-log protocol, namely (1) infinite retention and (2) linear ordering via a single-partition The tx-log protocol itself is relatively small, should someone want to give it a go - this is the entire Kafka implementation: https://github.com/xtdb/xtdb/blob/61e6a8eb07a87dcff8e65ad4be97c75346a9c86f/modules/kafka/src/xtdb/kafka.clj#L170-L197