Skip to content

fix: properly load dbt relation type for get_relation() and related functions#5144

Merged
newtonapple merged 2 commits intomainfrom
ddai/issue-1987
Aug 14, 2025
Merged

fix: properly load dbt relation type for get_relation() and related functions#5144
newtonapple merged 2 commits intomainfrom
ddai/issue-1987

Conversation

@newtonapple
Copy link
Contributor

fixes #1987

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the proper loading of dbt relation types for get_relation() and related functions by ensuring that relation type information (table vs view) is correctly populated when retrieving data objects.

  • Refactored _data_object_to_relation() method to centralize relation creation logic
  • Updated load_relation() to use data object information when available for proper type detection
  • Enhanced test coverage to verify relation type detection for both tables and views

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sqlmesh/dbt/adapter.py Refactored relation creation logic and updated load_relation() to properly detect relation types
tests/dbt/test_adapter.py Added test coverage for relation type detection and updated existing test expectations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@newtonapple newtonapple force-pushed the ddai/issue-1987 branch 3 times, most recently from 6551469 to 4696ebe Compare August 14, 2025 06:36
@newtonapple newtonapple marked this pull request as ready for review August 14, 2025 21:59
@newtonapple newtonapple merged commit cce46b5 into main Aug 14, 2025
27 of 28 checks passed
@newtonapple newtonapple deleted the ddai/issue-1987 branch August 14, 2025 23:09
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.

Set the correct dbt Relation type

3 participants