Open riwu opened 3 months ago
and Not accepting str as value for int
class Table(Base):
__tablename__ = 'table'
num: Mapped[int]
session.add(Table(num='111'))
session.commit()
it throws this error:
<class 'asyncpg.exceptions.DataError'> ('str' object cannot be interpreted as an integer)
I am using asyncpg as the driver for SQLAlchemy.
With the above code, it throws this error:
sqlalchemy.exc.DBAPIError: (sqlalchemy.dialects.postgresql.asyncpg.Error) <class 'asyncpg.exceptions.DataError'>: invalid input for query argument $9: '1 min' ('str' object has no attribute 'days')
However, Postgresql accepts
'1 min'
as a value to an interval column. Why is asyncpg forbidding str even though Postgresql accepts it in this case?