snowflake-sqlalchemy: 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.

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?

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 36
  • Comments: 28

Most upvoted comments

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.

@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?

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

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

Bump.

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

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

snowflake-sqlalchemy syntax is now v2.0 compatible

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?

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?

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

Do you have an estimated release timeframe for this?

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

@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.

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

How do we still have no update???

Any update on this timeline?

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

@sfc-gh-aling Any updates?