Skip to content

Support SQLAlchemy row security DDL and reflection - #309

Draft
Pedrexus wants to merge 2 commits into
cockroachdb:masterfrom
Pedrexus:row-security-reflection
Draft

Support SQLAlchemy row security DDL and reflection#309
Pedrexus wants to merge 2 commits into
cockroachdb:masterfrom
Pedrexus:row-security-reflection

Conversation

@Pedrexus

Copy link
Copy Markdown

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_ROLE policy 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

  • Python 3.10 tox environment
  • CockroachDB 26.2 single node
  • Two focused row security tests passed
  • Repository lint tox environment passed

@gordthompson

Copy link
Copy Markdown
Collaborator

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 … 😄

@Pedrexus

Copy link
Copy Markdown
Author

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.

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