databend-driver 0.28.1__cp37-abi3-macosx_10_12_x86_64.whl → 0.29.0__cp37-abi3-macosx_10_12_x86_64.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.
@@ -15,3 +15,31 @@
15
15
  # flake8: noqa
16
16
 
17
17
  from ._databend_driver import *
18
+
19
+ # Export for convenience at module level
20
+ __all__ = [
21
+ # Exception classes - PEP 249 compliant
22
+ "Warning",
23
+ "Error",
24
+ "InterfaceError",
25
+ "DatabaseError",
26
+ "DataError",
27
+ "OperationalError",
28
+ "IntegrityError",
29
+ "InternalError",
30
+ "ProgrammingError",
31
+ "NotSupportedError",
32
+ # Client classes
33
+ "AsyncDatabendClient",
34
+ "AsyncDatabendConnection",
35
+ "BlockingDatabendClient",
36
+ "BlockingDatabendConnection",
37
+ "BlockingDatabendCursor",
38
+ # Data types
39
+ "ConnectionInfo",
40
+ "Schema",
41
+ "Field",
42
+ "Row",
43
+ "RowIterator",
44
+ "ServerStats",
45
+ ]
@@ -14,6 +14,18 @@
14
14
 
15
15
  # flake8: noqa
16
16
 
17
+ # Exception classes - PEP 249 compliant
18
+ class Warning(Exception): ...
19
+ class Error(Exception): ...
20
+ class InterfaceError(Error): ...
21
+ class DatabaseError(Error): ...
22
+ class DataError(DatabaseError): ...
23
+ class OperationalError(DatabaseError): ...
24
+ class IntegrityError(DatabaseError): ...
25
+ class InternalError(DatabaseError): ...
26
+ class ProgrammingError(DatabaseError): ...
27
+ class NotSupportedError(DatabaseError): ...
28
+
17
29
  class ServerStats:
18
30
  @property
19
31
  def total_rows(self) -> int: ...
@@ -71,6 +83,9 @@ class RowIterator:
71
83
  class AsyncDatabendConnection:
72
84
  async def info(self) -> ConnectionInfo: ...
73
85
  async def version(self) -> str: ...
86
+ async def close(self) -> None: ...
87
+ def last_query_id(self) -> str | None: ...
88
+ async def kill_query(self, query_id: str) -> None: ...
74
89
  async def exec(self, sql: str) -> int: ...
75
90
  async def query_row(self, sql: str) -> Row: ...
76
91
  async def query_iter(self, sql: str) -> RowIterator: ...
@@ -86,6 +101,9 @@ class AsyncDatabendClient:
86
101
  class BlockingDatabendConnection:
87
102
  def info(self) -> ConnectionInfo: ...
88
103
  def version(self) -> str: ...
104
+ def close(self) -> None: ...
105
+ def last_query_id(self) -> str | None: ...
106
+ def kill_query(self, query_id: str) -> None: ...
89
107
  def exec(self, sql: str) -> int: ...
90
108
  def query_row(self, sql: str) -> Row: ...
91
109
  def query_iter(self, sql: str) -> RowIterator: ...
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: databend-driver
3
- Version: 0.28.1
3
+ Version: 0.29.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -136,6 +136,26 @@ row = await context.conn.query_row(
136
136
  row = await context.conn.query_row("SELECT ?, ?, ?, ?", params = (3, False, 4, "55"))
137
137
  ```
138
138
 
139
+ ### Query ID tracking and query management
140
+
141
+ ```python
142
+ # Get the last executed query ID
143
+ query_id = conn.last_query_id()
144
+ print(f"Last query ID: {query_id}")
145
+
146
+ # Execute a query and get its ID
147
+ await conn.query_row("SELECT 1")
148
+ query_id = conn.last_query_id()
149
+ print(f"Query ID: {query_id}")
150
+
151
+ # Kill a running query (if needed)
152
+ try:
153
+ await conn.kill_query("some-query-id")
154
+ print("Query killed successfully")
155
+ except Exception as e:
156
+ print(f"Failed to kill query: {e}")
157
+ ```
158
+
139
159
  ## Type Mapping
140
160
 
141
161
  [Databend Types](https://docs.databend.com/sql/sql-reference/data-types/)
@@ -188,6 +208,32 @@ print(value)
188
208
 
189
209
  ## APIs
190
210
 
211
+ ### Exception Classes (PEP 249 Compliant)
212
+
213
+ The driver provides a complete set of exception classes that follow the PEP 249 standard for database interfaces:
214
+
215
+ ```python
216
+ # Base exceptions
217
+ class Warning(Exception): ...
218
+ class Error(Exception): ...
219
+
220
+ # Interface errors
221
+ class InterfaceError(Error): ...
222
+
223
+ # Database errors
224
+ class DatabaseError(Error): ...
225
+
226
+ # Specific database error types
227
+ class DataError(DatabaseError): ...
228
+ class OperationalError(DatabaseError): ...
229
+ class IntegrityError(DatabaseError): ...
230
+ class InternalError(DatabaseError): ...
231
+ class ProgrammingError(DatabaseError): ...
232
+ class NotSupportedError(DatabaseError): ...
233
+ ```
234
+
235
+ These exceptions are automatically mapped from Databend error codes to appropriate PEP 249 exception types based on the nature of the error.
236
+
191
237
  ### AsyncDatabendClient
192
238
 
193
239
  ```python
@@ -203,6 +249,8 @@ class AsyncDatabendConnection:
203
249
  async def info(self) -> ConnectionInfo: ...
204
250
  async def version(self) -> str: ...
205
251
  async def close(self) -> None: ...
252
+ def last_query_id(self) -> str | None: ...
253
+ async def kill_query(self, query_id: str) -> None: ...
206
254
  async def exec(self, sql: str, params: list[string] | tuple[string] | any = None) -> int: ...
207
255
  async def query_row(self, sql: str, params: list[string] | tuple[string] | any = None) -> Row: ...
208
256
  async def query_iter(self, sql: str, params: list[string] | tuple[string] | any = None) -> RowIterator: ...
@@ -226,6 +274,8 @@ class BlockingDatabendConnection:
226
274
  def info(self) -> ConnectionInfo: ...
227
275
  def version(self) -> str: ...
228
276
  def close(self) -> None: ...
277
+ def last_query_id(self) -> str | None: ...
278
+ def kill_query(self, query_id: str) -> None: ...
229
279
  def exec(self, sql: str, params: list[string] | tuple[string] | any = None) -> int: ...
230
280
  def query_row(self, sql: str, params: list[string] | tuple[string] | any = None) -> Row: ...
231
281
  def query_iter(self, sql: str, params: list[string] | tuple[string] | any = None) -> RowIterator: ...
@@ -0,0 +1,6 @@
1
+ databend_driver-0.29.0.dist-info/METADATA,sha256=spT4mbCgPxm42V8AdS6GKsMYxrZA4bjXo9qFESIhYak,10964
2
+ databend_driver-0.29.0.dist-info/WHEEL,sha256=EXWYGIlQOGI1SAWXpNs-tKqcTH553LQS8liEUK4J-U8,104
3
+ databend_driver/__init__.py,sha256=p5VDMqNyirYvuomUSZZk4aRDfw76XNqmnIgvsqiGFKE,1218
4
+ databend_driver/__init__.pyi,sha256=FOf7g35hJzZ6Ugf4op3k-0ZKt1Hq8lufJJElanp7VIk,4665
5
+ databend_driver/_databend_driver.abi3.so,sha256=GxzuBSS7rZPsdJ_ly2aqZ1uL2_c2IG4x11o_BBG_MG0,18032064
6
+ databend_driver-0.29.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.9.3)
2
+ Generator: maturin (1.9.4)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp37-abi3-macosx_10_12_x86_64
@@ -1,6 +0,0 @@
1
- databend_driver-0.28.1.dist-info/METADATA,sha256=YonVSCfKMBcCe5GEMTEyCRzbKAe1brFJZ3DutAtdRlA,9507
2
- databend_driver-0.28.1.dist-info/WHEEL,sha256=aZuW2QT8h7dxnk_E9cUNpI1w3saVkxUgks0fBGyHTZQ,104
3
- databend_driver/__init__.py,sha256=sNam6xQNlyVYUm7qBdX4cDxsxlgHgr3zYavOp8uielw,626
4
- databend_driver/__init__.pyi,sha256=14ys4K9rDVX-eRUcwcpYB9qi8hCoERQNoaAJf1SLg80,3976
5
- databend_driver/_databend_driver.abi3.so,sha256=2w1us4I4RkBAVLPYIAO6e2227yij2NPGX_40q5aUx30,17944432
6
- databend_driver-0.28.1.dist-info/RECORD,,