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

SQLAlchemy: Emulate composite unique constraints #70

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

amotl
Copy link
Member

@amotl amotl commented Nov 1, 2023

About

On the SQLAlchemy support subsystem, improve the UNIQUE constraints polyfill to accept multiple column names, for emulating unique composite keys.

References

@amotl amotl requested review from seut, matriv and andnig November 1, 2023 17:04
@amotl amotl marked this pull request as ready for review November 1, 2023 17:04
@matriv
Copy link

matriv commented Nov 2, 2023

Does this issues a select query on every insert/update to check that the uniqueness is respected?

@amotl
Copy link
Member Author

amotl commented Nov 2, 2023

Does this issues a select query on every insert/update to check that the uniqueness is respected?

There is no other chance to do it differently, right?

@matriv
Copy link

matriv commented Nov 2, 2023

Does this issues a select query on every insert/update to check that the uniqueness is respected?

There is no other chance to do it differently, right?

No, but I'm wondering if we should document it as it will impact performance.

@amotl
Copy link
Member Author

amotl commented Nov 2, 2023

I'm wondering if we should document it as it will impact performance.

It is just a polyfill for making a few humble applications "compatible". We don't actively advertise this as a feature, it is just code sitting in a repository to be reused where applicable.

Improve UNIQUE constraints polyfill to accept multiple column names, for
emulating unique composite keys.
@amotl amotl force-pushed the amo/sqlalchemy-unique-composite branch from 1d4167b to 844f1fb Compare November 2, 2023 11:19
Copy link

codecov bot commented Nov 2, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
cratedb_toolkit/sqlalchemy/polyfill.py 100.00% <100.00%> (ø)

📢 Thoughts on this report? Let us know!.

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