Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #38, keep args in _execute #39

Merged
merged 2 commits into from
Jul 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion asyncpgsa/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ class SAConnection(connection.Connection):
# return getattr(self._connection, attr)

def _execute(self, query, args, limit, timeout, return_status=False):
query, args = compile_query(query, dialect=self._dialect)
query, compiled_args = compile_query(query, dialect=self._dialect)
args = tuple(compiled_args) + args
return super()._execute(query, args, limit, timeout,
return_status=return_status)

Expand Down
6 changes: 6 additions & 0 deletions tests/test_pgsingleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ async def test_fetchval():
assert value == 6.0


async def test_sql_with_arguments():
script = "SELECT $1::INT"
result = await pg.execute(script, 1)
assert bool(result)


async def test_transaction():
async with pg.transaction() as conn:
for row in await conn.fetch(query):
Expand Down