You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 19, 2025. It is now read-only.
A simple COUNT(*) works using sqlalchemy.Engine.execute(), but fails using databases.Database.fetch_all(), raising an IndeterminateDatatypeError exception.
importasyncioimportdatabasesimportsqlalchemyfromsqlalchemyimportColumn, MetaData, Text, Table, select, funcurl="postgresql://test:password@localhost/example"engine=sqlalchemy.create_engine(url)
metadata=MetaData()
People=Table("people", metadata, Column("name", Text()))
QUERY=select([func.count("*")]).select_from(People)
defsetup():
engine.execute("CREATE TABLE IF NOT EXISTS people(name text)")
deftest_sync():
"this works"engine.execute(QUERY).fetchall()
asyncdeftest_async():
"this fails with 'asyncpg.exceptions.IndeterminateDatatypeError: could not determine data type of parameter $1'"database=databases.Database(url)
awaitdatabase.connect()
awaitdatabase.fetch_all(QUERY)
awaitdatabase.disconnect()
if__name__=="__main__":
setup()
test_sync()
asyncio.get_event_loop().run_until_complete(test_async())
A simple
COUNT(*)works usingsqlalchemy.Engine.execute(), but fails usingdatabases.Database.fetch_all(), raising anIndeterminateDatatypeErrorexception.