Commit b59e06a
LAV-3235: Support CREATE OR ALTER SEMANTIC VIEW lifecycle (#3600)
* LAV-3235: support in-place CREATE OR ALTER SEMANTIC VIEW
Parse OR ALTER and update the existing semantic view definition in place while
retaining its owner, grants, tags, and object row. Match Cloud's success and
authorization errors, and complete GET_DDL and SYSTEM$GET_TAG readbacks exposed
by the new lifecycle snapshots. Snapshots captured on the Standard account.
Co-authored-by: Sabir Akhadov <sabir.akhadov@localstack.cloud>
## Test matrix
Missing view × create status -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_definition
Existing view × alter status -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_definition
Existing view × repeat -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_definition
TABLES single and multiple × alter -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_definition
FACTS, DIMENSIONS, METRICS × alter/query -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_definition
RELATIONSHIPS × alter/repeat/query -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_definition
AI_SQL_GENERATION, AI_QUESTION_CATEGORIZATION × set/unset -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_definition
COMMENT, MAX_STALENESS × set/unset readback -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_preserves_associations
Nonowner × authorization error -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_preserves_associations
Owner × alter/repeat -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_preserves_associations
Existing SELECT grant × preservation -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_preserves_associations
Existing TAG association × preservation -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_preserves_associations
AI_VERIFIED_QUERIES, advanced relationships/metrics -> uncovered: excluded by LAV-3235
* LAV-3235: preserve inherited ownership and child tags on semantic view alter
Use the active role grant closure for ownership checks, carry child tag lists into replacement definition rows, and match Cloud modifier errors. Capture inherited owner, lower role, child tag, and modifier behavior on the Standard account. Swept semantic view tag clauses across view, table, fact, dimension, and metric inputs; all five now reject consistently. Swept role graph directions with both higher and lower roles.
Co-authored-by: Sabir Akhadov <sabir.akhadov@localstack.cloud>
## Deviations
The added AC expects COPY GRANTS to be rejected with CREATE OR ALTER SEMANTIC VIEW. Standard Cloud accepts it when creating a missing view and when altering the existing view; both successful results are captured and matched, because Cloud snapshots outrank the AC.
## Test matrix
Missing view × create/status -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_definition
Existing view × alter/repeat/GET_DDL -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_definition
TABLES/RELATIONSHIPS/FACTS/DIMENSIONS/METRICS × alter/query -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_definition
AI_SQL_GENERATION/AI_QUESTION_CATEGORIZATION × set/unset -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_definition
COMMENT/MAX_STALENESS × set/unset/readback -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_preserves_associations
Exact owner × alter/repeat -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_preserves_associations
Inherited owner × alter/repeat -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_inherited_owner
Lower role × denial -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_inherited_owner
Unrelated nonowner × denial -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_preserves_associations
SELECT grant/ownership/view tag × preservation -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_preserves_associations
Table/fact/dimension/metric tag × preservation -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_preserves_child_tags
IF NOT EXISTS × syntax error -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_rejects_modifiers
COPY GRANTS × missing/existing success -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_rejects_modifiers
View/table/fact/dimension/metric TAG × error -> tests/queries/ddl/test_semantic_view_create_or_alter.py::test_semantic_view_create_or_alter_rejects_modifiers
AI_VERIFIED_QUERIES/advanced relationships/metrics -> uncovered: excluded by LAV-3235
---------
Co-authored-by: spiral <spiral@localhost>
Co-authored-by: Sabir Akhadov <sabir.akhadov@localstack.cloud>1 parent a2305e6 commit b59e06a
2 files changed
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1922 | 1922 | | |
1923 | 1923 | | |
1924 | 1924 | | |
1925 | | - | |
| 1925 | + | |
1926 | 1926 | | |
1927 | 1927 | | |
1928 | 1928 | | |
1929 | 1929 | | |
1930 | 1930 | | |
1931 | 1931 | | |
| 1932 | + | |
| 1933 | + | |
1932 | 1934 | | |
1933 | 1935 | | |
1934 | 1936 | | |
| |||
1957 | 1959 | | |
1958 | 1960 | | |
1959 | 1961 | | |
1960 | | - | |
| 1962 | + | |
1961 | 1963 | | |
| 1964 | + | |
1962 | 1965 | | |
1963 | 1966 | | |
1964 | 1967 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
700 | 700 | | |
701 | 701 | | |
702 | 702 | | |
703 | | - | |
| 703 | + | |
704 | 704 | | |
705 | | - | |
| 705 | + | |
706 | 706 | | |
707 | 707 | | |
708 | 708 | | |
| |||
5561 | 5561 | | |
5562 | 5562 | | |
5563 | 5563 | | |
5564 | | - | |
| 5564 | + | |
5565 | 5565 | | |
5566 | 5566 | | |
5567 | 5567 | | |
5568 | 5568 | | |
5569 | 5569 | | |
| 5570 | + | |
5570 | 5571 | | |
5571 | 5572 | | |
5572 | 5573 | | |
| |||
5637 | 5638 | | |
5638 | 5639 | | |
5639 | 5640 | | |
| 5641 | + | |
5640 | 5642 | | |
5641 | 5643 | | |
5642 | 5644 | | |
| |||
0 commit comments