Skip to content

Commit

Permalink
Fix asyncpg BigInteger query (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
aminalaee authored Jan 19, 2023
1 parent 06f1017 commit f4cf08a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sqladmin/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ def get_direction(attr: MODEL_ATTR_TYPE) -> str:

def get_column_python_type(column: Column) -> type:
try:
if hasattr(column.type, "impl"):
return column.type.impl.python_type
return column.type.python_type
except NotImplementedError:
return str
Expand Down
3 changes: 2 additions & 1 deletion tests/test_admin_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from httpx import AsyncClient
from sqlalchemy import (
JSON,
BigInteger,
Column,
Date,
Enum,
Expand Down Expand Up @@ -77,7 +78,7 @@ def __str__(self) -> str:
class Profile(Base):
__tablename__ = "profiles"

id = Column(Integer, primary_key=True)
id = Column(BigInteger().with_variant(Integer, "sqlite"), primary_key=True)
user_id = Column(Integer, ForeignKey("users.id"), unique=True)

user = relationship("User", back_populates="profile")
Expand Down

0 comments on commit f4cf08a

Please sign in to comment.