Skip to content

Commit 75b165a

Browse files
committed
feat: override set_encrypt and set_key methods to show warnings, not raise exceptions
1 parent 308bee1 commit 75b165a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

connections/builders/text_protocol_connection_string_builder.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import logging
12
from typing import TYPE_CHECKING, TypeVar
23

34
if TYPE_CHECKING:
@@ -7,6 +8,8 @@
78

89
Self = TypeVar("Self", bound="TextProtocolConnectionStringBuilder")
910

11+
logger = logging.getLogger(__name__)
12+
1013

1114
class TextProtocolConnectionStringBuilder(FileProtocolConnectionStringBuilder):
1215
def __init__(self, parent: "ConnectionStringBuilder"):
@@ -19,3 +22,17 @@ def set_pattern(self, pattern: str) -> Self:
1922
def set_indent(self, indent: bool) -> Self:
2023
self._parent.cb.add_option("indent", indent)
2124
return self
25+
26+
def set_encrypt(self, encrypt: bool) -> Self:
27+
logger.warning(
28+
"Warning: 'encrypt' option not available in TextProtocol, continuing without encryption.\n"
29+
"To use encryption, you can choose FileProtocol")
30+
31+
return self
32+
33+
def set_key(self, key: str) -> Self:
34+
logger.warning(
35+
"Warning: 'key' option not available in TextProtocol, continuing without encryption.\n"
36+
"To use encryption, you can choose FileProtocol")
37+
38+
return self

0 commit comments

Comments
 (0)