snowflakedb / snowflake-sqlalchemy

Snowflake SQLAlchemy
https://pypi.python.org/pypi/snowflake-sqlalchemy/
Apache License 2.0
233 stars 152 forks source link

Stop SQLAlchemy warnings about registering 'flatten' twice #521

Closed saulbein closed 1 month ago

saulbein commented 4 months ago

Please answer these questions before submitting your pull requests. Thanks!

  1. What issue is this PR addressing?

    When loading snowflake-sqlalchemy==1.6.1 a warning is emitted about the flatten function being registered multiple times. It causes confusion as it's we had to check that our code wasn't overriding the function, while in reality it's snowflake-sqlalchemy registering it twice.

  2. Fill out the following pre-review checklist:

    • [ ] I am adding a new automated test(s) to verify correctness of my new code
    • [ ] I am adding new logging messages
    • [ ] I am adding new credentials
    • [ ] I am adding a new dependency
  3. Please describe how your code solves the related issue.

    As noted in SQLAlchemy documentation:

    Subclasses of GenericFunction are automatically registered under the name of the class.

    Which in this case means that current code is registering the function twice - once on class import time and another by explicitly calling register_function. This PR removes the explicit registration and pushes the class import to be executed immediately when importing the library.

jordantshaw commented 3 months ago

I am also getting this warning. Can someone from this snowflake team please review and merge this?

AsimAbidi commented 1 month ago

Hello, I am getting this warning as well. Can someone please review and merge this?

sfc-gh-dszmolka commented 1 month ago

i see another PR going (https://github.com/snowflakedb/snowflake-sqlalchemy/pull/532) which is also already merged and awaiting release, which hopefully helps with the issue