Skip to content

Commit

Permalink
adjusts existing derived credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolfix committed Sep 24, 2024
1 parent 02d8974 commit f1defd0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
5 changes: 0 additions & 5 deletions dlt/destinations/impl/duckdb/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@

@configspec(init=False)
class DuckDbBaseCredentials(ConnectionStringCredentials):
password: Optional[TSecretValue] = None
host: Optional[str] = None
port: Optional[int] = None
database: Optional[str] = None

read_only: bool = False # open database read/write

def borrow_conn(self, read_only: bool) -> Any:
Expand Down
2 changes: 2 additions & 0 deletions dlt/destinations/impl/mssql/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
@configspec(init=False)
class MsSqlCredentials(ConnectionStringCredentials):
drivername: Final[str] = dataclasses.field(default="mssql", init=False, repr=False, compare=False) # type: ignore
database: str = None
username: str = None
password: TSecretValue = None
host: str = None
port: int = 1433
Expand Down
2 changes: 2 additions & 0 deletions dlt/destinations/impl/postgres/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
@configspec(init=False)
class PostgresCredentials(ConnectionStringCredentials):
drivername: Final[str] = dataclasses.field(default="postgresql", init=False, repr=False, compare=False) # type: ignore
database: str = None
username: str = None
password: TSecretValue = None
host: str = None
port: int = 5432
Expand Down
2 changes: 1 addition & 1 deletion dlt/destinations/impl/snowflake/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def _decode_private_key(private_key: str, password: Optional[str] = None) -> byt
@configspec(init=False)
class SnowflakeCredentials(ConnectionStringCredentials):
drivername: Final[str] = dataclasses.field(default="snowflake", init=False, repr=False, compare=False) # type: ignore[misc]
password: Optional[TSecretStrValue] = None
host: str = None
database: str = None
username: str = None
warehouse: Optional[str] = None
role: Optional[str] = None
authenticator: Optional[str] = None
Expand Down
12 changes: 9 additions & 3 deletions dlt/destinations/impl/sqlalchemy/configuration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Optional, Any, Final, Type, Dict, Union
from typing import TYPE_CHECKING, ClassVar, List, Optional, Any, Final, Type, Dict, Union
import dataclasses

from dlt.common.configuration import configspec
Expand All @@ -14,8 +14,6 @@ class SqlalchemyCredentials(ConnectionStringCredentials):
if TYPE_CHECKING:
_engine: Optional["Engine"] = None

username: Optional[str] = None # e.g. sqlite doesn't need username

def __init__(
self, connection_string: Optional[Union[str, Dict[str, Any], "Engine"]] = None
) -> None:
Expand Down Expand Up @@ -49,6 +47,14 @@ def get_dialect(self) -> Optional[Type["Dialect"]]:
return type(engine.dialect)
return self.to_url().get_dialect() # type: ignore[attr-defined,no-any-return]

__config_gen_annotations__: ClassVar[List[str]] = [
"database",
"port",
"username",
"password",
"host",
]


@configspec
class SqlalchemyClientConfiguration(DestinationClientDwhConfiguration):
Expand Down

0 comments on commit f1defd0

Please sign in to comment.