Код: Выделить всё
# start_ts is of PostgreSQL type "timestamp with time zone" aka "timestamptz"
# start & end are datetime.datetime instances with tz=UTC
query += f"WHERE start_ts >= '{ str(start) }'::timestamptz AND start_ts < '{ str(end) }'::timestamptz"
await conn.fetch( query )
Код: Выделить всё
query += "WHERE start_ts >= $1::timestamptz AND start_ts < $2::timestamptz"
await conn.fetch( query, start, end )
Код: Выделить всё
CannotCoerceError: cannot cast type text[] to timestamp with time zone
PS. Хотелось бы увидеть реальный запрос, который asyncpg отправляет PostgreSQL, но я не могу найти что-нибудь в документации или моих поисках в Google о том, как это включить.
Подробнее здесь: https://stackoverflow.com/questions/790 ... to-asyncpg