Skip to content

Commit cac1f1d

Browse files
committed
format and lint
1 parent 4f2568d commit cac1f1d

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

dlt/destinations/impl/ducklake/configuration.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class DuckLakeCredentials(DuckDbCredentials):
3333
of the DuckLake.
3434
3535
"""
36+
3637
ducklake_name: str = ":pipeline:"
3738
catalog: Optional[ConnectionStringCredentials] = None
3839
storage: Optional[FilesystemConfiguration] = None
@@ -72,7 +73,7 @@ def build_attach_statement(
7273
def attach_statement(self) -> str:
7374
# TODO handle when `ducklake_name` or `catalog` is not set
7475
if not self.is_resolved():
75-
return None
76+
return None
7677

7778
# return value when set explicitly
7879
if self._attach_statement:

dlt/destinations/impl/ducklake/sql_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def __init__(
1515
capabilities: DestinationCapabilitiesContext,
1616
) -> None:
1717
super().__init__(dataset_name, None, credentials, capabilities)
18+
self.credentials = credentials
1819

1920
# TODO support connecting to a snapshot
2021
@raise_open_connection_error

tests/load/ducklake/test_ducklake_client.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ def test_default_ducklake_configuration() -> None:
8585
)
8686

8787
configuration = resolve_configuration(
88-
DuckLakeClientConfiguration(pipeline_name=pipeline_name)
89-
._bind_dataset_name(dataset_name="FOO")
88+
DuckLakeClientConfiguration(pipeline_name=pipeline_name)._bind_dataset_name(
89+
dataset_name="FOO"
90+
)
9091
)
9192
credentials = configuration.credentials
9293

@@ -96,13 +97,13 @@ def test_default_ducklake_configuration() -> None:
9697
assert credentials.ducklake_name == expected_ducklake_name
9798

9899
assert credentials.database == credentials.catalog.database == str(expected_path)
99-
100+
100101
# currently, we use `drivername="duckdb"` for the ducklake client;
101102
# if we change it to `drivername="ducklake"`, update this check
102103
ducklake_client_url = credentials.to_native_representation()
103104
catalog_url = credentials.catalog.to_native_representation()
104105
assert ducklake_client_url == catalog_url == expected_db_url
105-
106+
106107
assert credentials.storage is None
107108
# value is resolved
108109
assert credentials.attach_statement == expected_attach_statement
@@ -111,10 +112,13 @@ def test_default_ducklake_configuration() -> None:
111112
def test_ducklake_sqlclient(tmp_path):
112113
pipeline_name = "foo"
113114
configuration = resolve_configuration(
114-
DuckLakeClientConfiguration(pipeline_name=pipeline_name)
115-
._bind_dataset_name(dataset_name="test_conf")
115+
DuckLakeClientConfiguration(pipeline_name=pipeline_name)._bind_dataset_name(
116+
dataset_name="test_conf"
117+
)
118+
)
119+
expected_attach_statement = (
120+
f"ATTACH IF NOT EXISTS 'ducklake:{pipeline_name}.ducklake' AS {pipeline_name}"
116121
)
117-
expected_attach_statement = f"ATTACH IF NOT EXISTS 'ducklake:{pipeline_name}.ducklake' AS {pipeline_name}"
118122
assert configuration.credentials.attach_statement == expected_attach_statement
119123

120124
# TODO patch `ducklake` extension directory to unit test extension installation
@@ -146,9 +150,9 @@ def test_ducklake_sqlclient(tmp_path):
146150

147151

148152
def test_destination_defaults() -> None:
149-
"""Check that catalog and storage are materialized at the right
153+
"""Check that catalog and storage are materialized at the right
150154
location and properly derive their name from the pipeline name.
151-
155+
152156
Note that default storage is managed by the ducklake extension itself.
153157
"""
154158
pipeline = dlt.pipeline("destination_defaults", destination="ducklake")
@@ -175,4 +179,4 @@ def test_destination_defaults() -> None:
175179

176180

177181
# def test_assert_configure_storage_location():
178-
# ...
182+
# ...

0 commit comments

Comments
 (0)