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

Database: Add autoincrement, uniqueness, and sync-writes polyfills #28

Merged
merged 4 commits into from
Jun 24, 2024

Conversation

amotl
Copy link
Member

@amotl amotl commented Jan 16, 2024

About

Add a few polyfills conceived on behalf of the LangChain adapter, and patches to rdflib-sqlalchemy as well as meltano-target-cratedb. By adding them here, they can be used by downstream applications without needing to install cratedb-toolkit.

Documentation

Preview: https://sqlalchemy-cratedb--28.org.readthedocs.build/support.html

@simonprickett: I would also be happy about your review on documentation syntax/grammar/wording, as I am not an English native speaker. Thanks!

References

Backlog

  • Software tests.
  • Documentation.

@amotl amotl force-pushed the amo/polyfill branch 4 times, most recently from 9cc237c to 8158fa6 Compare June 18, 2024 23:01
@amotl amotl force-pushed the amo/polyfill branch 4 times, most recently from 6b65a19 to 600f8ac Compare June 19, 2024 01:33
Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx @amotl !
Nice stuff, left some suggestions on the documentation.

CHANGES.md Outdated Show resolved Hide resolved
docs/support.md Outdated Show resolved Hide resolved
docs/support.md Outdated Show resolved Hide resolved
docs/support.md Outdated Show resolved Hide resolved
docs/support.md Outdated Show resolved Hide resolved
docs/support.md Outdated Show resolved Hide resolved
docs/support.md Outdated Show resolved Hide resolved
docs/support.md Outdated Show resolved Hide resolved
@amotl amotl requested a review from seut June 20, 2024 19:48
Copy link
Contributor

@matriv matriv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx! LGTM, but please wait for one more review.

docs/support.md Outdated Show resolved Hide resolved
docs/index.rst Outdated

The package bundles a few support and utility functions that try to fill a few
gaps you will observe when working with CrateDB, when compared with other
databases. As a distributed OLAP database, it naturally does not include certain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we shouldn't mention as a distributed OLAP, specially combining it with naturally after that, I would simplify and say that CrateDB's behavior and features deviate from those found usually in an RDBMS.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like "Due to its distributed nature, CrateDB's behavior and features differ from those found in other RDBMS systems".

docs/overview.rst Outdated Show resolved Hide resolved
which enable automatically assigning incremental values when inserting records.
However, it offers server-side support by providing an SQL function to generate
random identifiers of ``STRING`` type, and client-side support for generating
``INTEGER``-based identifiers on behalf of the SQLAlchemy dialect.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what "on behalf of" means here - does this mean "when using the SQLAlchemy dialect" or something else? "on behalf of" implies there's some ID generating function that can be plugged into SQLAlchemy. I don't know SQLAlchemy so am not sure what happens here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"when using the SQLAlchemy dialect" is better. Thanks.

docs/support.md Outdated Show resolved Hide resolved
docs/support.md Outdated Show resolved Hide resolved
Copy link
Contributor

@simonprickett simonprickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple of small suggestions.

docs/support.md Outdated Show resolved Hide resolved
@amotl
Copy link
Member Author

amotl commented Jun 24, 2024

@matriv and @simonprickett: Thanks a stack for your excellent reviews. 💯

@amotl amotl merged commit 1549fe6 into main Jun 24, 2024
25 checks passed
@amotl amotl deleted the amo/polyfill branch June 24, 2024 14:27
Comment on lines +111 to +113
full_table_name = f'"{clauseelement.table.name}"'
if clauseelement.table.schema is not None:
full_table_name = f'"{clauseelement.table.schema}".' + full_table_name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd prefer moving this quoting logic into the refresh_tablefunction, by change it's signature to consume an optional schema. This would avoid that it will be called with unquoted or invalid relation names.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should work. Thanks!

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.

4 participants