feat: batch per-column PII tag ALTERs into multi-action statements#33
Merged
Conversation
Collapse per-column ALTER TABLE ... MODIFY COLUMN ... SET/UNSET TAG into single multi-action ALTER TABLE statements (SET and UNSET kept separate), no-op on empty, chunked at 100 actions/statement to stay under Snowflake's statement-size limit. Cuts cloud-services cost from dozens of statements per table to a handful. Old _set_column_tag/_unset_column_tag retained as single-element shims for backward compatibility.
…umns; UNSET one stmt per column)
Collaborator
Author
|
Resolved the batched-ALTER grammar open item — all forms now live-validated against Snowflake (8/8 checks pass). Final grammar (asymmetric, per Snowflake):
The earlier multi-column-UNSET emission (which Snowflake rejected) is fixed: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Collapses per-column
ALTER TABLE ... MODIFY COLUMN ... SET/UNSET TAGinto single multi-actionALTER TABLEstatements during PII tag sync.SETandUNSETare kept as separate statements, no-op on empty, and chunked at 100 actions/statement to stay under Snowflake's statement-size limit.Why
Wide tables previously emitted dozens of individual
ALTERstatements per sync — one per column tag change. Batching cuts that to a handful, reducing cloud-services cost by roughly 20-40x on wide tables.Compatibility
The old
_set_column_tag/_unset_column_tagare retained as single-element shims, so existing callers keep working unchanged.Tests
60 tests pass (
uv run pytest),ruff checkclean.The multi-column
ALTER TABLE ... MODIFY COLUMN ...batched syntax was validated only against mocked cursors — the agent's Snowflake MCP access is read-only, so no live execution was possible. A reviewer or the author must smoke-test the generated multi-action ALTER against a scratch table in a writable dev schema before merging to confirm Snowflake accepts the batched statement shape.