|
14 | 14 | from ...fs import get_filesystem |
15 | 15 | from ...fs.ext import _dict_to_dataframe, path_to_glob |
16 | 16 | from ...fs.storage_options import (AwsStorageOptions, AzureStorageOptions, |
17 | | - GcsStorageOptions, GitHubStorageOptions, |
18 | | - GitLabStorageOptions, StorageOptions) |
| 17 | + GcsStorageOptions, GitHubStorageOptions, |
| 18 | + GitLabStorageOptions, StorageOptions) |
19 | 19 | from ...utils.misc import convert_large_types_to_standard, to_pyarrow_table |
20 | 20 | from ...utils.polars import pl |
21 | 21 | from ...utils.sql import sql2polars_filter, sql2pyarrow_filter |
@@ -1109,6 +1109,7 @@ def metadata(self): |
1109 | 1109 | self._load() |
1110 | 1110 | return self._metadata |
1111 | 1111 |
|
| 1112 | + |
1112 | 1113 | @attrs.define |
1113 | 1114 | class BaseFileWriter(BaseFileIO): |
1114 | 1115 | """ |
@@ -1216,6 +1217,7 @@ def metadata(self): |
1216 | 1217 | return {} |
1217 | 1218 | return self._metadata |
1218 | 1219 |
|
| 1220 | + |
1219 | 1221 | @attrs.define |
1220 | 1222 | class BaseDatasetWriter(BaseFileWriter): |
1221 | 1223 | """ |
@@ -1400,7 +1402,7 @@ def metadata(self): |
1400 | 1402 | if not hasattr(self, "_metadata"): |
1401 | 1403 | return {} |
1402 | 1404 | return self._metadata |
1403 | | - |
| 1405 | + |
1404 | 1406 |
|
1405 | 1407 | @attrs.define |
1406 | 1408 | class BaseDatabaseIO: |
@@ -1448,23 +1450,23 @@ class BaseDatabaseIO: |
1448 | 1450 | database: str | None = None |
1449 | 1451 | ssl: bool = False |
1450 | 1452 | _metadata: dict[str, Any] = attrs.field(init=False, factory=dict) |
1451 | | - _data: pa.Table | pl.DataFrame | pl.LazyFrame | pd.DataFrame | None = attrs.field(init=False, factory=lambda: None) |
| 1453 | + _data: pa.Table | pl.DataFrame | pl.LazyFrame | pd.DataFrame | None = attrs.field( |
| 1454 | + init=False, factory=lambda: None |
| 1455 | + ) |
1452 | 1456 |
|
1453 | 1457 | def __attrs_post_init__(self): |
1454 | 1458 | db = self.type_.lower() |
1455 | 1459 | if ( |
1456 | 1460 | db in ["postgres", "mysql", "mssql", "oracle"] |
1457 | 1461 | and not self.connection_string |
1458 | 1462 | ): |
1459 | | - if not all( |
1460 | | - [ |
1461 | | - self.username, |
1462 | | - self.password, |
1463 | | - self.server, |
1464 | | - self.port, |
1465 | | - self.database, |
1466 | | - ] |
1467 | | - ): |
| 1463 | + if not all([ |
| 1464 | + self.username, |
| 1465 | + self.password, |
| 1466 | + self.server, |
| 1467 | + self.port, |
| 1468 | + self.database, |
| 1469 | + ]): |
1468 | 1470 | raise ValueError( |
1469 | 1471 | f"{self.type_} requires connection_string or username, password, server, port, and table_name " |
1470 | 1472 | "to build it." |
|
0 commit comments