|
26 | 26 | Union, |
27 | 27 | overload, |
28 | 28 | ) |
29 | | -from urllib.parse import quote |
30 | 29 |
|
31 | 30 | from strong_typing.inspection import DataclassInstance, is_dataclass_type, is_type_enum |
32 | 31 | from strong_typing.name import python_type_to_str |
33 | 32 |
|
34 | | -from .connection import ConnectionSSLMode |
| 33 | +from .connection import ConnectionParameters |
35 | 34 | from .formation.inspection import get_entity_types |
36 | 35 | from .formation.mutation import Mutator, MutatorOptions |
37 | 36 | from .formation.object_types import ( |
@@ -531,26 +530,6 @@ def __str__(self) -> str: |
531 | 530 | return f"error executing query:\n{query}" |
532 | 531 |
|
533 | 532 |
|
534 | | -@dataclass |
535 | | -class ConnectionParameters: |
536 | | - "Database connection parameters that would typically be encapsulated in a connection string." |
537 | | - |
538 | | - host: Optional[str] = None |
539 | | - port: Optional[int] = None |
540 | | - username: Optional[str] = None |
541 | | - password: Optional[str] = None |
542 | | - database: Optional[str] = None |
543 | | - ssl: Optional[ConnectionSSLMode] = None |
544 | | - |
545 | | - def __str__(self) -> str: |
546 | | - host = self.host or "localhost" |
547 | | - port = f":{self.port}" if self.port else "" |
548 | | - username = f"{quote(self.username, safe='')}@" if self.username else "" |
549 | | - database = f"/{quote(self.database, safe='')}" if self.database else "" |
550 | | - ssl = f"?ssl={self.ssl}" if self.ssl else "" |
551 | | - return f"{username}{host}{port}{database}{ssl}" |
552 | | - |
553 | | - |
554 | 533 | class BaseConnection(abc.ABC): |
555 | 534 | "An active connection to a database." |
556 | 535 |
|
|
0 commit comments