Skip to content

fix: handle grant column names case-insensitively - #1650

Open
TangoEnSkai wants to merge 2 commits into
databricks:mainfrom
TangoEnSkai:fix/grant-column-case-782
Open

fix: handle grant column names case-insensitively#1650
TangoEnSkai wants to merge 2 commits into
databricks:mainfrom
TangoEnSkai:fix/grant-column-case-782

Conversation

@TangoEnSkai

Copy link
Copy Markdown

Resolves #782

Description

Databricks SHOW GRANTS results can expose the documented principal, actionType, and objectType columns with different casing depending on the execution environment. The inherited dbt-spark implementation indexes only Principal, ActionType, and ObjectType, which raises a KeyError when a connector returns lowercase names.

Override grant standardization in the Databricks adapter and resolve the three required columns case-insensitively. Grant filtering and grouping behavior is unchanged.

Checklist

  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-databricks next" section.
  • [Optional] I have run the dbt-databricks-pr-ready project skill for this PR and addressed its merge-readiness feedback

Test plan

  • .venv/bin/pytest tests/unit/test_adapter.py::TestDatabricksAdapter::test_standardize_grants_dict_ignores_column_name_case -q (3 passed)
  • .venv/bin/pytest tests/unit/test_adapter.py -q (99 passed, 2 skipped)
  • .venv/bin/pre-commit run --files dbt/adapters/databricks/impl.py tests/unit/test_adapter.py

Signed-off-by: TangoEnSkai <21152231+TangoEnSkai@users.noreply.github.com>
Signed-off-by: TangoEnSkai <21152231+TangoEnSkai@users.noreply.github.com>
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.

[Bug] Crash when dbt runs show grants statement due to column name capitalization mismatch

1 participant