Support SQLAlchemy row security DDL and reflection - #309
Conversation
|
Hi @Pedrexus . Thanks for this. I have a WIP branch for SQLA 2.1 support here: https://github.com/gordthompson/sqlalchemy-cockroachdb/tree/version_2.1_wip The plan is: Once SQLA 2.1.0 is released we will create a v2.0.x branch and bump the "master" version of this dialect to v2.1.x. We can then incorporate enhancements like this straight into master without disrupting the current v2.0.x version of this dialect. Stay tuned … 😄 |
|
Sure! I will keep this PR as a draft and wait for SQLAlchemy 2.1.0 and the dialect’s transition of master to 2.1. Once that is in place, I will rebase, remove the temporarySQLAlchemy commit pin and general 2.1 packaging changes, and reduce the PR to the CockroachDB-specific compatibility check, focused reflection coverage, and changelog entry. |
Summary
This prepares the dialect for SQLAlchemy 2.1 row security DDL and reflection.
CockroachDB can inherit the PostgreSQL policy compiler and catalog reflection. The only compiler difference is that CockroachDB does not accept PostgreSQL's
CURRENT_ROLEpolicy target, so the dialect raises a compile error before sending unsupported SQL.The focused tests cover that incompatibility and live policy reflection on CockroachDB 26.2.
Dependency
This is a stacked draft while SQLAlchemy issue 13517 waits for maintainer approval. The test requirements temporarily pin the exact public SQLAlchemy feature commit. That pin and the beta floor should be replaced by the first official SQLAlchemy release containing the row security API before this PR is ready to merge.
Verification