-
-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dialect: XTDB #521
Comments
See also seancorfield/next.jdbc.xt#5 which is the reverse mapping. |
Heh, there's an understatement 😅 Yeah, table/column name normalisation has caused a fair bit of back-n-forth for us (and indeed, we're also still open to changes in XT). FWIW, our main aims/constraints were:
Aware that this has created quite a needle-threading exercise - would be interested to hear opinions on either the choice of constraints (which ones are more/less important, or any we've missed), or the approach we went with 🙂 |
@jarohen Thanks for the commentary/background. One of the big issues from my specific point of view (HoneySQL, Being confronted with XTDB's SQL dialect where BTW, if you quote (strop) the names in SQL, XTDB accepts See also seancorfield/next-jdbc#269 which is essentially the same issue for the "friendly SQL functions" in |
Thanks Sean, noted 🙏 I don't have any immediate answers/suggestions for this, I'm afraid, will need some consideration. We'll keep this card on our issue board too, keep it fresh in our minds. James |
seancorfield/next.jdbc.xt#6 has additional commentary on a recent change in XTDB in this area but I wanted to highlight it in an open issue here: namely that SQL operations now return names containing |
Round-tripping has been restored in |
Tentative dialect definition: :xtdb {:quote #(strop \" % \")
:col-fn #(if (keyword? %) (subs (str %) 1) (str %))
:parts-fn #(str/split % #"\.")} If seancorfield/next-jdbc#269 goes ahead, HoneySQL should get an XTDB dialect. |
In case it helps/hinders, note that we are planning to soon support unqualified columns in XT2 also, see xtdb/xtdb#2524 |
For now, I'm working on the assumption that For an unqualified name, Note that |
I went ahead and implemented the I'll have to figure out what to do in HoneySQL to "match" that sort of behavior (so I'm still contemplating an XTDB dialect, esp. now you have a bunch of SQL extensions -- see #532 for some of that). Accepting unqualified column names in SQL doesn't really make much difference, since that wasn't where the conflict was. Clojure users of XTDB are still going to assume |
Would it be worth having an
:xtdb
dialect that had:col-fn
to turn/
into$
?What about
:foo/bar.quux-wibble
? (or:foo.bar/quux-wibble
) XTDB's docs suggest that becomesfoo$bar$quux_wibble
but HoneySQL supports namespace-qualifiers as tablenames, and also splits on dots so that would be"foo"."bar"."quux_wibble"
(or"foo.bar"."quux_wibble"
which would be an illegal SQL name) as things stand right now -- how would we tell the difference between something liketable.the$key
andtable$the$key
since the mapping (from/
and.
to$
) is lossy?The text was updated successfully, but these errors were encountered: