Skip to content

Conversation

@sfc-gh-fpawlowski
Copy link
Contributor

@sfc-gh-fpawlowski sfc-gh-fpawlowski commented Oct 28, 2025

Approach 2 - not idempotent aenter but separate prepare method.
Main benefit - not relying on conn.is_closed() in SnowflakeConnection.aenter (no unnecessary logic there).

Main drawback:

  • not calling real SnowflakeConnection.aenter in snowflake.connector.aio.connect.aenter - we cannot feel safe from missing some logic there.
  • will we be always able to keep all preparation logic in this conn._prepare_aexit() method?

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

Comment on lines +169 to +173
def _prepare_aenter(self) -> None:
"""
All connection changes done before entering connection context have to be done here, as we expose the same api through snowflake.connector.aio.connect() and call this function there at __aenter__ as well.
"""
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it needed?

Comment on lines +75 to +82
self.__wrapped__ = SnowflakeConnection.__init__
self.__name__ = "connect"
self.__doc__ = SnowflakeConnection.__init__.__doc__
self.__module__ = __name__
self.__qualname__ = "connect"
self.__annotations__ = getattr(
SnowflakeConnection.__init__, "__annotations__", {}
)
Copy link
Contributor

Choose a reason for hiding this comment

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

All of those are by default reassigned when using @wraps (in update_wrapper)

Base automatically changed from cherrypicks-to-aio-connector-part23a to dev/aio-connector October 29, 2025 11:48
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