Skip to content

Add ResolveBaseDatabricksFullTableName to DataCatalogue - #37

Merged
Anupma110 merged 2 commits into
mainfrom
feature/resolve-base-table-name
Sep 4, 2026
Merged

Anupma110 merged 2 commits into
mainfrom
feature/resolve-base-table-name

Conversation

@Anupma110

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI lite review requested due to automatic review settings September 4, 2026 06:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new public API method naming and multiple user-facing error messages are inconsistent/misleading and should be corrected before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a DataCatalogue helper to resolve the underlying Unity Catalog external table for a write-shared Databricks view by reading UC information schema metadata and tags, with accompanying unit tests to validate the resolution flow and guard against SQL string interpolation.

Changes:

  • Introduces DataCatalogue.ResolveBaseDatabricksFullTableName() that validates a fully-qualified view name, verifies it is a plain view, reads source_dataset_id, and resolves the corresponding dataset_id-tagged external table.
  • Adds a new test suite covering invalid inputs, missing metadata/tag scenarios, non-external base types, successful resolution, and parameterized SQL usage.
File summaries
File Description
src/dataworkbench/datacatalogue.py Adds the base-table resolution method backed by system.information_schema queries and tag lookups.
tests/test_datacatalogue.py Adds unit tests for base-table resolution behavior and SQL parameterization expectations.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/dataworkbench/datacatalogue.py Outdated
Comment thread src/dataworkbench/datacatalogue.py
Comment thread src/dataworkbench/datacatalogue.py
Comment on lines +241 to +243
raise ValueError(
"the base for this view is not a table. Invalid viewName given as input"
)
Comment thread src/dataworkbench/datacatalogue.py Outdated
Renamed to resolve_base_databricks_full_table_name so the public API matches the
snake_case used by the rest of the module.

The error raised when the base object is not EXTERNAL said "is not a table",
which was misleading for a MANAGED base -- it is a table, just not the one the
method accepts. It now names the real constraint.

The log call takes arguments instead of an f-string, so the message is only
formatted if the level is enabled.

The returned name is backtick quoted per identifier, doubling any embedded
backtick the way BuildNameForSelectClause does on the service side, so the
result can be dropped straight into Spark SQL. The WHERE clauses are unchanged:
they bind through spark.sql(args=...), which hands literals to the JVM rather
than substituting into the query text, so escaping quotes there would corrupt
the lookup instead of protecting it. A test pins that behaviour.
@Anupma110
Anupma110 merged commit 75e84d2 into main Sep 4, 2026
5 checks passed
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.

3 participants