CodeMaestro
CodeMaestro
XXata
Created by CodeMaestro on 7/26/2024 in #help
xata raises error if `RESET ALL;` is called
I have encountered a bug with xata when using asyncpg and a connection pool. Root cause: When a connection is released back into the pool, the RESET ALL; is executed and xata raises a setting "" is not allowed error. Minimum reproduction code:
import asyncio
import asyncpg # Using asyncpg==0.29.0


async def main():
# Put a real connection string in here
db_url_pg = "postgresql://<WORKSPACE_ID>:<API_KEY>@<REGION>.sql.xata.sh/<DATABASE_NAME>:<BRANCH>?ssl=require"
pool = await asyncpg.create_pool(dsn=db_url_pg)
connection = await pool.acquire()
version = await connection.fetchval("SELECT version();")
print(version)
await pool.release(connection, timeout=10) # Raises asyncpg.exceptions._base.UnknownPostgresError: setting "" is not allowed


if __name__ == "__main__":
asyncio.run(main())
import asyncio
import asyncpg # Using asyncpg==0.29.0


async def main():
# Put a real connection string in here
db_url_pg = "postgresql://<WORKSPACE_ID>:<API_KEY>@<REGION>.sql.xata.sh/<DATABASE_NAME>:<BRANCH>?ssl=require"
pool = await asyncpg.create_pool(dsn=db_url_pg)
connection = await pool.acquire()
version = await connection.fetchval("SELECT version();")
print(version)
await pool.release(connection, timeout=10) # Raises asyncpg.exceptions._base.UnknownPostgresError: setting "" is not allowed


if __name__ == "__main__":
asyncio.run(main())
3 replies