Skip to content

Conversation

@sfc-gh-fpawlowski
Copy link
Contributor

Approach 1 - idempotent aenter through checking if conn closed.
Main benefit - calling SnowflakeConnection.aenter in the snowflake.connector.aio.connect.aenter - we can feel safe from missing some logic there.

Main drawback - will always conn.is_closed() be reliable.

Analogous to: https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client.py#L1376-L1412

@sfc-gh-fpawlowski sfc-gh-fpawlowski self-assigned this Oct 28, 2025
Base automatically changed from cherrypicks-to-aio-connector-part23a to dev/aio-connector October 29, 2025 11:48
@sfc-gh-fpawlowski sfc-gh-fpawlowski force-pushed the async-connect-context-manager-support branch from eb41ffe to 61ba1dc Compare November 2, 2025 16:59
@sfc-gh-fpawlowski sfc-gh-fpawlowski marked this pull request as ready for review November 2, 2025 17:05
@sfc-gh-fpawlowski sfc-gh-fpawlowski force-pushed the async-connect-context-manager-support branch from 999cbf5 to fad5e74 Compare November 4, 2025 18:15
@sfc-gh-fpawlowski sfc-gh-fpawlowski changed the title Async connect context manager support - approach 1 - idempotent __aenter__ through checking if conn closed SNOW-2671717: Async connect context manager support - approach 1 - idempotent __aenter__ through checking if conn closed Nov 4, 2025
conn = SnowflakeConnection(**kwargs)
await conn.connect()
return conn
connect = Connect
Copy link
Contributor Author

@sfc-gh-fpawlowski sfc-gh-fpawlowski Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we wish to repeat this "pattern" from the synch code? Are there any counterarguments of simply doing def connect(..):?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me def connect is much more cleaner. Current state is caused by def Connect not complying to Python naming conventions, thus we have connect alias.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants