Skip to content

Commit 20a086e

Browse files
Reorganize client objects.
1 parent 6832f6f commit 20a086e

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

db_wrapper/client/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from typing import Union
2+
3+
from .async_client import AsyncClient
4+
from .sync_client import SyncClient
5+
6+
Client = Union[AsyncClient, SyncClient]

db_wrapper/client.py renamed to db_wrapper/client/async_client.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212

1313
import aiopg # type: ignore
1414
from psycopg2.extras import register_uuid
15-
# importing for the sole purpose of re-exporting
16-
# pylint: disable=unused-import
1715
from psycopg2 import sql
1816

19-
from .connection import ConnectionParameters, connect
17+
from db_wrapper.connection import ConnectionParameters, connect
2018

2119
# add uuid support to psycopg2 & Postgres
2220
register_uuid()
@@ -26,11 +24,10 @@
2624
# pylint: disable=invalid-name
2725
T = TypeVar('T')
2826

29-
# pylint: disable=unsubscriptable-object
3027
Query = Union[str, sql.Composed]
3128

3229

33-
class Client:
30+
class AsyncClient:
3431
"""Class to manage database connection & expose necessary methods to user.
3532
3633
Stores connection parameters on init, then exposes methods to

db_wrapper/sync_client.py renamed to db_wrapper/client/sync_client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
Dict)
1212

1313
from psycopg2.extras import register_uuid
14-
# importing for the sole purpose of re-exporting
15-
# pylint: disable=unused-import
1614
from psycopg2 import sql
1715
from psycopg2._psycopg import cursor
1816

19-
from .connection import (
17+
from db_wrapper.connection import (
2018
sync_connect,
2119
ConnectionParameters,
2220
)
@@ -32,7 +30,7 @@
3230
Query = Union[str, sql.Composed]
3331

3432

35-
class Client:
33+
class SyncClient:
3634
"""Class to manage database connection & expose necessary methods to user.
3735
3836
Stores connection parameters on init, then exposes methods to

0 commit comments

Comments
 (0)