From 735424edf3f872144d079d5ac71d1345ddc3efd5 Mon Sep 17 00:00:00 2001 From: Adam Ling Date: Thu, 24 Oct 2024 11:25:24 -0700 Subject: [PATCH 1/2] update --- DESCRIPTION.md | 5 +++++ README.md | 32 ++++++++++++++++++++++++++++++ setup.cfg | 2 +- src/snowflake/connector/version.py | 2 +- 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION.md b/DESCRIPTION.md index f22c640dd..080758351 100644 --- a/DESCRIPTION.md +++ b/DESCRIPTION.md @@ -8,6 +8,11 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne # Release Notes +- v3.13.0a1(TBD) + - Version 3.13.0a1 introduces our initial support for asyncio in the snowflake-connector-python library. + The new asyncio functionality is available in the `snowflake.connector.aio` submodule. + Please note that this feature is in its alpha stage, and breaking changes may occur as development continues. + - v3.12.3(October 25,2024) - Improved the error message for SSL-related issues to provide clearer guidance when an SSL error occurs. - Improved error message for SQL execution cancellations caused by timeout. diff --git a/README.md b/README.md index ea94f5db5..17df96324 100644 --- a/README.md +++ b/README.md @@ -81,3 +81,35 @@ conn = snowflake.connector.connect( ) conn.telemetry_enabled = False ``` + +## Asyncio Support + +Asyncio support is introduced in version 3.13.0a1. This feature is currently in alpha stage, and future releases may include breaking changes as we continue to refine and improve the implementation. + +### Installation requirements + +```bash +pip install "snowflake-connector-python[aio]" +``` + +### Quickstart + +To start using the asyncio functionality, refer to the following example: + +```python +import asyncio +import snowflake.connector.aio +connection_parameters = { + # fill in your connection parameters +} + +async def main(): + async with snowflake.connector.aio.SnowflakeConnection( + **connection_parameters + ) as conn, conn.cursor() as cur: + await cur.execute("SELECT 1") + res = await cur.fetchone() + assert res == (1, ) + +asyncio.run(main()) +``` diff --git a/setup.cfg b/setup.cfg index d9865ac02..4b2d11ba4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,7 +9,7 @@ author_email = snowflake-python-libraries-dl@snowflake.com license = Apache-2.0 license_files = LICENSE.txt, NOTICE classifiers = - Development Status :: 5 - Production/Stable + Development Status :: 3 - Alpha Environment :: Console Environment :: Other Environment Intended Audience :: Developers diff --git a/src/snowflake/connector/version.py b/src/snowflake/connector/version.py index 852cd545e..98ead54a1 100644 --- a/src/snowflake/connector/version.py +++ b/src/snowflake/connector/version.py @@ -1,3 +1,3 @@ # Update this for the versions # Don't change the forth version number from None -VERSION = (3, 12, 3, None) +VERSION = (3, 13, "0a1", None) From f0ad4ffb7030cdcb973f7154eaef674d8efb1a02 Mon Sep 17 00:00:00 2001 From: Adam Ling Date: Tue, 5 Nov 2024 10:26:53 -0800 Subject: [PATCH 2/2] make version in agent backend compatible --- src/snowflake/connector/description.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/snowflake/connector/description.py b/src/snowflake/connector/description.py index e3acbc32f..a5c5bd568 100644 --- a/src/snowflake/connector/description.py +++ b/src/snowflake/connector/description.py @@ -8,6 +8,7 @@ from __future__ import annotations import platform +import re import sys from .version import VERSION @@ -20,4 +21,9 @@ COMPILER = platform.python_compiler() CLIENT_NAME = "PythonConnector" # don't change! -CLIENT_VERSION = ".".join([str(v) for v in VERSION[:3]]) +# This is a short-term workaround for the backend to enable client side features for preview version, e.g. 3.x.xa1 +CLIENT_VERSION = ( + ".".join([str(v) for v in VERSION[:3]]) + if str(VERSION[2]).isdigit() + else f"{str(VERSION[0])}.{str(VERSION[1])}.{re.split('[ab]', str(VERSION[2]))[0]}" +)