diff --git a/dbt/adapters/databricks/column.py b/dbt/adapters/databricks/column.py index c00b771a..df2cdb2d 100644 --- a/dbt/adapters/databricks/column.py +++ b/dbt/adapters/databricks/column.py @@ -38,7 +38,7 @@ def get_name(column: dict[str, Any]) -> str: @staticmethod def format_remove_column_list(columns: list["DatabricksColumn"]) -> str: return ", ".join([quote(c.name) for c in columns]) - + @staticmethod def format_add_column_list(columns: list["DatabricksColumn"]) -> str: - return ", ".join([f"{quote(c.name)} {c.data_type}" for c in columns]) \ No newline at end of file + return ", ".join([f"{quote(c.name)} {c.data_type}" for c in columns]) diff --git a/pyproject.toml b/pyproject.toml index f1f680ea..cce1a700 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,6 +76,7 @@ dependencies = [ "freezegun", "mypy", "pre-commit", + "ruff", "types-requests", "debugpy", ] diff --git a/tests/unit/macros/relations/test_constraint_macros.py b/tests/unit/macros/relations/test_constraint_macros.py index 0fc3437a..feac1797 100644 --- a/tests/unit/macros/relations/test_constraint_macros.py +++ b/tests/unit/macros/relations/test_constraint_macros.py @@ -1,7 +1,8 @@ from unittest.mock import Mock -from dbt.adapters.databricks.column import DatabricksColumn + import pytest +from dbt.adapters.databricks.column import DatabricksColumn from tests.unit.macros.base import MacroTestBase diff --git a/tests/unit/test_column.py b/tests/unit/test_column.py index f8bbfa6b..f0aa6562 100644 --- a/tests/unit/test_column.py +++ b/tests/unit/test_column.py @@ -27,6 +27,7 @@ def test_convert_table_stats_with_bytes_and_rows(self): "stats:rows:value": 12345678, } + class TestColumnStatics: @pytest.mark.parametrize( "column, expected", @@ -55,8 +56,11 @@ def test_format_remove_column_list(self, columns, expected): [ ([], ""), ([DatabricksColumn("foo", "string")], "`foo` string"), - ([DatabricksColumn("foo", "string"), DatabricksColumn("bar", "int")], "`foo` string, `bar` int"), + ( + [DatabricksColumn("foo", "string"), DatabricksColumn("bar", "int")], + "`foo` string, `bar` int", + ), ], ) def test_format_add_column_list(self, columns, expected): - assert DatabricksColumn.format_add_column_list(columns) == expected \ No newline at end of file + assert DatabricksColumn.format_add_column_list(columns) == expected diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index dd74e228..3e692a00 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -66,4 +66,4 @@ def test_remove_ansi(self): assert remove_ansi(test_string) == expected_string def test_quote(self): - assert quote("table") == '`table`' \ No newline at end of file + assert quote("table") == "`table`"