snowflake-sqlalchemy icon indicating copy to clipboard operation
snowflake-sqlalchemy copied to clipboard

SNOW-739749: snowflake-sqlalchemy 1.4.4 requires sqlalchemy<2.0.0,>=1.4.0, but you have sqlalchemy 2.0.1 which is incompatible.

Open sfc-gh-jgriffith opened this issue 1 year ago • 41 comments

Error when attempting to install snowflake-sqlalchemy with sqlalchemy 2.0. Error: snowflake-sqlalchemy 1.4.4 requires sqlalchemy<2.0.0,>=1.4.0, but you have sqlalchemy 2.0.1 which is incompatible.

Version 1.4.1 release notes say snowflake-sqlalchemy is now SQLAlchemy 2.0 compatible.

https://github.com/snowflakedb/snowflake-sqlalchemy/blob/7c8effdb8c38f37084d5165961df75cbbbc10ddf/setup.cfg#L50

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?

    Python 3.8.16

  2. What operating system and processor architecture are you using?

    macOS-10.16-x86_64-i386-64bit

  3. What are the component versions in the environment (pip freeze)?

    asn1crypto==1.5.1 certifi @ file:///private/var/folders/sy/f16zz6x50xz3113nwtb9bvq00000gp/T/abs_477u68wvzm/croot/certifi_1671487773341/work/certifi cffi==1.15.1 charset-normalizer==2.1.1 cryptography==38.0.4 filelock==3.9.0 greenlet==2.0.2 idna==3.4 oscrypto==1.3.0 pycparser==2.21 pycryptodomex==3.17 PyJWT==2.6.0 pyOpenSSL==22.1.0 pytz==2022.7.1 requests==2.28.2 snowflake-connector-python==2.9.0 SQLAlchemy==2.0.1 typing_extensions==4.4.0 urllib3==1.26.14

  4. What did you do?

    pip install snowflake-sqlalchemy

  5. What did you expect to see?

    Successfully installed snowflake-sqlalchemy-1.4.4

  6. Can you set logging to DEBUG and collect the logs?

sfc-gh-jgriffith avatar Feb 06 '23 23:02 sfc-gh-jgriffith

hey @sfc-gh-jgriffith, we're aware of the V2 GA release of sqlalchemy. We will plan time for testing it and do release accordingly.

sfc-gh-aling avatar Feb 07 '23 16:02 sfc-gh-aling

Do you have an estimated release timeframe for this?

stuck1233333 avatar Feb 17 '23 22:02 stuck1233333

Seconded the request for a timeframe, especially given that a previous version explicitly said it added compatibility.

qwertystop avatar Feb 26 '23 04:02 qwertystop

We would like to use sqlalchemy 2.0 as well, but this is blocking - is there a release timeframe?

cladden avatar Mar 06 '23 20:03 cladden

Any idea when sqlalchemy 2.0 support might land?

cpcloud avatar Mar 07 '23 14:03 cpcloud

hey @sfc-gh-jgriffith, we're aware of the V2 GA release of sqlalchemy.

We will plan time for testing it and do release accordingly.

@sfc-gh-aling do you have any updates on this?

cladden avatar Mar 09 '23 04:03 cladden

Hi @sfc-gh-aling -- I see an update to snowflake-sqlalchemy just went out! Support for 2.0 yet!? As of this morning, it's still restricted to <2.0 upon installation.

https://pypi.org/project/snowflake-sqlalchemy/

hellobrett avatar Mar 15 '23 13:03 hellobrett

Would also quite like to know a release timeframe for 2.0 support :)

benoneill-tenzo avatar Mar 15 '23 13:03 benoneill-tenzo

I was curious how close snowflake-sqlalchemy is from supporting sqlalchemy 2.0, so I manually installed it:

pip install --no-deps snowflake-sqlalchemy==1.4.6

It seems very close!

After some monkey-patching, I was able to create an engine and connect to snowflake:

def snowflake_sqlalchemy_20_monkey_patches():
    import sqlalchemy.util.compat

    # make strings always return unicode strings
    sqlalchemy.util.compat.string_types = (str,)
    sqlalchemy.types.String.RETURNS_UNICODE = True

    import snowflake.sqlalchemy.snowdialect

    snowflake.sqlalchemy.snowdialect.SnowflakeDialect.returns_unicode_strings = True

    # make has_table() support the `info_cache` kwarg
    import snowflake.sqlalchemy.snowdialect

    def has_table(self, connection, table_name, schema=None, info_cache=None):
        """
        Checks if the table exists
        """
        return self._has_object(connection, "TABLE", table_name, schema)

    snowflake.sqlalchemy.snowdialect.SnowflakeDialect.has_table = has_table

# usage: call this function before creating an engine:
snowflake_sqlalchemy_20_monkey_patches()

@sfc-gh-aling and snowflake team, for your 2.0 porting efforts, maybe 👆is helpful in assessing the gaps?

cladden avatar Mar 15 '23 20:03 cladden

@sfc-gh-aling Any updates?

rosomri avatar Mar 30 '23 13:03 rosomri

Would love to see support for sqlalchemy 2 in snowflake-sqlalchemy!

cpcloud avatar Mar 30 '23 13:03 cpcloud

@sfc-gh-aling SQLAlchemy 2.0 support was supposedly added last August. Any reason why this still doesn't work 234 days later?

Screenshot 2023-04-14 at 13 51 33

@cladden Your fix has worked wonderfully, so I'm even more confused what's taking so long.

jamesroseman avatar Apr 14 '23 12:04 jamesroseman

@jamesroseman From our Snowflake rep: The August release note was a typo. It should have read,

snowflake-sqlalchemy syntax is now v2.0 compatible

hellobrett avatar Apr 14 '23 17:04 hellobrett

@jamesroseman From our Snowflake rep: The August release note was a typo. It should have read,

snowflake-sqlalchemy syntax is now v2.0 compatible

Funny - at least I am not the only one who was sure that it implied that snowflake-sqlalchemy was ready for sqlalchemy>=2.0.0

Can you at least provide a timeframe for when you expect snowflake-sqlalchemy to be up-to-date with sqlalchemy?

Econ808 avatar Apr 21 '23 11:04 Econ808

Is there a timeframe when sqlalchemy 2.0 will be supported? Still doesn't seem to support it and require sqlalchemy 1.4.

lf-floriandin avatar Aug 01 '23 15:08 lf-floriandin

Any further news on this? We'd love to start using sqlalchemy 2.0 with Snowflake, too.

devholland avatar Aug 23 '23 11:08 devholland

I was curious how close snowflake-sqlalchemy is from supporting sqlalchemy 2.0, so I manually installed it:

pip install --no-deps snowflake-sqlalchemy==1.4.6

It seems very close!

After some monkey-patching, I was able to create an engine and connect to snowflake:

def snowflake_sqlalchemy_20_monkey_patches():
    import sqlalchemy.util.compat

    # make strings always return unicode strings
    sqlalchemy.util.compat.string_types = (str,)
    sqlalchemy.types.String.RETURNS_UNICODE = True

    import snowflake.sqlalchemy.snowdialect

    snowflake.sqlalchemy.snowdialect.SnowflakeDialect.returns_unicode_strings = True

    # make has_table() support the `info_cache` kwarg
    import snowflake.sqlalchemy.snowdialect

    def has_table(self, connection, table_name, schema=None, info_cache=None):
        """
        Checks if the table exists
        """
        return self._has_object(connection, "TABLE", table_name, schema)

    snowflake.sqlalchemy.snowdialect.SnowflakeDialect.has_table = has_table

# usage: call this function before creating an engine:
snowflake_sqlalchemy_20_monkey_patches()

@sfc-gh-aling and snowflake team, for your 2.0 porting efforts, maybe 👆is helpful in assessing the gaps?

I still haven't had any issues with this approach besides the warning about using old dbapi methods.

Thanks

radrichard avatar Aug 23 '23 15:08 radrichard

Bump?

oliverlambson avatar Oct 30 '23 16:10 oliverlambson

Is there any update on supporting SQL-Alchemy >= 2.0?

mikwieczorek avatar Dec 14 '23 13:12 mikwieczorek

Any update on this timeline?

danb27 avatar Jan 09 '24 23:01 danb27

It seems many of us are stuck with dependencies that don't let us downgrade to v1. This has been open for a year now with a pending PR and little to no feedback nor input from Snowflake. What's the hold up? What do we need to do to get it over the finish line?

dominictarro avatar Jan 22 '24 19:01 dominictarro

Latest langchain version also needs sqlalchemy 2.0 to function. It's getting in the way of our OpenAI adoption 😅 Screenshot 2024-02-14 at 4 20 56 PM

juandiegopalomino avatar Feb 15 '24 00:02 juandiegopalomino

Bump.

Can we get an update? This is becoming more and more of a problem.

danb27 avatar Feb 15 '24 00:02 danb27

How do we still have no update???

3065923 avatar Feb 21 '24 15:02 3065923

I'm also very interested in using this package, but can't until a SQLAlchemy2.0 compatible verison is ready.

andrewelamb avatar Feb 26 '24 18:02 andrewelamb

+1 - SQLAlchemy 2 is essential for my project and this is becoming a blocker!

jacobsieradzki avatar Mar 09 '24 04:03 jacobsieradzki

hi folks, first of all thank you everyone so much for bearing with us while the SQLAlchemy 2.0 compatibility is implemented!

I can confirm the implementation is currently in progress and we plan to release it by end of Q1 (April 2024). Please note this is not a committed-to date, just a rough estimation which is subject to change.

Will keep this thread posted on the progress.

sfc-gh-dszmolka avatar Mar 09 '24 09:03 sfc-gh-dszmolka

With the release of Pandas 2.2, please be aware that Pandas seems to require SQLAlchemy 2.0+ with potential that they revert to support SA 1.4 in a later maintenance release. snowflake-sqlalchemy is specificially mentioned as a problem by some users in that it does not support SA 2.0 https://github.com/pandas-dev/pandas/issues/57049

g24swint avatar Mar 18 '24 14:03 g24swint

Is there an ETA of this issue?

YarShev avatar Apr 29 '24 10:04 YarShev

thank you all for your continued patience - no fixed ETA yet, but we're very close to making this available to everyone !

Speaking about which - if you are

  • already a Snowflake customer, with private preview legal documents signed
  • and willing to give the new functionality an early try and also willing to provide detailed feedback please do reach out to your Account Team to take this for a spin.

after this private preview phase closes, we'll release the SQLAlchemy 2.0 support for everyone after such a long wait. Appreciate everyone your patience and bearing with us while the last steps are completed, really should not take much longer.

sfc-gh-dszmolka avatar Apr 29 '24 11:04 sfc-gh-dszmolka