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
Do you use a PostgreSQL SaaS? If so, which?: Yes, I am using NeonDB
Can you reproduce the issue with a local PostgreSQL install?: Didn't attempt it.
Python version: 3.11.0
Platform: Windows
Do you use pgbouncer?: No
Did you install asyncpg with pip?: Yes
If you built asyncpg locally, which version of Cython did you use?: [Your Cython version if applicable]
Can the issue be reproduced under both asyncio and uvloop?: [Yes/No] I did not try uvloop
I'm encountering an issue where the flow of my application gets stuck unless the database connection is explicitly closed after a query, even though it should be managed automatically by the context manager.
Code Example:
asyncdefread_record(self, request_details: dict):
""" Retrieve records based on conditions and request_type. Args: request_details (dict): The conditions including request_type. Returns: list: The records that match the conditions. """table=self.get_table_name(request_details['request_type'])
conditions= {key: request_details[key] forkeyinrequest_detailsifkey!='request_type'}
condition_str=" AND ".join(f"{key} = ${i+1}"fori, keyinenumerate(conditions.keys()))
query=f"SELECT * FROM {table} WHERE {condition_str};"asyncwithself.get_connection() asconn:
conn.add_log_listener(lambdaconnection, message: logger.info("PostgreSQL log message: %s", message))
result=awaitconn.fetch(query, *conditions.values())
logger.info("Fetched records: %s", result)
# await conn.close() # get's stuck without this linereturnresult
The text was updated successfully, but these errors were encountered:
uvloop?: [Yes/No] I did not try uvloop
I'm encountering an issue where the flow of my application gets stuck unless the database connection is explicitly closed after a query, even though it should be managed automatically by the context manager.
Code Example:
The text was updated successfully, but these errors were encountered: