Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement get_catalog_for_single_relation macro #1064

Merged
merged 29 commits into from
Jun 21, 2024

Conversation

aranke
Copy link
Member

@aranke aranke commented May 28, 2024

Problem

We need to implement the get_catalog_for_single_relation macro and GetCatalogForSingleRelation capability for Snowflake.

Solution

  • Set GetCatalogForSingleRelation capability to Full
  • Implement get_catalog_for_single_relation macro using show objects

Checklist

  • I have read the contributing guide and understand what's expected of me
  • 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
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

@cla-bot cla-bot bot added the cla:yes label May 28, 2024
@aranke
Copy link
Member Author

aranke commented May 28, 2024

Current pre-commit failure:

Check for dbt-core usage in an adapter...................................Failed
- hook id: dbt-core-in-adapters-check
- exit code: 1

A dbt-core module is imported in dbt/adapters/snowflake/impl.py: dbt.artifacts.schemas.catalog.TableMetadata

@jtcohen6
Copy link
Contributor

Nice to see that the dbt-core import check is working as intended!

I think that means TableMetadata, StatsDict, StatsItem will need to move into dbt-adapters &/or dbt-common. That might also enable a better return type for the methods introduced in dbt-labs/dbt-adapters#231

@aranke
Copy link
Member Author

aranke commented May 29, 2024

Tests are currently failing because we haven't merged in dbt-labs/dbt-adapters#231 yet.

@aranke aranke marked this pull request as ready for review May 29, 2024 20:12
@aranke aranke requested a review from a team as a code owner May 29, 2024 20:12
@jtcohen6
Copy link
Contributor

Tests are currently failing because we haven't merged in dbt-labs/dbt-adapters#231 yet.

@aranke You can update this line in dev requirements to run full dbt-snowflake CI with your proposed dbt-adapters changes:

git+https://github.com/dbt-labs/dbt-adapters.git@get_relation_metadata

@aranke aranke changed the title Implement get_relation_metadata macro Implement get_catalog_for_single_relation macro Jun 11, 2024
@aranke aranke marked this pull request as ready for review June 11, 2024 16:38
.changes/unreleased/Fixes-20240516-224134.yaml Outdated Show resolved Hide resolved
.gitignore Show resolved Hide resolved
dbt/include/snowflake/macros/adapters.sql Outdated Show resolved Hide resolved
git+https://github.com/dbt-labs/dbt-adapters.git
git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter
git+https://github.com/dbt-labs/dbt-common.git
git+https://github.com/dbt-labs/dbt-adapters.git@get_relation_metadata
Copy link
Contributor

Choose a reason for hiding this comment

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

Reminder to revert prior to merging.

setup.py Outdated
@@ -57,8 +57,8 @@ def _plugin_version() -> str:
packages=find_namespace_packages(include=["dbt", "dbt.*"]),
include_package_data=True,
install_requires=[
"dbt-common>=1.0.4,<2.0",
"dbt-adapters>=1.1.1,<2.0",
# "dbt-common>=1.2.0,<2.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Reminder to revert prior to merging. Also, we need a new lower bound on dbt-adapters and dbt-common for this new feature.

tests/functional/adapter/test_basic.py Outdated Show resolved Hide resolved
dbt/adapters/snowflake/impl.py Outdated Show resolved Hide resolved
dbt/adapters/snowflake/impl.py Outdated Show resolved Hide resolved
dbt/adapters/snowflake/impl.py Outdated Show resolved Hide resolved
@aranke aranke marked this pull request as ready for review June 18, 2024 17:22
@aranke aranke requested a review from mikealfare June 18, 2024 17:22
Copy link
Contributor

@mikealfare mikealfare left a comment

Choose a reason for hiding this comment

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

I only noticed the MV thing, otherwise it looks good.

dbt/adapters/snowflake/relation_configs/policies.py Outdated Show resolved Hide resolved
dbt/adapters/snowflake/impl.py Outdated Show resolved Hide resolved
@aranke aranke requested a review from mikealfare June 18, 2024 20:13
@aranke aranke disabled auto-merge June 21, 2024 17:45
@aranke aranke changed the title Implement get_catalog_for_single_relation macro Implement get_catalog_for_single_relation macro Jun 21, 2024
@aranke aranke closed this Jun 21, 2024
@aranke aranke reopened this Jun 21, 2024
@colin-rogers-dbt colin-rogers-dbt merged commit d0a259f into main Jun 21, 2024
29 checks passed
@colin-rogers-dbt colin-rogers-dbt deleted the catalog_enable_stats branch June 21, 2024 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants