Skip to content

Commit 755e968

Browse files
authored
Merge pull request #26 Async driver implementation from LuckySting/make-dbapi-class
2 parents e2d74aa + 67814a9 commit 755e968

23 files changed

+626
-281
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,6 @@ dmypy.json
130130

131131
# PyCharm
132132
.idea/
133+
134+
# VSCode
135+
.vscode

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ $ tox -e style
5656

5757
Reformat code:
5858
```bash
59+
$ tox -e isort
5960
$ tox -e black-format
6061
```
6162

examples/example.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import datetime
22
import logging
3-
import sqlalchemy as sa
4-
from sqlalchemy import orm, exc, sql
5-
from sqlalchemy import Table, Column, Integer, String, Float, TIMESTAMP
63

4+
import sqlalchemy as sa
75
from fill_tables import fill_all_tables, to_days
8-
from models import Base, Series, Episodes
6+
from models import Base, Episodes, Series
7+
from sqlalchemy import TIMESTAMP, Column, Float, Integer, String, Table, exc, orm, sql
98

109

1110
def describe_table(engine, name):

examples/fill_tables.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import iso8601
2-
32
import sqlalchemy as sa
4-
from models import Base, Series, Seasons, Episodes
3+
from models import Base, Episodes, Seasons, Series
54

65

76
def to_days(date):

examples/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import sqlalchemy.orm as orm
22
from sqlalchemy import Column, Integer, Unicode
33

4-
54
Base = orm.declarative_base()
65

76

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[tool.black]
22
line-length = 120
3+
4+
[tool.isort]
5+
profile = "black"

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ profile_file=test/profiles.txt
77

88
[db]
99
default=yql+ydb://localhost:2136/local
10+
ydb=yql+ydb://localhost:2136/local
11+
ydb_async=yql+ydb_async://localhost:2136/local

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
entry_points={
4040
"sqlalchemy.dialects": [
4141
"yql.ydb=ydb_sqlalchemy.sqlalchemy:YqlDialect",
42+
"yql.ydb_async=ydb_sqlalchemy.sqlalchemy:AsyncYqlDialect",
43+
"ydb_async=ydb_sqlalchemy.sqlalchemy:AsyncYqlDialect",
4244
"ydb=ydb_sqlalchemy.sqlalchemy:YqlDialect",
4345
"yql=ydb_sqlalchemy.sqlalchemy:YqlDialect",
4446
]

test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ dockerpty==0.4.1
99
flake8==3.9.2
1010
black==23.3.0
1111
pytest-cov
12+
pytest-asyncio
13+
isort==5.13.2

test/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from sqlalchemy.dialects import registry
33

44
registry.register("yql.ydb", "ydb_sqlalchemy.sqlalchemy", "YqlDialect")
5+
registry.register("yql.ydb_async", "ydb_sqlalchemy.sqlalchemy", "AsyncYqlDialect")
6+
registry.register("ydb_async", "ydb_sqlalchemy.sqlalchemy", "AsyncYqlDialect")
57
registry.register("ydb", "ydb_sqlalchemy.sqlalchemy", "YqlDialect")
68
registry.register("yql", "ydb_sqlalchemy.sqlalchemy", "YqlDialect")
79
pytest.register_assert_rewrite("sqlalchemy.testing.assertions")

0 commit comments

Comments
 (0)