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

Add Functional Tests #810

Draft
wants to merge 4 commits into
base: 02-05-add_snowflake_implementation_of_catalog_support
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dbt-snowflake/hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pre-install-commands = [
]
dependencies = [
"dbt-common @ git+https://github.com/dbt-labs/dbt-common.git",
"dbt-core @ git+https://github.com/dbt-labs/dbt-core.git#subdirectory=core",
"dbt-core @ git+https://github.com/dbt-labs/dbt-core.git@catalogs-parsing#subdirectory=core",
"ddtrace==2.3.0",
"ipdb~=0.13.13",
"pre-commit~=3.7.0",
Expand Down Expand Up @@ -45,6 +45,8 @@ docker-dev = [
pre-install-commands = [
"pip install -e ../dbt-adapters",
"pip install -e ../dbt-tests-adapter",
]
post-install-commands = [
"pip install -e ../../dbt-core/core",
]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest
from dbt.tests.util import run_dbt, write_config_file
from dbt.tests.adapter.catalog_integrations.test_catalog_integration import BaseCatalogIntegration


class TestManagedIcebergCatalogIntegration(BaseCatalogIntegration):

@pytest.fixture(scope="class", autouse=True)
def write_catalog_integration(self, project):
return {
"name": "write_integration_name",
"external_volume": "s3_iceberg_snow",
"table_format": "iceberg",
"catalog_type": "managed",
}

@pytest.fixture(scope="class")
def project_config_update(self):
return {"flags": {"enable_iceberg_materializations": True}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import pytest
from typing import Dict
from dbt.tests.util import run_dbt, write_config_file

CATALOG_NAME = "test_catalog"
BASIC_CATALOG_INTEGRATION_TABLE_MODEL = """
{{
config(
materialized = "table",
catalog_name = "test_catalog",
)
}}
select 1 as id
"""


class BaseCatalogIntegration:
@pytest.fixture(scope="class", autouse=True)
def models(self):
return {
"basic_table_model.sql": BASIC_CATALOG_INTEGRATION_TABLE_MODEL,
}

@pytest.fixture(scope="class")
def write_catalog_integration(self) -> Dict:
return {}

@pytest.fixture(scope="class", autouse=True)
def catalogs(self, write_catalog_integration, project):
catalogs = {
"catalogs": [
{
"name": CATALOG_NAME,
"write_integrations": [write_catalog_integration],
}
]
}
write_config_file(catalogs, project.project_root, "catalogs.yml")
return catalogs

def test_catalog_integration(self, project, catalogs):
run_dbt(["run"])
Loading