Skip to content

Commit

Permalink
use aiosqlite>=0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
grigi committed Oct 14, 2018
1 parent fbd6de0 commit dbf7646
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[settings]
line_length=100
multi_line_output=0
known_third_party=
known_third_party=aiosqlite,ciso8601
not_skip=__init__.py
31 changes: 16 additions & 15 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
aenum==2.0.8 # via pypika
aiocontextvars==0.1.2 ; python_version < "3.7"
aiomysql==0.0.19
aiosqlite==0.6.0
alabaster==0.7.11 # via sphinx
aiosqlite==0.7.0
alabaster==0.7.12 # via sphinx
asn1crypto==0.24.0 # via cryptography
astroid==2.0.4 # via pylint
asyncpg==0.17.0
Expand All @@ -18,20 +18,21 @@ bandit==1.5.1
certifi==2018.8.24 # via requests
cffi==1.11.5 # via cryptography
chardet==3.0.4 # via requests
ciso8601==2.0.1
ciso8601==2.1.1
click==7.0 # via pip-tools
cloud-sptheme==1.9.4
colorama==0.3.9 # via green
colorama==0.4.0 # via green
coverage==4.5.1 # via coveralls, green
coveralls==1.5.0
coveralls==1.5.1
cryptography==2.3.1 # via pymysql
docopt==0.6.2 # via coveralls
docutils==0.14
filelock==3.0.9 # via tox
flake8-isort==2.5
flake8==3.5.0 # via flake8-isort
gitdb2==2.0.4 # via gitpython
gitdb2==2.0.5 # via gitpython
gitpython==2.1.11 # via bandit
green==2.12.1
green==2.13.0
idna==2.7 # via cryptography, requests
imagesize==1.1.0 # via sphinx
isort==4.3.4 # via flake8-isort, pylint
Expand All @@ -42,32 +43,32 @@ mccabe==0.6.1 # via flake8, pylint
mypy-extensions==0.4.1 # via mypy
mypy==0.630
packaging==18.0 # via sphinx
pbr==4.2.0 # via stevedore
pip-tools==3.0.0
pbr==4.3.0 # via stevedore
pip-tools==3.1.0
pluggy==0.7.1 # via tox
py==1.6.0 # via tox
py==1.7.0 # via tox
pycodestyle==2.3.1 # via flake8
pycparser==2.19 # via cffi
pyflakes==1.6.0 # via flake8
pygments==2.2.0
pylint==2.1.1
pymysql==0.9.2 # via aiomysql
pyparsing==2.2.1 # via packaging
pypika==0.15.6
pyparsing==2.2.2 # via packaging
pypika==0.15.7
pytz==2018.5 # via babel
pyyaml==3.13 # via bandit
requests==2.19.1 # via coveralls, sphinx
six==1.11.0 # via astroid, bandit, cryptography, packaging, pip-tools, sphinx, stevedore, tox
smmap2==2.0.4 # via gitdb2
smmap2==2.0.5 # via gitdb2
snowballstemmer==1.2.1 # via sphinx
sphinx-autodoc-typehints==1.3.0
sphinx==1.8.1
sphinxcontrib-websupport==1.1.0 # via sphinx
stevedore==1.29.0 # via bandit
termstyle==0.1.11 # via green
testfixtures==6.3.0 # via flake8-isort
toml==0.9.6 # via tox
tox==3.4.0
toml==0.10.0 # via tox
tox==3.5.2
typed-ast==1.1.0 # via astroid, mypy
unidecode==1.0.22 # via green
urllib3==1.23 # via requests
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pypika>=0.15.6,<1.0
ciso8601>=2.0
aiocontextvars==0.1.2;python_version<"3.7"
aiosqlite>=0.6.0
aiosqlite>=0.7.0
7 changes: 2 additions & 5 deletions tortoise/backends/sqlite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,13 @@ def _in_transaction(self) -> 'TransactionWrapper':
async def execute_insert(self, query: str, values: list) -> int:
self.log.debug('%s: %s', query, values)
async with self.acquire_connection() as connection:
cursor = await connection.execute(query, values)
await cursor.execute('SELECT last_insert_rowid()')
return (await cursor.fetchone())[0]
return (await connection.execute_insert(query, values))[0]

@translate_exceptions
async def execute_query(self, query: str) -> List[dict]:
self.log.debug(query)
async with self.acquire_connection() as connection:
cursor = await connection.execute(query)
return [dict(row) for row in await cursor.fetchall()]
return [dict(row) for row in await connection.execute_fetchall(query)]

@translate_exceptions
async def execute_script(self, query: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tortoise/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from decimal import Decimal
from typing import Any, Optional

import ciso8601
from pypika import Table

import ciso8601
from tortoise.exceptions import ConfigurationError, NoValuesFetched, OperationalError
from tortoise.utils import QueryAsyncIterator

Expand Down

0 comments on commit dbf7646

Please sign in to comment.