psqlpy 0.10.1__cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl → 0.11.1__cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.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.
Potentially problematic release.
This version of psqlpy might be problematic. Click here for more details.
- psqlpy/__init__.py +6 -2
- psqlpy/_internal/__init__.pyi +97 -171
- psqlpy/_internal/exceptions.pyi +72 -13
- psqlpy/_internal.cpython-312-powerpc64le-linux-gnu.so +0 -0
- psqlpy/exceptions.py +20 -2
- {psqlpy-0.10.1.dist-info → psqlpy-0.11.1.dist-info}/METADATA +3 -1
- psqlpy-0.11.1.dist-info/RECORD +15 -0
- {psqlpy-0.10.1.dist-info → psqlpy-0.11.1.dist-info}/WHEEL +1 -1
- psqlpy-0.11.1.dist-info/entry_points.txt +2 -0
- psqlpy-0.10.1.dist-info/RECORD +0 -14
- {psqlpy-0.10.1.dist-info → psqlpy-0.11.1.dist-info}/licenses/LICENSE +0 -0
psqlpy/__init__.py
CHANGED
|
@@ -13,10 +13,13 @@ from psqlpy._internal import (
|
|
|
13
13
|
ReadVariant,
|
|
14
14
|
SingleQueryResult,
|
|
15
15
|
SslMode,
|
|
16
|
-
SynchronousCommit,
|
|
17
16
|
TargetSessionAttrs,
|
|
18
17
|
Transaction,
|
|
19
18
|
connect,
|
|
19
|
+
connect_pool,
|
|
20
|
+
)
|
|
21
|
+
from psqlpy.exceptions import (
|
|
22
|
+
Error,
|
|
20
23
|
)
|
|
21
24
|
|
|
22
25
|
__all__ = [
|
|
@@ -25,6 +28,7 @@ __all__ = [
|
|
|
25
28
|
"ConnectionPool",
|
|
26
29
|
"ConnectionPoolBuilder",
|
|
27
30
|
"Cursor",
|
|
31
|
+
"Error",
|
|
28
32
|
"IsolationLevel",
|
|
29
33
|
"KeepaliveConfig",
|
|
30
34
|
"Listener",
|
|
@@ -34,8 +38,8 @@ __all__ = [
|
|
|
34
38
|
"ReadVariant",
|
|
35
39
|
"SingleQueryResult",
|
|
36
40
|
"SslMode",
|
|
37
|
-
"SynchronousCommit",
|
|
38
41
|
"TargetSessionAttrs",
|
|
39
42
|
"Transaction",
|
|
40
43
|
"connect",
|
|
44
|
+
"connect_pool",
|
|
41
45
|
]
|
psqlpy/_internal/__init__.pyi
CHANGED
|
@@ -150,38 +150,6 @@ class SingleQueryResult:
|
|
|
150
150
|
Type that return passed function.
|
|
151
151
|
"""
|
|
152
152
|
|
|
153
|
-
class SynchronousCommit(Enum):
|
|
154
|
-
"""
|
|
155
|
-
Synchronous_commit option for transactions.
|
|
156
|
-
|
|
157
|
-
### Variants:
|
|
158
|
-
- `On`: The meaning may change based on whether you have
|
|
159
|
-
a synchronous standby or not.
|
|
160
|
-
If there is a synchronous standby,
|
|
161
|
-
setting the value to on will result in waiting till “remote flush”.
|
|
162
|
-
- `Off`: As the name indicates, the commit acknowledgment can come before
|
|
163
|
-
flushing the records to disk.
|
|
164
|
-
This is generally called as an asynchronous commit.
|
|
165
|
-
If the PostgreSQL instance crashes,
|
|
166
|
-
the last few asynchronous commits might be lost.
|
|
167
|
-
- `Local`: WAL records are written and flushed to local disks.
|
|
168
|
-
In this case, the commit will be acknowledged after the
|
|
169
|
-
local WAL Write and WAL flush completes.
|
|
170
|
-
- `RemoteWrite`: WAL records are successfully handed over to
|
|
171
|
-
remote instances which acknowledged back
|
|
172
|
-
about the write (not flush).
|
|
173
|
-
- `RemoteApply`: This will result in commits waiting until replies from the
|
|
174
|
-
current synchronous standby(s) indicate they have received
|
|
175
|
-
the commit record of the transaction and applied it so
|
|
176
|
-
that it has become visible to queries on the standby(s).
|
|
177
|
-
"""
|
|
178
|
-
|
|
179
|
-
On = 1
|
|
180
|
-
Off = 2
|
|
181
|
-
Local = 3
|
|
182
|
-
RemoteWrite = 4
|
|
183
|
-
RemoteApply = 5
|
|
184
|
-
|
|
185
153
|
class IsolationLevel(Enum):
|
|
186
154
|
"""Isolation Level for transactions."""
|
|
187
155
|
|
|
@@ -285,11 +253,12 @@ class KeepaliveConfig:
|
|
|
285
253
|
"""Initialize new config."""
|
|
286
254
|
|
|
287
255
|
class Cursor:
|
|
288
|
-
"""Represent
|
|
256
|
+
"""Represent binary cursor in a transaction.
|
|
289
257
|
|
|
290
258
|
It can be used as an asynchronous iterator.
|
|
291
259
|
"""
|
|
292
260
|
|
|
261
|
+
array_size: int
|
|
293
262
|
cursor_name: str
|
|
294
263
|
querystring: str
|
|
295
264
|
parameters: ParamsT = None
|
|
@@ -314,118 +283,27 @@ class Cursor:
|
|
|
314
283
|
|
|
315
284
|
Execute DECLARE command for the cursor.
|
|
316
285
|
"""
|
|
317
|
-
|
|
286
|
+
def close(self: Self) -> None:
|
|
318
287
|
"""Close the cursor.
|
|
319
288
|
|
|
320
289
|
Execute CLOSE command for the cursor.
|
|
321
290
|
"""
|
|
322
|
-
async def
|
|
323
|
-
self: Self,
|
|
324
|
-
fetch_number: int | None = None,
|
|
325
|
-
) -> QueryResult:
|
|
326
|
-
"""Fetch next <fetch_number> rows.
|
|
327
|
-
|
|
328
|
-
By default fetches 10 next rows.
|
|
329
|
-
|
|
330
|
-
### Parameters:
|
|
331
|
-
- `fetch_number`: how many rows need to fetch.
|
|
332
|
-
|
|
333
|
-
### Returns:
|
|
334
|
-
result as `QueryResult`.
|
|
335
|
-
"""
|
|
336
|
-
async def fetch_next(
|
|
337
|
-
self: Self,
|
|
338
|
-
) -> QueryResult:
|
|
339
|
-
"""Fetch next row.
|
|
340
|
-
|
|
341
|
-
Execute FETCH NEXT
|
|
342
|
-
|
|
343
|
-
### Returns:
|
|
344
|
-
result as `QueryResult`.
|
|
345
|
-
"""
|
|
346
|
-
async def fetch_prior(
|
|
347
|
-
self: Self,
|
|
348
|
-
) -> QueryResult:
|
|
349
|
-
"""Fetch previous row.
|
|
350
|
-
|
|
351
|
-
Execute FETCH PRIOR
|
|
352
|
-
|
|
353
|
-
### Returns:
|
|
354
|
-
result as `QueryResult`.
|
|
355
|
-
"""
|
|
356
|
-
async def fetch_first(
|
|
357
|
-
self: Self,
|
|
358
|
-
) -> QueryResult:
|
|
359
|
-
"""Fetch first row.
|
|
360
|
-
|
|
361
|
-
Execute FETCH FIRST
|
|
362
|
-
|
|
363
|
-
### Returns:
|
|
364
|
-
result as `QueryResult`.
|
|
365
|
-
"""
|
|
366
|
-
async def fetch_last(
|
|
367
|
-
self: Self,
|
|
368
|
-
) -> QueryResult:
|
|
369
|
-
"""Fetch last row.
|
|
370
|
-
|
|
371
|
-
Execute FETCH LAST
|
|
372
|
-
|
|
373
|
-
### Returns:
|
|
374
|
-
result as `QueryResult`.
|
|
375
|
-
"""
|
|
376
|
-
async def fetch_absolute(
|
|
377
|
-
self: Self,
|
|
378
|
-
absolute_number: int,
|
|
379
|
-
) -> QueryResult:
|
|
380
|
-
"""Fetch absolute rows.
|
|
381
|
-
|
|
382
|
-
Execute FETCH ABSOLUTE <absolute_number>.
|
|
383
|
-
|
|
384
|
-
### Returns:
|
|
385
|
-
result as `QueryResult`.
|
|
386
|
-
"""
|
|
387
|
-
async def fetch_relative(
|
|
388
|
-
self: Self,
|
|
389
|
-
relative_number: int,
|
|
390
|
-
) -> QueryResult:
|
|
391
|
-
"""Fetch absolute rows.
|
|
392
|
-
|
|
393
|
-
Execute FETCH RELATIVE <relative_number>.
|
|
394
|
-
|
|
395
|
-
### Returns:
|
|
396
|
-
result as `QueryResult`.
|
|
397
|
-
"""
|
|
398
|
-
async def fetch_forward_all(
|
|
399
|
-
self: Self,
|
|
400
|
-
) -> QueryResult:
|
|
401
|
-
"""Fetch forward all rows.
|
|
402
|
-
|
|
403
|
-
Execute FETCH FORWARD ALL.
|
|
404
|
-
|
|
405
|
-
### Returns:
|
|
406
|
-
result as `QueryResult`.
|
|
407
|
-
"""
|
|
408
|
-
async def fetch_backward(
|
|
409
|
-
self: Self,
|
|
410
|
-
backward_count: int,
|
|
411
|
-
) -> QueryResult:
|
|
412
|
-
"""Fetch backward rows.
|
|
413
|
-
|
|
414
|
-
Execute FETCH BACKWARD <backward_count>.
|
|
415
|
-
|
|
416
|
-
### Returns:
|
|
417
|
-
result as `QueryResult`.
|
|
418
|
-
"""
|
|
419
|
-
async def fetch_backward_all(
|
|
291
|
+
async def execute(
|
|
420
292
|
self: Self,
|
|
293
|
+
querystring: str,
|
|
294
|
+
parameters: ParamsT = None,
|
|
421
295
|
) -> QueryResult:
|
|
422
|
-
"""
|
|
296
|
+
"""Start cursor with querystring and parameters.
|
|
423
297
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
### Returns:
|
|
427
|
-
result as `QueryResult`.
|
|
298
|
+
Method should be used instead of context manager
|
|
299
|
+
and `start` method.
|
|
428
300
|
"""
|
|
301
|
+
async def fetchone(self: Self) -> QueryResult:
|
|
302
|
+
"""Return next one row from the cursor."""
|
|
303
|
+
async def fetchmany(self: Self, size: int | None = None) -> QueryResult:
|
|
304
|
+
"""Return <size> rows from the cursor."""
|
|
305
|
+
async def fetchall(self: Self, size: int | None = None) -> QueryResult:
|
|
306
|
+
"""Return all remaining rows from the cursor."""
|
|
429
307
|
|
|
430
308
|
class Transaction:
|
|
431
309
|
"""Single connection for executing queries.
|
|
@@ -463,6 +341,26 @@ class Transaction:
|
|
|
463
341
|
|
|
464
342
|
`commit()` can be called only once per transaction.
|
|
465
343
|
"""
|
|
344
|
+
async def rollback(self: Self) -> None:
|
|
345
|
+
"""Rollback all queries in the transaction.
|
|
346
|
+
|
|
347
|
+
It can be done only one, after execution transaction marked
|
|
348
|
+
as `done`.
|
|
349
|
+
|
|
350
|
+
### Example:
|
|
351
|
+
```python
|
|
352
|
+
import asyncio
|
|
353
|
+
|
|
354
|
+
from psqlpy import PSQLPool, QueryResult
|
|
355
|
+
|
|
356
|
+
async def main() -> None:
|
|
357
|
+
db_pool = PSQLPool()
|
|
358
|
+
connection = await db_pool.connection()
|
|
359
|
+
transaction = connection.transaction()
|
|
360
|
+
await transaction.execute(...)
|
|
361
|
+
await transaction.rollback()
|
|
362
|
+
```
|
|
363
|
+
"""
|
|
466
364
|
async def execute(
|
|
467
365
|
self: Self,
|
|
468
366
|
querystring: str,
|
|
@@ -744,26 +642,6 @@ class Transaction:
|
|
|
744
642
|
await transaction.rollback_savepoint("my_savepoint")
|
|
745
643
|
```
|
|
746
644
|
"""
|
|
747
|
-
async def rollback(self: Self) -> None:
|
|
748
|
-
"""Rollback all queries in the transaction.
|
|
749
|
-
|
|
750
|
-
It can be done only one, after execution transaction marked
|
|
751
|
-
as `done`.
|
|
752
|
-
|
|
753
|
-
### Example:
|
|
754
|
-
```python
|
|
755
|
-
import asyncio
|
|
756
|
-
|
|
757
|
-
from psqlpy import PSQLPool, QueryResult
|
|
758
|
-
|
|
759
|
-
async def main() -> None:
|
|
760
|
-
db_pool = PSQLPool()
|
|
761
|
-
connection = await db_pool.connection()
|
|
762
|
-
transaction = connection.transaction()
|
|
763
|
-
await transaction.execute(...)
|
|
764
|
-
await transaction.rollback()
|
|
765
|
-
```
|
|
766
|
-
"""
|
|
767
645
|
async def rollback_savepoint(self: Self, savepoint_name: str) -> None:
|
|
768
646
|
"""ROLLBACK to the specified `savepoint_name`.
|
|
769
647
|
|
|
@@ -818,8 +696,6 @@ class Transaction:
|
|
|
818
696
|
querystring: str,
|
|
819
697
|
parameters: ParamsT = None,
|
|
820
698
|
fetch_number: int | None = None,
|
|
821
|
-
scroll: bool | None = None,
|
|
822
|
-
prepared: bool = True,
|
|
823
699
|
) -> Cursor:
|
|
824
700
|
"""Create new cursor object.
|
|
825
701
|
|
|
@@ -829,9 +705,6 @@ class Transaction:
|
|
|
829
705
|
- `querystring`: querystring to execute.
|
|
830
706
|
- `parameters`: list of parameters to pass in the query.
|
|
831
707
|
- `fetch_number`: how many rows need to fetch.
|
|
832
|
-
- `scroll`: SCROLL or NO SCROLL cursor.
|
|
833
|
-
- `prepared`: should the querystring be prepared before the request.
|
|
834
|
-
By default any querystring will be prepared.
|
|
835
708
|
|
|
836
709
|
### Returns:
|
|
837
710
|
new initialized cursor.
|
|
@@ -886,6 +759,34 @@ class Transaction:
|
|
|
886
759
|
number of inserted rows;
|
|
887
760
|
"""
|
|
888
761
|
|
|
762
|
+
async def connect(
|
|
763
|
+
dsn: str | None = None,
|
|
764
|
+
username: str | None = None,
|
|
765
|
+
password: str | None = None,
|
|
766
|
+
host: str | None = None,
|
|
767
|
+
hosts: list[str] | None = None,
|
|
768
|
+
port: int | None = None,
|
|
769
|
+
ports: list[int] | None = None,
|
|
770
|
+
db_name: str | None = None,
|
|
771
|
+
target_session_attrs: TargetSessionAttrs | None = None,
|
|
772
|
+
options: str | None = None,
|
|
773
|
+
application_name: str | None = None,
|
|
774
|
+
connect_timeout_sec: int | None = None,
|
|
775
|
+
connect_timeout_nanosec: int | None = None,
|
|
776
|
+
tcp_user_timeout_sec: int | None = None,
|
|
777
|
+
tcp_user_timeout_nanosec: int | None = None,
|
|
778
|
+
keepalives: bool | None = None,
|
|
779
|
+
keepalives_idle_sec: int | None = None,
|
|
780
|
+
keepalives_idle_nanosec: int | None = None,
|
|
781
|
+
keepalives_interval_sec: int | None = None,
|
|
782
|
+
keepalives_interval_nanosec: int | None = None,
|
|
783
|
+
keepalives_retries: int | None = None,
|
|
784
|
+
load_balance_hosts: LoadBalanceHosts | None = None,
|
|
785
|
+
ssl_mode: SslMode | None = None,
|
|
786
|
+
ca_file: str | None = None,
|
|
787
|
+
) -> Connection:
|
|
788
|
+
"""Create new standalone connection."""
|
|
789
|
+
|
|
889
790
|
class Connection:
|
|
890
791
|
"""Connection from Database Connection Pool.
|
|
891
792
|
|
|
@@ -905,6 +806,25 @@ class Connection:
|
|
|
905
806
|
exception: BaseException | None,
|
|
906
807
|
traceback: types.TracebackType | None,
|
|
907
808
|
) -> None: ...
|
|
809
|
+
async def prepare(
|
|
810
|
+
self,
|
|
811
|
+
querystring: str,
|
|
812
|
+
parameters: ParamsT = None,
|
|
813
|
+
) -> PreparedStatement:
|
|
814
|
+
"""Prepare statement.
|
|
815
|
+
|
|
816
|
+
Return representation of prepared statement.
|
|
817
|
+
"""
|
|
818
|
+
async def commit(self: Self) -> None:
|
|
819
|
+
"""Commit the transaction.
|
|
820
|
+
|
|
821
|
+
Do nothing if there is no active transaction.
|
|
822
|
+
"""
|
|
823
|
+
async def rollback(self: Self) -> None:
|
|
824
|
+
"""Rollback the transaction.
|
|
825
|
+
|
|
826
|
+
Do nothing if there is no active transaction.
|
|
827
|
+
"""
|
|
908
828
|
async def execute(
|
|
909
829
|
self: Self,
|
|
910
830
|
querystring: str,
|
|
@@ -1089,7 +1009,6 @@ class Connection:
|
|
|
1089
1009
|
isolation_level: IsolationLevel | None = None,
|
|
1090
1010
|
read_variant: ReadVariant | None = None,
|
|
1091
1011
|
deferrable: bool | None = None,
|
|
1092
|
-
synchronous_commit: SynchronousCommit | None = None,
|
|
1093
1012
|
) -> Transaction:
|
|
1094
1013
|
"""Create new transaction.
|
|
1095
1014
|
|
|
@@ -1097,15 +1016,12 @@ class Connection:
|
|
|
1097
1016
|
- `isolation_level`: configure isolation level of the transaction.
|
|
1098
1017
|
- `read_variant`: configure read variant of the transaction.
|
|
1099
1018
|
- `deferrable`: configure deferrable of the transaction.
|
|
1100
|
-
- `synchronous_commit`: configure synchronous_commit option for transaction.
|
|
1101
1019
|
"""
|
|
1102
1020
|
def cursor(
|
|
1103
1021
|
self: Self,
|
|
1104
1022
|
querystring: str,
|
|
1105
1023
|
parameters: ParamsT = None,
|
|
1106
1024
|
fetch_number: int | None = None,
|
|
1107
|
-
scroll: bool | None = None,
|
|
1108
|
-
prepared: bool = True,
|
|
1109
1025
|
) -> Cursor:
|
|
1110
1026
|
"""Create new cursor object.
|
|
1111
1027
|
|
|
@@ -1115,9 +1031,6 @@ class Connection:
|
|
|
1115
1031
|
- `querystring`: querystring to execute.
|
|
1116
1032
|
- `parameters`: list of parameters to pass in the query.
|
|
1117
1033
|
- `fetch_number`: how many rows need to fetch.
|
|
1118
|
-
- `scroll`: SCROLL or NO SCROLL cursor.
|
|
1119
|
-
- `prepared`: should the querystring be prepared before the request.
|
|
1120
|
-
By default any querystring will be prepared.
|
|
1121
1034
|
|
|
1122
1035
|
### Returns:
|
|
1123
1036
|
new initialized cursor.
|
|
@@ -1142,12 +1055,13 @@ class Connection:
|
|
|
1142
1055
|
... # do something with this result.
|
|
1143
1056
|
```
|
|
1144
1057
|
"""
|
|
1145
|
-
def
|
|
1058
|
+
def close(self: Self) -> None:
|
|
1146
1059
|
"""Return connection back to the pool.
|
|
1147
1060
|
|
|
1148
1061
|
It necessary to commit all transactions and close all cursor
|
|
1149
1062
|
made by this connection. Otherwise, it won't have any practical usage.
|
|
1150
1063
|
"""
|
|
1064
|
+
|
|
1151
1065
|
async def binary_copy_to_table(
|
|
1152
1066
|
self: Self,
|
|
1153
1067
|
source: bytes | bytearray | Buffer | BytesIO,
|
|
@@ -1336,7 +1250,7 @@ class ConnectionPool:
|
|
|
1336
1250
|
def close(self: Self) -> None:
|
|
1337
1251
|
"""Close the connection pool."""
|
|
1338
1252
|
|
|
1339
|
-
def
|
|
1253
|
+
def connect_pool(
|
|
1340
1254
|
dsn: str | None = None,
|
|
1341
1255
|
username: str | None = None,
|
|
1342
1256
|
password: str | None = None,
|
|
@@ -1857,3 +1771,15 @@ class ListenerNotificationMsg:
|
|
|
1857
1771
|
channel: str
|
|
1858
1772
|
payload: str
|
|
1859
1773
|
connection: Connection
|
|
1774
|
+
|
|
1775
|
+
class Column:
|
|
1776
|
+
name: str
|
|
1777
|
+
table_oid: int | None
|
|
1778
|
+
|
|
1779
|
+
class PreparedStatement:
|
|
1780
|
+
async def execute(self: Self) -> QueryResult:
|
|
1781
|
+
"""Execute prepared statement."""
|
|
1782
|
+
def cursor(self: Self) -> Cursor:
|
|
1783
|
+
"""Create new server-side cursor based on prepared statement."""
|
|
1784
|
+
def columns(self: Self) -> list[Column]:
|
|
1785
|
+
"""Return information about statement columns."""
|
psqlpy/_internal/exceptions.pyi
CHANGED
|
@@ -1,7 +1,68 @@
|
|
|
1
|
-
class
|
|
2
|
-
"""
|
|
1
|
+
class WarningError(Exception):
|
|
2
|
+
"""
|
|
3
|
+
Exception raised for important warnings
|
|
4
|
+
like data truncations while inserting, etc.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
class Error(Exception):
|
|
8
|
+
"""
|
|
9
|
+
Exception that is the base class of all other error exceptions.
|
|
3
10
|
|
|
4
|
-
|
|
11
|
+
You can use this to catch all errors with one single except statement.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
class InterfaceError(Error):
|
|
15
|
+
"""
|
|
16
|
+
Exception raised for errors that are related to the
|
|
17
|
+
database interface rather than the database itself.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
class DatabaseError(Error):
|
|
21
|
+
"""Exception raised for errors that are related to the database."""
|
|
22
|
+
|
|
23
|
+
class DataError(DatabaseError):
|
|
24
|
+
"""
|
|
25
|
+
Exception raised for errors that are due to problems with
|
|
26
|
+
the processed data like division by zero, numeric value out of range, etc.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
class OperationalError(DatabaseError):
|
|
30
|
+
"""
|
|
31
|
+
Exception raised for errors that are related to the database’s operation
|
|
32
|
+
and not necessarily under the control of the programmer,
|
|
33
|
+
e.g. an unexpected disconnect occurs, the data source name is not found,
|
|
34
|
+
a transaction could not be processed, a memory allocation error
|
|
35
|
+
occurred during processing, etc.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
class IntegrityError(DatabaseError):
|
|
39
|
+
"""
|
|
40
|
+
Exception raised when the relational integrity of the
|
|
41
|
+
database is affected, e.g. a foreign key check fails.
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
class InternalError(DatabaseError):
|
|
45
|
+
"""
|
|
46
|
+
Exception raised when the database encounters an internal error,
|
|
47
|
+
e.g. the cursor is not valid anymore, the transaction is out of sync, etc.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
class ProgrammingError(DatabaseError):
|
|
51
|
+
"""
|
|
52
|
+
Exception raised for programming errors, e.g. table not found or
|
|
53
|
+
already exists, syntax error in the SQL statement,
|
|
54
|
+
wrong number of parameters specified, etc.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
class NotSupportedError(DatabaseError):
|
|
58
|
+
"""
|
|
59
|
+
Exception raised in case a method or database API was used which
|
|
60
|
+
is not supported by the database, e.g. requesting a .rollback()
|
|
61
|
+
on a connection that does not support transaction
|
|
62
|
+
or has transactions turned off.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
class BaseConnectionPoolError(InterfaceError):
|
|
5
66
|
"""Base error for all Connection Pool errors."""
|
|
6
67
|
|
|
7
68
|
class ConnectionPoolBuildError(BaseConnectionPoolError):
|
|
@@ -13,7 +74,7 @@ class ConnectionPoolConfigurationError(BaseConnectionPoolError):
|
|
|
13
74
|
class ConnectionPoolExecuteError(BaseConnectionPoolError):
|
|
14
75
|
"""Error in connection pool execution."""
|
|
15
76
|
|
|
16
|
-
class BaseConnectionError(
|
|
77
|
+
class BaseConnectionError(InterfaceError):
|
|
17
78
|
"""Base error for Connection errors."""
|
|
18
79
|
|
|
19
80
|
class ConnectionExecuteError(BaseConnectionError):
|
|
@@ -22,7 +83,7 @@ class ConnectionExecuteError(BaseConnectionError):
|
|
|
22
83
|
class ConnectionClosedError(BaseConnectionError):
|
|
23
84
|
"""Error if underlying connection is already closed."""
|
|
24
85
|
|
|
25
|
-
class BaseTransactionError(
|
|
86
|
+
class BaseTransactionError(InterfaceError):
|
|
26
87
|
"""Base error for all transaction errors."""
|
|
27
88
|
|
|
28
89
|
class TransactionBeginError(BaseTransactionError):
|
|
@@ -43,7 +104,7 @@ class TransactionExecuteError(BaseTransactionError):
|
|
|
43
104
|
class TransactionClosedError(BaseTransactionError):
|
|
44
105
|
"""Error if underlying connection is already closed."""
|
|
45
106
|
|
|
46
|
-
class BaseCursorError(
|
|
107
|
+
class BaseCursorError(InterfaceError):
|
|
47
108
|
"""Base error for Cursor errors."""
|
|
48
109
|
|
|
49
110
|
class CursorStartError(BaseCursorError):
|
|
@@ -58,29 +119,27 @@ class CursorFetchError(BaseCursorError):
|
|
|
58
119
|
class CursorClosedError(BaseCursorError):
|
|
59
120
|
"""Error if underlying connection is already closed."""
|
|
60
121
|
|
|
61
|
-
class UUIDValueConvertError(
|
|
122
|
+
class UUIDValueConvertError(DataError):
|
|
62
123
|
"""Error if it's impossible to convert py string UUID into rust UUID."""
|
|
63
124
|
|
|
64
|
-
class MacAddrConversionError(
|
|
125
|
+
class MacAddrConversionError(DataError):
|
|
65
126
|
"""Error if cannot convert MacAddr string value to rust type."""
|
|
66
127
|
|
|
67
|
-
class RustToPyValueMappingError(
|
|
128
|
+
class RustToPyValueMappingError(DataError):
|
|
68
129
|
"""Error if it is not possible to covert rust type to python.
|
|
69
130
|
|
|
70
131
|
You can get it if you database contains data type that it not
|
|
71
132
|
supported by this library.
|
|
72
|
-
|
|
73
|
-
It's better to handle this exception.
|
|
74
133
|
"""
|
|
75
134
|
|
|
76
|
-
class PyToRustValueMappingError(
|
|
135
|
+
class PyToRustValueMappingError(DataError):
|
|
77
136
|
"""Error if it is not possible to covert python type to rust.
|
|
78
137
|
|
|
79
138
|
You can get this exception when executing queries with parameters.
|
|
80
139
|
So, if there are no parameters for the query, don't handle this error.
|
|
81
140
|
"""
|
|
82
141
|
|
|
83
|
-
class BaseListenerError(
|
|
142
|
+
class BaseListenerError(InterfaceError):
|
|
84
143
|
"""Base error for all Listener errors."""
|
|
85
144
|
|
|
86
145
|
class ListenerStartError(BaseListenerError):
|
|
Binary file
|
psqlpy/exceptions.py
CHANGED
|
@@ -13,12 +13,20 @@ from ._internal.exceptions import (
|
|
|
13
13
|
CursorCloseError,
|
|
14
14
|
CursorFetchError,
|
|
15
15
|
CursorStartError,
|
|
16
|
+
DatabaseError,
|
|
17
|
+
DataError,
|
|
18
|
+
Error,
|
|
19
|
+
IntegrityError,
|
|
20
|
+
InterfaceError,
|
|
21
|
+
InternalError,
|
|
16
22
|
ListenerCallbackError,
|
|
17
23
|
ListenerClosedError,
|
|
18
24
|
ListenerStartError,
|
|
19
25
|
MacAddrConversionError,
|
|
26
|
+
NotSupportedError,
|
|
27
|
+
OperationalError,
|
|
28
|
+
ProgrammingError,
|
|
20
29
|
PyToRustValueMappingError,
|
|
21
|
-
RustPSQLDriverPyBaseError,
|
|
22
30
|
RustToPyValueMappingError,
|
|
23
31
|
TransactionBeginError,
|
|
24
32
|
TransactionClosedError,
|
|
@@ -27,6 +35,7 @@ from ._internal.exceptions import (
|
|
|
27
35
|
TransactionRollbackError,
|
|
28
36
|
TransactionSavepointError,
|
|
29
37
|
UUIDValueConvertError,
|
|
38
|
+
WarningError,
|
|
30
39
|
)
|
|
31
40
|
|
|
32
41
|
__all__ = [
|
|
@@ -44,12 +53,20 @@ __all__ = [
|
|
|
44
53
|
"CursorClosedError",
|
|
45
54
|
"CursorFetchError",
|
|
46
55
|
"CursorStartError",
|
|
56
|
+
"DataError",
|
|
57
|
+
"DatabaseError",
|
|
58
|
+
"Error",
|
|
59
|
+
"IntegrityError",
|
|
60
|
+
"InterfaceError",
|
|
61
|
+
"InternalError",
|
|
47
62
|
"ListenerCallbackError",
|
|
48
63
|
"ListenerClosedError",
|
|
49
64
|
"ListenerStartError",
|
|
50
65
|
"MacAddrConversionError",
|
|
66
|
+
"NotSupportedError",
|
|
67
|
+
"OperationalError",
|
|
68
|
+
"ProgrammingError",
|
|
51
69
|
"PyToRustValueMappingError",
|
|
52
|
-
"RustPSQLDriverPyBaseError",
|
|
53
70
|
"RustToPyValueMappingError",
|
|
54
71
|
"TransactionBeginError",
|
|
55
72
|
"TransactionClosedError",
|
|
@@ -58,4 +75,5 @@ __all__ = [
|
|
|
58
75
|
"TransactionRollbackError",
|
|
59
76
|
"TransactionSavepointError",
|
|
60
77
|
"UUIDValueConvertError",
|
|
78
|
+
"WarningError",
|
|
61
79
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: psqlpy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.1
|
|
4
4
|
Classifier: Typing :: Typed
|
|
5
5
|
Classifier: Topic :: Database
|
|
6
6
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -33,6 +33,8 @@ Project-URL: documentation, https://psqlpy-python.github.io/
|
|
|
33
33
|
|
|
34
34
|
[](https://pypi.org/project/psqlpy/)
|
|
36
|
+
[](https://pypi.org/project/psqlpy/)
|
|
36
38
|
[](https://pypi.org/project/psqlpy/)
|
|
37
39
|
[](https://pypistats.org/packages/psqlpy)
|
|
38
40
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
psqlpy-0.11.1.dist-info/METADATA,sha256=2TTToTN0ntPpPNYGXxrAHiLiBgs285VYcjUZInQQkAY,3522
|
|
2
|
+
psqlpy-0.11.1.dist-info/WHEEL,sha256=hhjdH9EJAC-jT-946ti5GqMrW3IPhLx83sIJj2y0vW0,131
|
|
3
|
+
psqlpy-0.11.1.dist-info/entry_points.txt,sha256=kNGHhl8cqbZ25PuaS-Ez-7jl3_b_4rIajMSmdJzmKNo,74
|
|
4
|
+
psqlpy-0.11.1.dist-info/licenses/LICENSE,sha256=UkxvzBjZdhB37ez6jaooRIOe3GON6A2MJ7RVsiOxlUc,1078
|
|
5
|
+
psqlpy/__init__.py,sha256=w0a1HvjkEGAmg5dax_hkrur8y3WZT0caFmFVfMmyvxs,838
|
|
6
|
+
psqlpy/_internal.cpython-312-powerpc64le-linux-gnu.so,sha256=ZMJ_Ivpm04or8QvWE8VqZlabnrPa7g-pNQ4y4sWaN-k,15935832
|
|
7
|
+
psqlpy/_internal/__init__.pyi,sha256=X7zqvCcXhF4PD51aZ9RVqORwNuQhGGPKhGjIpgdTpbc,58307
|
|
8
|
+
psqlpy/_internal/exceptions.pyi,sha256=6GQls4kgEjd9JXl8B8i9ycf_ktYcXFeLAKp_qiwsdHk,4970
|
|
9
|
+
psqlpy/_internal/extra_types.pyi,sha256=47STvXQt2VQrPMCu3fmYR8-FmHD7fDh3NOerNjSCe6g,16999
|
|
10
|
+
psqlpy/_internal/row_factories.pyi,sha256=Viim3tpp1_7KrzZAAIJ6U9gaI_wKVWI4Y2UAO_OAlUA,1449
|
|
11
|
+
psqlpy/exceptions.py,sha256=A2TTXu7b4w8_j64ZIUfSJB-ywmWn9rJclANapflv6So,1973
|
|
12
|
+
psqlpy/extra_types.py,sha256=q51BPqYfsYic6j1RMfN8mAFg_FWiMF-5hfG2fhy8kIU,1613
|
|
13
|
+
psqlpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
psqlpy/row_factories.py,sha256=QtTUEF1oNSANT6HMyk7tAS-LluCfLC7w2mYoJ5c8X-0,107
|
|
15
|
+
psqlpy-0.11.1.dist-info/RECORD,,
|
psqlpy-0.10.1.dist-info/RECORD
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
psqlpy-0.10.1.dist-info/METADATA,sha256=U6OMvkMlC9yI1BrI95wumxrI36txijNu4Auodxavik4,3345
|
|
2
|
-
psqlpy-0.10.1.dist-info/WHEEL,sha256=4LJaUgI8kHyqkb6g0XIamX4Xgflyn5qlhyK35J-WpMw,131
|
|
3
|
-
psqlpy-0.10.1.dist-info/licenses/LICENSE,sha256=UkxvzBjZdhB37ez6jaooRIOe3GON6A2MJ7RVsiOxlUc,1078
|
|
4
|
-
psqlpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
psqlpy/row_factories.py,sha256=QtTUEF1oNSANT6HMyk7tAS-LluCfLC7w2mYoJ5c8X-0,107
|
|
6
|
-
psqlpy/_internal/__init__.pyi,sha256=0hgoqDvGRYuHoVJVFTqFmv6T90Jjs4WTp73kY04ZQZ8,59926
|
|
7
|
-
psqlpy/_internal/exceptions.pyi,sha256=FsfdLLpcDZaoZ8eCjN30gJ_uoL8XkB-_9xNGZfHcPDM,3186
|
|
8
|
-
psqlpy/_internal/extra_types.pyi,sha256=47STvXQt2VQrPMCu3fmYR8-FmHD7fDh3NOerNjSCe6g,16999
|
|
9
|
-
psqlpy/_internal/row_factories.pyi,sha256=Viim3tpp1_7KrzZAAIJ6U9gaI_wKVWI4Y2UAO_OAlUA,1449
|
|
10
|
-
psqlpy/extra_types.py,sha256=q51BPqYfsYic6j1RMfN8mAFg_FWiMF-5hfG2fhy8kIU,1613
|
|
11
|
-
psqlpy/exceptions.py,sha256=L3Ghr4IweRsaq281-eVmohMOL51iixVthC6xIhEpJmo,1639
|
|
12
|
-
psqlpy/__init__.py,sha256=xifJzAFqkTrQzc08sMyRnvj91a6hjC3M1mC7j6uhfwc,790
|
|
13
|
-
psqlpy/_internal.cpython-312-powerpc64le-linux-gnu.so,sha256=AFCHrCM1BDA5kU7jfY2xvntrrsMfzTwgi8HgbOW_sJk,15070856
|
|
14
|
-
psqlpy-0.10.1.dist-info/RECORD,,
|
|
File without changes
|