Skip to content

Commit

Permalink
Fixup create_pool func: pass dialect kwarg correctly into `SAConn…
Browse files Browse the repository at this point in the history
…ection` (#58)
  • Loading branch information
Gr1N authored and nhumrich committed Dec 7, 2017
1 parent aa3f8f6 commit 6a81f8b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions asyncpgsa/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
import asyncpg

from .transactionmanager import ConnectionTransactionContextManager
from .connection import SAConnection
from .connection import SAConnection as _SAConnection


@wraps(asyncpg.create_pool)
def create_pool(*args,
dialect=None,
**connect_kwargs):
class SAConnection(_SAConnection):
def __init__(self, *args, dialect=dialect, **kwargs):
super().__init__(*args, dialect=dialect, **kwargs)
connection_class = SAConnection
connection_class._dialect = dialect

# dict is fine on the pool object as there is usually only one of them
# asyncpg.pool.Pool.__slots__ += ('__dict__',)
Expand All @@ -24,4 +26,3 @@ def transaction(self, **kwargs):
pool = asyncpg.create_pool(*args, connection_class=connection_class,
**connect_kwargs)
return pool

0 comments on commit 6a81f8b

Please sign in to comment.