Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-db committed Dec 2, 2024
1 parent ce169ca commit ebc9dba
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dbt/adapters/databricks/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
return ", ".join([f"{quote(c.name)} {c.data_type}" for c in columns])
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ dependencies = [
"freezegun",
"mypy",
"pre-commit",
"ruff",
"types-requests",
"debugpy",
]
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/macros/relations/test_constraint_macros.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
8 changes: 6 additions & 2 deletions tests/unit/test_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
assert DatabricksColumn.format_add_column_list(columns) == expected
2 changes: 1 addition & 1 deletion tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ def test_remove_ansi(self):
assert remove_ansi(test_string) == expected_string

def test_quote(self):
assert quote("table") == '`table`'
assert quote("table") == "`table`"

0 comments on commit ebc9dba

Please sign in to comment.