database-wrapper-pgsql 0.2.16__tar.gz → 0.2.23__tar.gz
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.
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/PKG-INFO +2 -2
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql/__init__.py +25 -21
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql/connector.py +17 -17
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql/db_wrapper_pgsql.py +3 -5
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql/db_wrapper_pgsql_async.py +2 -2
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql/db_wrapper_pgsql_mixin.py +2 -2
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql.egg-info/PKG-INFO +2 -2
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql.egg-info/requires.txt +1 -1
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/pyproject.toml +5 -7
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/README.md +0 -0
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql/pg_introspector.py +0 -0
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql/py.typed +0 -0
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql/type_mapping.py +0 -0
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql.egg-info/SOURCES.txt +0 -0
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql.egg-info/dependency_links.txt +0 -0
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql.egg-info/top_level.txt +0 -0
- {database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: database_wrapper_pgsql
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.23
|
|
4
4
|
Summary: database_wrapper for PostgreSQL database
|
|
5
5
|
Author-email: Gints Murans <gm@gm.lv>
|
|
6
6
|
License: GNU General Public License v3.0 (GPL-3.0)
|
|
@@ -32,7 +32,7 @@ Classifier: Topic :: Software Development
|
|
|
32
32
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
33
33
|
Requires-Python: >=3.8
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
|
-
Requires-Dist: database_wrapper==0.2.
|
|
35
|
+
Requires-Dist: database_wrapper==0.2.23
|
|
36
36
|
Requires-Dist: psycopg[binary]>=3.2.0
|
|
37
37
|
Requires-Dist: psycopg[pool]>=3.2.0
|
|
38
38
|
|
{database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql/__init__.py
RENAMED
|
@@ -10,20 +10,21 @@ import logging
|
|
|
10
10
|
|
|
11
11
|
from .connector import (
|
|
12
12
|
# Basics
|
|
13
|
-
|
|
14
|
-
# Connection and Cursor types
|
|
13
|
+
PgConnection,
|
|
15
14
|
PgConnectionType,
|
|
16
15
|
PgConnectionTypeAsync,
|
|
16
|
+
PgCursor,
|
|
17
17
|
PgCursorType,
|
|
18
18
|
PgCursorTypeAsync,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
PgDictRow,
|
|
20
|
+
Pgsql,
|
|
21
|
+
PgsqlAsync,
|
|
22
|
+
PgsqlConfig,
|
|
23
|
+
PgsqlWithPooling,
|
|
24
|
+
PgsqlWithPoolingAsync,
|
|
24
25
|
)
|
|
25
|
-
from .db_wrapper_pgsql import
|
|
26
|
-
from .db_wrapper_pgsql_async import
|
|
26
|
+
from .db_wrapper_pgsql import DBWrapperPgsql
|
|
27
|
+
from .db_wrapper_pgsql_async import DBWrapperPgsqlAsync
|
|
27
28
|
from .pg_introspector import PostgresIntrospector
|
|
28
29
|
|
|
29
30
|
# Set the logger to a quiet default, can be enabled if needed
|
|
@@ -34,19 +35,22 @@ if logger.level == logging.NOTSET:
|
|
|
34
35
|
|
|
35
36
|
__all__ = [
|
|
36
37
|
# Wrappers
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
DBWrapperPgsql,
|
|
39
|
+
DBWrapperPgsqlAsync,
|
|
39
40
|
# Connectors
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
Pgsql,
|
|
42
|
+
PgsqlAsync,
|
|
43
|
+
PgsqlWithPooling,
|
|
44
|
+
PgsqlWithPoolingAsync,
|
|
44
45
|
# Connection and Cursor types
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
PgConnection,
|
|
47
|
+
PgConnectionType,
|
|
48
|
+
PgConnectionTypeAsync,
|
|
49
|
+
PgCursor,
|
|
50
|
+
PgCursorType,
|
|
51
|
+
PgCursorTypeAsync,
|
|
52
|
+
PgDictRow,
|
|
49
53
|
# Helpers
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
PgsqlConfig,
|
|
55
|
+
PostgresIntrospector,
|
|
52
56
|
]
|
{database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql/connector.py
RENAMED
|
@@ -21,7 +21,7 @@ PgConnectionTypeAsync = PgConnectionAsync[PgDictRow]
|
|
|
21
21
|
PgCursorTypeAsync = PgCursorAsync[PgDictRow]
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
class
|
|
24
|
+
class PgsqlConfig(TypedDict):
|
|
25
25
|
hostname: str
|
|
26
26
|
port: NotRequired[int]
|
|
27
27
|
username: str
|
|
@@ -35,7 +35,7 @@ class PgConfig(TypedDict):
|
|
|
35
35
|
pool_kwargs: NotRequired[dict[str, Any]]
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
class
|
|
38
|
+
class Pgsql(DatabaseBackend):
|
|
39
39
|
"""
|
|
40
40
|
PostgreSQL database implementation.
|
|
41
41
|
|
|
@@ -45,7 +45,7 @@ class PgSQL(DatabaseBackend):
|
|
|
45
45
|
Close is called automatically when class is destroyed.
|
|
46
46
|
|
|
47
47
|
:param config: Configuration for PostgreSQL
|
|
48
|
-
:type config:
|
|
48
|
+
:type config: PgsqlConfig
|
|
49
49
|
|
|
50
50
|
Defaults:
|
|
51
51
|
port = 5432
|
|
@@ -53,7 +53,7 @@ class PgSQL(DatabaseBackend):
|
|
|
53
53
|
|
|
54
54
|
"""
|
|
55
55
|
|
|
56
|
-
config:
|
|
56
|
+
config: PgsqlConfig
|
|
57
57
|
|
|
58
58
|
connection: PgConnectionType
|
|
59
59
|
cursor: PgCursorType
|
|
@@ -152,7 +152,7 @@ class PgSQL(DatabaseBackend):
|
|
|
152
152
|
self.connection.rollback()
|
|
153
153
|
|
|
154
154
|
|
|
155
|
-
class
|
|
155
|
+
class PgsqlAsync(DatabaseBackend):
|
|
156
156
|
"""
|
|
157
157
|
PostgreSQL database async implementation.
|
|
158
158
|
|
|
@@ -163,7 +163,7 @@ class PgSQLAsync(DatabaseBackend):
|
|
|
163
163
|
! You need to call it manually in async environment.
|
|
164
164
|
|
|
165
165
|
:param config: Configuration for PostgreSQL
|
|
166
|
-
:type config:
|
|
166
|
+
:type config: PgsqlConfig
|
|
167
167
|
|
|
168
168
|
Defaults:
|
|
169
169
|
port = 5432
|
|
@@ -171,7 +171,7 @@ class PgSQLAsync(DatabaseBackend):
|
|
|
171
171
|
|
|
172
172
|
"""
|
|
173
173
|
|
|
174
|
-
config:
|
|
174
|
+
config: PgsqlConfig
|
|
175
175
|
|
|
176
176
|
connection: PgConnectionTypeAsync
|
|
177
177
|
cursor: PgCursorTypeAsync
|
|
@@ -280,7 +280,7 @@ class PgSQLAsync(DatabaseBackend):
|
|
|
280
280
|
await self.connection.rollback()
|
|
281
281
|
|
|
282
282
|
|
|
283
|
-
class
|
|
283
|
+
class PgsqlWithPooling(DatabaseBackend):
|
|
284
284
|
"""
|
|
285
285
|
PostgreSQL database implementation with connection pooling.
|
|
286
286
|
|
|
@@ -292,13 +292,13 @@ class PgSQLWithPooling(DatabaseBackend):
|
|
|
292
292
|
Or use context manager to get connection and return it back automatically,
|
|
293
293
|
for example:
|
|
294
294
|
|
|
295
|
-
pool =
|
|
295
|
+
pool = PgsqlWithPooling(config)
|
|
296
296
|
pool.open_pool()
|
|
297
297
|
with pool as (connection, cursor):
|
|
298
298
|
cursor.execute("SELECT 1")
|
|
299
299
|
|
|
300
300
|
:param config: Configuration for PostgreSQL
|
|
301
|
-
:type config:
|
|
301
|
+
:type config: PgsqlConfig
|
|
302
302
|
:param connection_timeout: Connection timeout
|
|
303
303
|
:type connection_timeout: int
|
|
304
304
|
:param instance_name: Name of the instance
|
|
@@ -310,7 +310,7 @@ class PgSQLWithPooling(DatabaseBackend):
|
|
|
310
310
|
maxconnections = 5
|
|
311
311
|
"""
|
|
312
312
|
|
|
313
|
-
config:
|
|
313
|
+
config: PgsqlConfig
|
|
314
314
|
""" Configuration """
|
|
315
315
|
|
|
316
316
|
pool: ConnectionPool[PgConnectionType]
|
|
@@ -331,7 +331,7 @@ class PgSQLWithPooling(DatabaseBackend):
|
|
|
331
331
|
|
|
332
332
|
def __init__(
|
|
333
333
|
self,
|
|
334
|
-
db_config:
|
|
334
|
+
db_config: PgsqlConfig,
|
|
335
335
|
connection_timeout: int = 5,
|
|
336
336
|
instance_name: str = "postgresql_pool",
|
|
337
337
|
) -> None:
|
|
@@ -541,7 +541,7 @@ class PgSQLWithPooling(DatabaseBackend):
|
|
|
541
541
|
self.connection.rollback()
|
|
542
542
|
|
|
543
543
|
|
|
544
|
-
class
|
|
544
|
+
class PgsqlWithPoolingAsync(DatabaseBackend):
|
|
545
545
|
"""
|
|
546
546
|
PostgreSQL database implementation with async connection pooling.
|
|
547
547
|
|
|
@@ -554,7 +554,7 @@ class PgSQLWithPoolingAsync(DatabaseBackend):
|
|
|
554
554
|
Or use context manager to get connection and return it back automatically,
|
|
555
555
|
for example:
|
|
556
556
|
|
|
557
|
-
pool =
|
|
557
|
+
pool = PgsqlWithPoolingAsync(config)
|
|
558
558
|
await pool.open_pool()
|
|
559
559
|
async with pool as (connection, cursor):
|
|
560
560
|
await cursor.execute("SELECT 1")
|
|
@@ -564,7 +564,7 @@ class PgSQLWithPoolingAsync(DatabaseBackend):
|
|
|
564
564
|
! You need to call `await close_pool()` manually in async environment.
|
|
565
565
|
|
|
566
566
|
:param config: Configuration for PostgreSQL
|
|
567
|
-
:type config:
|
|
567
|
+
:type config: PgsqlConfig
|
|
568
568
|
:param connection_timeout: Connection timeout
|
|
569
569
|
:type connection_timeout: int
|
|
570
570
|
:param instance_name: Name of the instance
|
|
@@ -576,7 +576,7 @@ class PgSQLWithPoolingAsync(DatabaseBackend):
|
|
|
576
576
|
maxconnections = 5
|
|
577
577
|
"""
|
|
578
578
|
|
|
579
|
-
config:
|
|
579
|
+
config: PgsqlConfig
|
|
580
580
|
""" Configuration """
|
|
581
581
|
|
|
582
582
|
pool_async: AsyncConnectionPool[PgConnectionTypeAsync]
|
|
@@ -597,7 +597,7 @@ class PgSQLWithPoolingAsync(DatabaseBackend):
|
|
|
597
597
|
|
|
598
598
|
def __init__(
|
|
599
599
|
self,
|
|
600
|
-
db_config:
|
|
600
|
+
db_config: PgsqlConfig,
|
|
601
601
|
connection_timeout: int = 5,
|
|
602
602
|
instance_name: str = "async_postgresql",
|
|
603
603
|
) -> None:
|
|
@@ -6,13 +6,11 @@ from psycopg import Cursor, sql
|
|
|
6
6
|
from database_wrapper import DBWrapper
|
|
7
7
|
|
|
8
8
|
from .connector import PgCursorType
|
|
9
|
-
from .db_wrapper_pgsql_mixin import
|
|
9
|
+
from .db_wrapper_pgsql_mixin import DBWrapperPgsqlMixin
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
class
|
|
13
|
-
"""
|
|
14
|
-
Sync database wrapper for postgres
|
|
15
|
-
"""
|
|
12
|
+
class DBWrapperPgsql(DBWrapperPgsqlMixin, DBWrapper):
|
|
13
|
+
"""Wrapper for PostgreSQL database"""
|
|
16
14
|
|
|
17
15
|
db_cursor: PgCursorType | None
|
|
18
16
|
""" PostgreSQL cursor object """
|
|
@@ -6,10 +6,10 @@ from psycopg import sql
|
|
|
6
6
|
from database_wrapper import DBWrapperAsync
|
|
7
7
|
|
|
8
8
|
from .connector import PgCursorTypeAsync
|
|
9
|
-
from .db_wrapper_pgsql_mixin import
|
|
9
|
+
from .db_wrapper_pgsql_mixin import DBWrapperPgsqlMixin
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
class
|
|
12
|
+
class DBWrapperPgsqlAsync(DBWrapperPgsqlMixin, DBWrapperAsync):
|
|
13
13
|
"""
|
|
14
14
|
Async database wrapper for postgres
|
|
15
15
|
|
|
@@ -5,9 +5,9 @@ from psycopg import sql
|
|
|
5
5
|
from database_wrapper import NoParam, OrderByItem
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class
|
|
8
|
+
class DBWrapperPgsqlMixin:
|
|
9
9
|
"""
|
|
10
|
-
Mixin for providing methods that can be used by both sync and async versions of the
|
|
10
|
+
Mixin for providing methods that can be used by both sync and async versions of the DBWrapperPgsql class.
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
13
|
######################
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: database_wrapper_pgsql
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.23
|
|
4
4
|
Summary: database_wrapper for PostgreSQL database
|
|
5
5
|
Author-email: Gints Murans <gm@gm.lv>
|
|
6
6
|
License: GNU General Public License v3.0 (GPL-3.0)
|
|
@@ -32,7 +32,7 @@ Classifier: Topic :: Software Development
|
|
|
32
32
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
33
33
|
Requires-Python: >=3.8
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
|
-
Requires-Dist: database_wrapper==0.2.
|
|
35
|
+
Requires-Dist: database_wrapper==0.2.23
|
|
36
36
|
Requires-Dist: psycopg[binary]>=3.2.0
|
|
37
37
|
Requires-Dist: psycopg[pool]>=3.2.0
|
|
38
38
|
|
|
@@ -4,14 +4,12 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "database_wrapper_pgsql"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.23"
|
|
8
8
|
description = "database_wrapper for PostgreSQL database"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
11
|
-
license = {text = "GNU General Public License v3.0 (GPL-3.0)"}
|
|
12
|
-
authors = [
|
|
13
|
-
{name = "Gints Murans", email = "gm@gm.lv"}
|
|
14
|
-
]
|
|
11
|
+
license = { text = "GNU General Public License v3.0 (GPL-3.0)" }
|
|
12
|
+
authors = [{ name = "Gints Murans", email = "gm@gm.lv" }]
|
|
15
13
|
classifiers = [
|
|
16
14
|
"Development Status :: 4 - Beta",
|
|
17
15
|
"Intended Audience :: Developers",
|
|
@@ -31,11 +29,11 @@ classifiers = [
|
|
|
31
29
|
"Topic :: Database",
|
|
32
30
|
"Topic :: Database :: Front-Ends",
|
|
33
31
|
"Topic :: Software Development",
|
|
34
|
-
"Topic :: Software Development :: Libraries :: Python Modules"
|
|
32
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
35
33
|
]
|
|
36
34
|
keywords = ["database", "wrapper", "python", "postgresql", "pgsql"]
|
|
37
35
|
dependencies = [
|
|
38
|
-
"database_wrapper == 0.2.
|
|
36
|
+
"database_wrapper == 0.2.23",
|
|
39
37
|
"psycopg[binary] >= 3.2.0",
|
|
40
38
|
"psycopg[pool] >= 3.2.0",
|
|
41
39
|
]
|
|
File without changes
|
|
File without changes
|
{database_wrapper_pgsql-0.2.16 → database_wrapper_pgsql-0.2.23}/database_wrapper_pgsql/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|