Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop SQLAlchemy warnings about registering 'flatten' twice #521

Closed

Conversation

saulbein
Copy link
Contributor

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.

@saulbein saulbein requested a review from a team as a code owner July 11, 2024 09:39
@jordantshaw
Copy link

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

@AsimAbidi
Copy link

AsimAbidi commented Oct 16, 2024

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

@sfc-gh-dszmolka
Copy link
Contributor

i see another PR going (#532) which is also already merged and awaiting release, which hopefully helps with the issue

@saulbein saulbein closed this Oct 17, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants