I believe this started happening when I upgraded to 1.3.4. Every time I run my code I now get this output:
sqlalchemy/sql/functions.py:68: SAWarning: The GenericFunction 'array_agg' is already registered and is going to be overriden.
"is going to be overriden.".format(identifier))
May be related to #4569? Unsure. I don't think it's a problem it's just annoying to have a warning come up constantly. Is there something I need to do to fix this?
that is absolutely #4569 which added that warning.
However I cannot reproduce your issue. Can you please provide a stack trace (set warnings filter to "error") if not a reproduction case? are you doing something strange with imports ?
basically if you wanted to reproduce this, your program woudl somewhere be calling upon two different "array_agg" functions both descending from GenericFunction. are you using the array_agg function or this just happened to be popping up without your dealing with it? are you using the postgresql dialect ?
This is using MySQL and actually being setup via Flask-SQLAlchemy, not directly.
I changed warnings to errors to get the stack trace and it looks like sqlalchemy-utils is redeclaring array_agg. It actually looks like someone already opened this as an issue with them (https://github.com/kvesteri/sqlalchemy-utils/issues/374) so I'll watch that. Thank you!
FYI
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/dylan/projects/cloud/simc-server/spotr_server/__main__.py", line 10, in <module>
from spotr_server.controllers import init_app
File "/Users/dylan/projects/cloud/simc-server/spotr_server/controllers/__init__.py", line 5, in <module>
from .utility import controller, root_blueprint
File "/Users/dylan/projects/cloud/simc-server/spotr_server/controllers/utility.py", line 18, in <module>
from spotr_server import models
File "/Users/dylan/projects/cloud/simc-server/spotr_server/models/__init__.py", line 5, in <module>
from .battery_history import BatteryHistory
File "/Users/dylan/projects/cloud/simc-server/spotr_server/models/battery_history.py", line 3, in <module>
from sqlalchemy_utils import ChoiceType
File "/Users/dylan/projects/cloud/simc-server/.venv/lib/python3.6/site-packages/sqlalchemy_utils/__init__.py", line 1, in <module>
from .aggregates import aggregated # noqa
File "/Users/dylan/projects/cloud/simc-server/.venv/lib/python3.6/site-packages/sqlalchemy_utils/aggregates.py", line 372, in <module>
from .functions.orm import get_column_key
File "/Users/dylan/projects/cloud/simc-server/.venv/lib/python3.6/site-packages/sqlalchemy_utils/functions/__init__.py", line 1, in <module>
from .database import ( # noqa
File "/Users/dylan/projects/cloud/simc-server/.venv/lib/python3.6/site-packages/sqlalchemy_utils/functions/database.py", line 10, in <module>
from ..expressions import explain_analyze
File "/Users/dylan/projects/cloud/simc-server/.venv/lib/python3.6/site-packages/sqlalchemy_utils/expressions.py", line 115, in <module>
class array_agg(GenericFunction):
File "/Users/dylan/projects/cloud/simc-server/.venv/lib/python3.6/site-packages/sqlalchemy/sql/functions.py", line 644, in __init__
register_function(identifier, cls, package)
File "/Users/dylan/projects/cloud/simc-server/.venv/lib/python3.6/site-packages/sqlalchemy/sql/functions.py", line 68, in register_function
"is going to be overriden.".format(identifier))
File "/Users/dylan/projects/cloud/simc-server/.venv/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 1421, in warn
warnings.warn(msg, exc.SAWarning, stacklevel=2)
sqlalchemy.exc.SAWarning: The GenericFunction 'array_agg' is already registered and is going to be overriden.
yep this here https://github.com/kvesteri/sqlalchemy-utils/blob/master/sqlalchemy_utils/expressions.py#L115 is that warning doing what it's supposed to
Most helpful comment
yep this here https://github.com/kvesteri/sqlalchemy-utils/blob/master/sqlalchemy_utils/expressions.py#L115 is that warning doing what it's supposed to