Skip to content
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

Add utility support wrapping CrateDB's special table options #143

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

amotl
Copy link
Member

@amotl amotl commented Jun 26, 2024

About

@wierdvanderhaar suggested to improve the ctk load table interface such that the target table can be created with CrateDB-specific features like partitioned table, and friends. Thanks.

This patch adds relevant support code, mostly for providing it to downstream libraries and applications. The first candidate is CrateDB Toolkit's I/O subsystem.

References

See also

import dataclasses
import typing as t
from collections import OrderedDict
from urllib.parse import urlparse, parse_qs, parse_qsl

Check notice

Code scanning / CodeQL

Unused import Note

Import of 'parse_qs' is not used.
@seut
Copy link
Member

seut commented Jun 27, 2024

@amotl
Honestly, I do not like this approach as it would force use to maintain table options not only at CrateDB but also at this dialect. I'd really prefer to not add concrete options here. Why not just double quote CrateDB specific (all settings prefixed with crate_ when they get converted into the create table stmt?

@amotl
Copy link
Member Author

amotl commented Jun 27, 2024

Response

Why not just double quote CrateDB specific (all settings prefixed with crate_ when they get converted into the create table stmt?

This is probably about that issue?

This patch's aim is different, and beyond the UX improvements we would like to tackle there.

Idea

It is to have a map for shorthand versions of special table options to be conveyed via URL query parameters, like this:

export CRATEDB_SQLALCHEMY_URL='crate://crate@localhost:4200/testdrive/demo?if-exists=replace&partitioned-by=time&clustered-by="A"&replicas=0-2&shards=2&durability=async&max-columns=42&column-policy=dynamic'

The patch is exploring this area to have a proper metadata knowledge data structure in Python, to be used for different purposes. Currently, it is targeted for the ctk load table interface of CrateDB Toolkit.

It would force use to maintain table options not only at CrateDB but also at this dialect.

I hear you. About the maintenance details, it does not necessarily have to be the source of truth here. In a future iteration, both the documentation and API wrappers would be able to derive the information from CrateDB itself, either its sources, or by inquiring at runtime?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants