dapper-sqls 0.9.2__py3-none-any.whl → 0.9.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dapper_sqls/config.py +144 -15
- dapper_sqls/parser.py +0 -0
- {dapper_sqls-0.9.2.dist-info → dapper_sqls-0.9.3.dist-info}/METADATA +1 -1
- {dapper_sqls-0.9.2.dist-info → dapper_sqls-0.9.3.dist-info}/RECORD +6 -5
- {dapper_sqls-0.9.2.dist-info → dapper_sqls-0.9.3.dist-info}/WHEEL +0 -0
- {dapper_sqls-0.9.2.dist-info → dapper_sqls-0.9.3.dist-info}/top_level.txt +0 -0
dapper_sqls/config.py
CHANGED
@@ -1,6 +1,137 @@
|
|
1
1
|
# -*- coding: latin -*-
|
2
2
|
from .models import ConnectionStringData
|
3
|
-
import
|
3
|
+
import sys
|
4
|
+
from _typeshed import ReadableBuffer, Unused
|
5
|
+
from types import TracebackType
|
6
|
+
from typing import Any, Final, Literal, final, overload
|
7
|
+
from typing_extensions import Self, TypeAlias
|
8
|
+
|
9
|
+
if sys.platform == "win32":
|
10
|
+
# Though this class has a __name__ of PyHKEY, it's exposed as HKEYType for some reason
|
11
|
+
@final
|
12
|
+
class HKEYType:
|
13
|
+
def __bool__(self) -> bool: ...
|
14
|
+
def __int__(self) -> int: ...
|
15
|
+
def __enter__(self) -> Self: ...
|
16
|
+
def __exit__(
|
17
|
+
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
|
18
|
+
) -> bool | None: ...
|
19
|
+
def Close(self) -> None: ...
|
20
|
+
def Detach(self) -> int: ...
|
21
|
+
def __hash__(self) -> int: ...
|
22
|
+
@property
|
23
|
+
def handle(self) -> int: ...
|
24
|
+
|
25
|
+
_KeyType: TypeAlias = HKEYType | int
|
26
|
+
def CloseKey(hkey: _KeyType, /) -> None: ...
|
27
|
+
def ConnectRegistry(computer_name: str | None, key: _KeyType, /) -> HKEYType: ...
|
28
|
+
def CreateKey(key: _KeyType, sub_key: str | None, /) -> HKEYType: ...
|
29
|
+
def CreateKeyEx(key: _KeyType, sub_key: str | None, reserved: int = 0, access: int = 131078) -> HKEYType: ...
|
30
|
+
def DeleteKey(key: _KeyType, sub_key: str, /) -> None: ...
|
31
|
+
def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = 256, reserved: int = 0) -> None: ...
|
32
|
+
def DeleteValue(key: _KeyType, value: str, /) -> None: ...
|
33
|
+
def EnumKey(key: _KeyType, index: int, /) -> str: ...
|
34
|
+
def EnumValue(key: _KeyType, index: int, /) -> tuple[str, Any, int]: ...
|
35
|
+
def ExpandEnvironmentStrings(string: str, /) -> str: ...
|
36
|
+
def FlushKey(key: _KeyType, /) -> None: ...
|
37
|
+
def LoadKey(key: _KeyType, sub_key: str, file_name: str, /) -> None: ...
|
38
|
+
def OpenKey(key: _KeyType, sub_key: str, reserved: int = 0, access: int = 131097) -> HKEYType: ...
|
39
|
+
def OpenKeyEx(key: _KeyType, sub_key: str, reserved: int = 0, access: int = 131097) -> HKEYType: ...
|
40
|
+
def QueryInfoKey(key: _KeyType, /) -> tuple[int, int, int]: ...
|
41
|
+
def QueryValue(key: _KeyType, sub_key: str | None, /) -> str: ...
|
42
|
+
def QueryValueEx(key: _KeyType, name: str, /) -> tuple[Any, int]: ...
|
43
|
+
def SaveKey(key: _KeyType, file_name: str, /) -> None: ...
|
44
|
+
def SetValue(key: _KeyType, sub_key: str, type: int, value: str, /) -> None: ...
|
45
|
+
@overload # type=REG_DWORD|REG_QWORD
|
46
|
+
def SetValueEx(
|
47
|
+
key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[4, 5], value: int | None, /
|
48
|
+
) -> None: ...
|
49
|
+
@overload # type=REG_SZ|REG_EXPAND_SZ
|
50
|
+
def SetValueEx(
|
51
|
+
key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[1, 2], value: str | None, /
|
52
|
+
) -> None: ...
|
53
|
+
@overload # type=REG_MULTI_SZ
|
54
|
+
def SetValueEx(
|
55
|
+
key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[7], value: list[str] | None, /
|
56
|
+
) -> None: ...
|
57
|
+
@overload # type=REG_BINARY and everything else
|
58
|
+
def SetValueEx(
|
59
|
+
key: _KeyType,
|
60
|
+
value_name: str | None,
|
61
|
+
reserved: Unused,
|
62
|
+
type: Literal[0, 3, 8, 9, 10, 11],
|
63
|
+
value: ReadableBuffer | None,
|
64
|
+
/,
|
65
|
+
) -> None: ...
|
66
|
+
@overload # Unknown or undocumented
|
67
|
+
def SetValueEx(
|
68
|
+
key: _KeyType,
|
69
|
+
value_name: str | None,
|
70
|
+
reserved: Unused,
|
71
|
+
type: int,
|
72
|
+
value: int | str | list[str] | ReadableBuffer | None,
|
73
|
+
/,
|
74
|
+
) -> None: ...
|
75
|
+
def DisableReflectionKey(key: _KeyType, /) -> None: ...
|
76
|
+
def EnableReflectionKey(key: _KeyType, /) -> None: ...
|
77
|
+
def QueryReflectionKey(key: _KeyType, /) -> bool: ...
|
78
|
+
|
79
|
+
HKEY_CLASSES_ROOT: int
|
80
|
+
HKEY_CURRENT_USER: int
|
81
|
+
HKEY_LOCAL_MACHINE: int
|
82
|
+
HKEY_USERS: int
|
83
|
+
HKEY_PERFORMANCE_DATA: int
|
84
|
+
HKEY_CURRENT_CONFIG: int
|
85
|
+
HKEY_DYN_DATA: int
|
86
|
+
|
87
|
+
KEY_ALL_ACCESS: Final = 983103
|
88
|
+
KEY_WRITE: Final = 131078
|
89
|
+
KEY_READ: Final = 131097
|
90
|
+
KEY_EXECUTE: Final = 131097
|
91
|
+
KEY_QUERY_VALUE: Final = 1
|
92
|
+
KEY_SET_VALUE: Final = 2
|
93
|
+
KEY_CREATE_SUB_KEY: Final = 4
|
94
|
+
KEY_ENUMERATE_SUB_KEYS: Final = 8
|
95
|
+
KEY_NOTIFY: Final = 16
|
96
|
+
KEY_CREATE_LINK: Final = 32
|
97
|
+
|
98
|
+
KEY_WOW64_64KEY: Final = 256
|
99
|
+
KEY_WOW64_32KEY: Final = 512
|
100
|
+
|
101
|
+
REG_BINARY: Final = 3
|
102
|
+
REG_DWORD: Final = 4
|
103
|
+
REG_DWORD_LITTLE_ENDIAN: Final = 4
|
104
|
+
REG_DWORD_BIG_ENDIAN: Final = 5
|
105
|
+
REG_EXPAND_SZ: Final = 2
|
106
|
+
REG_LINK: Final = 6
|
107
|
+
REG_MULTI_SZ: Final = 7
|
108
|
+
REG_NONE: Final = 0
|
109
|
+
REG_QWORD: Final = 11
|
110
|
+
REG_QWORD_LITTLE_ENDIAN: Final = 11
|
111
|
+
REG_RESOURCE_LIST: Final = 8
|
112
|
+
REG_FULL_RESOURCE_DESCRIPTOR: Final = 9
|
113
|
+
REG_RESOURCE_REQUIREMENTS_LIST: Final = 10
|
114
|
+
REG_SZ: Final = 1
|
115
|
+
|
116
|
+
REG_CREATED_NEW_KEY: Final = 1 # undocumented
|
117
|
+
REG_LEGAL_CHANGE_FILTER: Final = 268435471 # undocumented
|
118
|
+
REG_LEGAL_OPTION: Final = 31 # undocumented
|
119
|
+
REG_NOTIFY_CHANGE_ATTRIBUTES: Final = 2 # undocumented
|
120
|
+
REG_NOTIFY_CHANGE_LAST_SET: Final = 4 # undocumented
|
121
|
+
REG_NOTIFY_CHANGE_NAME: Final = 1 # undocumented
|
122
|
+
REG_NOTIFY_CHANGE_SECURITY: Final = 8 # undocumented
|
123
|
+
REG_NO_LAZY_FLUSH: Final = 4 # undocumented
|
124
|
+
REG_OPENED_EXISTING_KEY: Final = 2 # undocumented
|
125
|
+
REG_OPTION_BACKUP_RESTORE: Final = 4 # undocumented
|
126
|
+
REG_OPTION_CREATE_LINK: Final = 2 # undocumented
|
127
|
+
REG_OPTION_NON_VOLATILE: Final = 0 # undocumented
|
128
|
+
REG_OPTION_OPEN_LINK: Final = 8 # undocumented
|
129
|
+
REG_OPTION_RESERVED: Final = 0 # undocumented
|
130
|
+
REG_OPTION_VOLATILE: Final = 1 # undocumented
|
131
|
+
REG_REFRESH_HIVE: Final = 2 # undocumented
|
132
|
+
REG_WHOLE_HIVE_VOLATILE: Final = 1 # undocumented
|
133
|
+
|
134
|
+
error = OSError
|
4
135
|
|
5
136
|
class Config(object):
|
6
137
|
def __init__(self, server: str, database: str, username: str, password: str, sql_version: int = None, api_environment=False, default_attempts=1, default_wait_timeout=2):
|
@@ -18,7 +149,7 @@ class Config(object):
|
|
18
149
|
@api_environment.setter
|
19
150
|
def api_environment(self, value):
|
20
151
|
if not isinstance(value, bool):
|
21
|
-
raise ValueError("
|
152
|
+
raise ValueError("The value assigned to api_environment must be of type boolean")
|
22
153
|
self._api_environment = value
|
23
154
|
|
24
155
|
@property
|
@@ -28,7 +159,7 @@ class Config(object):
|
|
28
159
|
@default_attempts.setter
|
29
160
|
def default_attempts(self, value):
|
30
161
|
if not isinstance(value, int):
|
31
|
-
raise ValueError("
|
162
|
+
raise ValueError("The value assigned to default_attempts must be of type integer")
|
32
163
|
self._default_attempts = value
|
33
164
|
|
34
165
|
@property
|
@@ -38,7 +169,7 @@ class Config(object):
|
|
38
169
|
@default_wait_timeout.setter
|
39
170
|
def default_wait_timeout(self, value):
|
40
171
|
if not isinstance(value, int):
|
41
|
-
raise ValueError("
|
172
|
+
raise ValueError("The value assigned to default_wait_timeout must be of type integer")
|
42
173
|
self._default_wait_timeout = value
|
43
174
|
|
44
175
|
@property
|
@@ -48,7 +179,7 @@ class Config(object):
|
|
48
179
|
@connectionStringDataQuery.setter
|
49
180
|
def connectionStringDataQuery(self, value):
|
50
181
|
if not isinstance(value, ConnectionStringData):
|
51
|
-
raise ValueError("
|
182
|
+
raise ValueError("The value assigned to connectionStringDataQuery must be of type ConnectionStringData")
|
52
183
|
self._connectionStringDataQuery = value
|
53
184
|
|
54
185
|
@property
|
@@ -58,7 +189,7 @@ class Config(object):
|
|
58
189
|
@connectionStringDataStored.setter
|
59
190
|
def connectionStringDataStored(self, value):
|
60
191
|
if not isinstance(value, ConnectionStringData):
|
61
|
-
raise ValueError("
|
192
|
+
raise ValueError("The value assigned to connectionStringDataStored must be of type ConnectionStringData")
|
62
193
|
self._connectionStringDataStored = value
|
63
194
|
|
64
195
|
@property
|
@@ -68,32 +199,30 @@ class Config(object):
|
|
68
199
|
@sql_version.setter
|
69
200
|
def sql_version(self, value):
|
70
201
|
if not isinstance(value, int) and value is not None:
|
71
|
-
raise ValueError("
|
202
|
+
raise ValueError("The value assigned to sql_version must be of type integer or None")
|
72
203
|
self._sql_version = value
|
73
204
|
|
205
|
+
|
74
206
|
@staticmethod
|
75
207
|
def get_all_odbc_driver_versions():
|
76
208
|
driver_versions = []
|
77
209
|
try:
|
78
|
-
# Abrir a chave onde as informa��es sobre os drivers ODBC est�o armazenadas
|
79
210
|
key_path = r"SOFTWARE\ODBC\ODBCINST.INI"
|
80
|
-
key =
|
211
|
+
key = OpenKey(HKEY_LOCAL_MACHINE, key_path)
|
81
212
|
|
82
|
-
# Iterar sobre as subchaves para encontrar os drivers espec�ficos
|
83
213
|
i = 0
|
84
214
|
while True:
|
85
215
|
try:
|
86
|
-
subkey_name =
|
87
|
-
subkey =
|
216
|
+
subkey_name = EnumKey(key, i)
|
217
|
+
subkey = OpenKey(key, subkey_name)
|
88
218
|
|
89
|
-
# Verificar se a subchave cont�m o valor 'Driver'
|
90
219
|
try:
|
91
|
-
driver_name, _ =
|
220
|
+
driver_name, _ = QueryValueEx(subkey, "Driver")
|
92
221
|
if subkey_name.startswith('ODBC Driver'):
|
93
222
|
driver_versions.append(subkey_name)
|
94
223
|
|
95
224
|
except FileNotFoundError:
|
96
|
-
pass
|
225
|
+
pass
|
97
226
|
|
98
227
|
i += 1
|
99
228
|
except OSError:
|
dapper_sqls/parser.py
ADDED
File without changes
|
@@ -1,7 +1,8 @@
|
|
1
1
|
dapper_sqls/__init__.py,sha256=KzUmxAhkQiQIu7Oa1yRtvRhCbsxg29aNa-MszPL6PrY,207
|
2
2
|
dapper_sqls/_types.py,sha256=GM_qDsjKGRSFC0NsU5hkqLKH-ydVKJ-1TgEkxQzi4Hw,181
|
3
|
-
dapper_sqls/config.py,sha256=
|
3
|
+
dapper_sqls/config.py,sha256=PvkX-4Wy7a39I_6d3GPF8CzmaT2DVSq8CIusGQOGyZg,9518
|
4
4
|
dapper_sqls/decorators.py,sha256=5mrabdIv4yZpwmN1XDjAhDXIU8ruoxww6b9X7fmRtE8,2655
|
5
|
+
dapper_sqls/parser.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
6
|
dapper_sqls/utils.py,sha256=vRN-g-xify34YR08OSUF18L58jAjffoc0ixOJY0FcI4,3437
|
6
7
|
dapper_sqls/async_dapper/__init__.py,sha256=lBXRyXMCaiwgcK5TCw5rg-niwFS4GcZVW5Q2enKcS-0,47
|
7
8
|
dapper_sqls/async_dapper/async_dapper.py,sha256=fcJbscwJHCS4_cZJKwfzTJPkEaVBnSc7p8MpPEqD3-0,2462
|
@@ -24,7 +25,7 @@ dapper_sqls/models/result.py,sha256=4yCJmQEy87gPOi6sUdrXD3xtSWAbXeAX_uR2Ou6EYpg,
|
|
24
25
|
dapper_sqls/sqlite/__init__.py,sha256=VifBg1-pubsrYs5jm3ZsgtIqM5JzeNDS2tdInAKvjwM,49
|
25
26
|
dapper_sqls/sqlite/local_database.py,sha256=PpIokP09sfIT8JbwRVi0OxegrubDwOVXvajO4lU1U4g,9873
|
26
27
|
dapper_sqls/sqlite/models.py,sha256=QwV771SexBq5j92Ls9bgcuR1ucDx9ARazj9JkhMTSB0,712
|
27
|
-
dapper_sqls-0.9.
|
28
|
-
dapper_sqls-0.9.
|
29
|
-
dapper_sqls-0.9.
|
30
|
-
dapper_sqls-0.9.
|
28
|
+
dapper_sqls-0.9.3.dist-info/METADATA,sha256=eZIXNvtd0PWI3Z7q52pdZpcokI0i9fR9RcQbbJ8JJ8A,169
|
29
|
+
dapper_sqls-0.9.3.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
30
|
+
dapper_sqls-0.9.3.dist-info/top_level.txt,sha256=Pe1YqCPngnYbSVdhJyDrdFWHFCOqBvFW8WK7kTaIax4,12
|
31
|
+
dapper_sqls-0.9.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|