Closed paroxyste-0 closed 1 month ago
Hello! Thank you for the issue.
You have to do the following:
from psqlpy.extra_types import BigInt, Float32
async def main():
psql_pool = ConnectionPool()
await psql_pool.execute(
"INSERT INTO issue80 (id, price) VALUES ($1, $2)",
parameters=[BigInt(123), Float32(12.1)]
)
result = await psql_pool.execute(
"SELECT * FROM issue80",
)
# [{'id': 123, 'price': 12.1}]
Generally, the BIGSERIAL type is just a pseudo-type for BIGINT, so you must explicitly specify it.
As for Float32 - by default any float value from Python is converted to FLOAT8 value, but Float(2)
is FLAOT4 type.
Thank you so much, it works perfectly !!!!
Hello, I would like to know if the SERIAL, BIGSERIAL and REAL types are supported, created as follows:
for example :
the result is :
because I can't insert price with float data in python, and not retrieve BigSerial data with an int value in python.
Thanks