The cursor closes the connection incorrectly. I'm not sure it should do it at all.
Code example:
logging.basicConfig(level=logging.DEBUG)
pool = await asynch.create_pool(maxsize=1)
async with pool.acquire() as conn:
assert conn._is_closed is False # <- ok
async with conn.cursor() as cursor:
await cursor.execute("SELECT 1")
assert conn._is_closed is True # <- not ok
async with pool.acquire() as conn:
assert conn._is_closed is True # <- not ok
async with conn.cursor() as cursor:
await cursor.execute("SELECT 1") # <- but it works
You can see two stages of connection in the log:
DEBUG:asynch.proto.connection:Connecting. Database: default. User: default
DEBUG:asynch.proto.connection:Connecting to 127.0.0.1:9000
DEBUG:asynch.proto.connection:Connected to ClickHouse server version 22.1.3, revision: 54455
DEBUG:asynch.proto.connection:Query: SELECT 1
DEBUG:asynch.proto.connection:Connecting. Database: default. User: default
DEBUG:asynch.proto.connection:Connecting to 127.0.0.1:9000
DEBUG:asynch.proto.connection:Connected to ClickHouse server version 22.1.3, revision: 54455
DEBUG:asynch.proto.connection:Query: SELECT 1
The cursor closes the connection incorrectly. I'm not sure it should do it at all.
Code example:
You can see two stages of connection in the log: