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

⬆ Update sqlalchemy[asyncio] requirement from <1.5.0,>=1.3.18 to >=1.3.18,<2.1.0 #87

Merged
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
10 changes: 2 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,16 @@ repos:
- --py3-plus
- --keep-runtime-typing
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.227
rev: v0.0.236
hooks:
- id: ruff
args:
- --fix
- repo: https://github.com/pycqa/isort
rev: 5.11.4
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- id: isort
name: isort (cython)
types: [cython]
- id: isort
name: isort (pyi)
types: [pyi]
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion ormdantic/generator/_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async def count(self, where: dict[str, Any] | None = None, depth: int = 0) -> in
async def _execute_query(self, query: QueryBuilder) -> Any:
async_session = sessionmaker(
self._engine, expire_on_commit=False, class_=AsyncSession
)
) # type: ignore
async with async_session() as session:
async with session.begin():
result = await session.execute(text(str(query)))
Expand Down
5 changes: 3 additions & 2 deletions ormdantic/generator/_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def __init__(
self,
table_data: OrmTable, # type: ignore
table_map: Map,
result_set: CursorResult,
# TODO: Missing type parameters for generic type "CursorResult".
result_set: CursorResult, # type: ignore
is_array: bool,
depth: int,
) -> None:
Expand All @@ -49,7 +50,7 @@ def __init__(
)
},
)
self._columns = [it[0] for it in self._result_set.cursor.description]
self._columns = [it[0] for it in self._result_set.cursor.description] # type: ignore
self._return_dict: dict[str, Any] = {}

def deserialize(self) -> SerializedType:
Expand Down
8 changes: 4 additions & 4 deletions ormdantic/generator/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def init(self) -> None:

def _get_columns(
self, table_data: OrmTable # type: ignore
) -> tuple[Column[Any] | Column, ...]:
) -> tuple[Column[Any] | Column, ...]: # type: ignore
columns = []
for field_name, field in table_data.model.__fields__.items():
kwargs = {
Expand All @@ -77,7 +77,7 @@ def _get_columns(

def _get_column(
self, field_name: str, field: ModelField, **kwargs: Any
) -> Column | None:
) -> Column | None: # type: ignore
outer_origin = get_origin(field.outer_type_)
origin = get_origin(field.type_)
if outer_origin and outer_origin == list:
Expand All @@ -95,7 +95,7 @@ def _get_column(
col_type = (
postgresql.UUID if self._engine.name == "postgres" else String(36)
)
return Column(field_name, col_type, **kwargs)
return Column(field_name, col_type, **kwargs) # type: ignore
if issubclass(field.type_, BaseModel):
return Column(field_name, JSON, **kwargs)
if issubclass(field.type_, str):
Expand All @@ -118,7 +118,7 @@ def _get_column(

def _get_column_from_type_args(
self, field_name: str, field: ModelField, **kwargs: Any
) -> Column | None:
) -> Column | None: # type: ignore
for arg in get_args(field.type_):
if arg in [it.model for it in self._table_map.name_to_data.values()]:
foreign_table = TableName_From_Model(arg, self._table_map)
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classifiers = [
dependencies = [
"typing-extensions >=3.7.4,<4.5.0",
"pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0",
"sqlalchemy[asyncio] >=1.3.18,<1.5.0",
"sqlalchemy[asyncio] >=1.3.18,<2.1.0",
"PyPika ==0.48.9"
]

Expand Down Expand Up @@ -60,6 +60,7 @@ test = [
"codecov==2.1.12",
"pytest-cov==4.0.0",
"python-decouple",
"pytest-pretty==1.0.1"
]
docs = [
"mkdocs >=1.1.2,<2.0.0",
Expand Down