Skip to content

Commit

Permalink
fix formatting and improve hatch
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-rogers-dbt committed Feb 9, 2025
1 parent c4b6d5b commit f02d97e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
7 changes: 4 additions & 3 deletions dbt-snowflake/hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ docker-dev = [
# pre-install commands here and post-install commands in the matrix can be moved
# to the dependencies section
pre-install-commands = [
"pip install -e ../dbt-adapter",
"pip install -e ../dbt-core/core",
]
"pip install -e ../dbt-adapters",
"pip install -e ../dbt-tests-adapter",
"pip install -e ../../dbt-core/core",
]

[envs.build]
detached = true
Expand Down
7 changes: 5 additions & 2 deletions dbt-snowflake/src/dbt/adapters/snowflake/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@

_SNOWFLAKE_BOOLEAN_VALUES = ["TRUE", "FALSE"]


class SnowflakeManagedIcebergCatalogIntegration(CatalogIntegration):
catalog_type = CatalogIntegrationType.managed
auto_refresh: Optional[str] = None
replace_invalid_characters: Optional[str] = None
replace_invalid_characters: Optional[str] = None

def _handle_adapter_properties(self, adapter_properties: Optional[Dict]) -> None:
if adapter_properties:
Expand All @@ -24,7 +25,9 @@ def _handle_adapter_properties(self, adapter_properties: Optional[Dict]) -> None
self.auto_refresh = auto_refresh
if replace_invalid_characters := adapter_properties.get("replace_invalid_characters"):
if replace_invalid_characters not in _SNOWFLAKE_BOOLEAN_VALUES:
raise DbtValidationError(f"Invalid replace_invalid_characters value: {replace_invalid_characters}")
raise DbtValidationError(
f"Invalid replace_invalid_characters value: {replace_invalid_characters}"
)
self.replace_invalid_characters = replace_invalid_characters

def render_ddl_predicates(self, relation: BaseRelation, config: RelationConfig) -> str:
Expand Down
15 changes: 8 additions & 7 deletions dbt-snowflake/tests/unit/test_managed_iceberg_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ def test_managed_iceberg_catalog_with_invalid_properties():
with pytest.raises(DbtValidationError):
SnowflakeManagedIcebergCatalogIntegration(
CatalogIntegrationConfig(
catalog_name="my_catalog",
integration_name="my_integration",
table_format="iceberg",
catalog_type="managed",
external_volume="s3_iceberg_snow",
namespace="my_namespace",
adapter_properties={"auto_refresh": "INVALID"})
catalog_name="my_catalog",
integration_name="my_integration",
table_format="iceberg",
catalog_type="managed",
external_volume="s3_iceberg_snow",
namespace="my_namespace",
adapter_properties={"auto_refresh": "INVALID"},
)
)

0 comments on commit f02d97e

Please sign in to comment.