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

Add support for marshmallow-sqlalchemy 1.0.0 #2194

Open
AlphaJack opened this issue Feb 9, 2024 · 4 comments
Open

Add support for marshmallow-sqlalchemy 1.0.0 #2194

AlphaJack opened this issue Feb 9, 2024 · 4 comments

Comments

@AlphaJack
Copy link

Environment

pip-freeze:

Flask==2.3.3
Flask-AppBuilder==4.3.11
flask-babel==3.1.0
Flask-Caching==2.0.2
Flask-Compress==1.14
Flask-JWT-Extended==4.5.3
Flask-Limiter==3.5.0
Flask-Login==0.6.3
Flask-Migrate==4.0.5
Flask-OpenID==1.3.0
Flask-Session==0.6.0
Flask-Sockets==0.2.1
Flask-SQLAlchemy==2.5.1
flask-talisman==1.1.0
Flask-WTF==1.1.1
marshmallow==3.20.0
marshmallow-sqlalchemy==1.0.0

Describe the expected results

I am getting a TypeError during the initialization of an app that loads Flask-AppBuilder (see below).

I have tried both marshmallow-sqlalchemy 1.0.0, 0.30 and 0.26, but all of them returns the same results.

I am not sure the error involves Flask-AppBuilder directly, but I wanted to check why there is no support for the latest version of marshmallow-sqlalchemy.

Describe the actual results

When launching the app, I get

Traceback (most recent call last):
  File "/usr/bin/superset", line 5, in <module>
    from superset.cli.main import superset
  File "/usr/lib/python3.11/site-packages/superset/__init__.py", line 21, in <module>
    from superset.app import create_app
  File "/usr/lib/python3.11/site-packages/superset/app.py", line 24, in <module>
    from superset.initialization import SupersetAppInitializer
  File "/usr/lib/python3.11/site-packages/superset/initialization/__init__.py", line 28, in <module>
    from flask_appbuilder import expose, IndexView
  File "/usr/lib/python3.11/site-packages/flask_appbuilder/__init__.py", line 5, in <module>
    from .api import ModelRestApi  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/flask_appbuilder/api/__init__.py", line 29, in <module>
    from marshmallow_sqlalchemy.fields import Related, RelatedList
  File "/usr/lib/python3.11/site-packages/marshmallow_sqlalchemy/__init__.py", line 1, in <module>
    from .schema import (
  File "/usr/lib/python3.11/site-packages/marshmallow_sqlalchemy/schema.py", line 143, in <module>
    class SQLAlchemySchema(
  File "/usr/lib/python3.11/site-packages/marshmallow/schema.py", line 116, in __new__
    klass._declared_fields = mcs.get_declared_fields(
                             ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: SQLAlchemySchemaMeta.get_declared_fields() missing 1 required positional argument: 'dict_cls'

Steps to reproduce

on Arch Linux/Manjaro: yay -S superset && superset --help

@sloria
Copy link
Contributor

sloria commented Jan 8, 2025

This also prevents Flask-Appbuilder from being compatible with marshmallow>=3.24.0, which caused a regression in Airflow. See apache/airflow#45442 (comment)

@sloria
Copy link
Contributor

sloria commented Jan 8, 2025

@AlphaJack actually, the error you're seeing was fixed in marshmallow 3.20.1. so you should be able to update your marshmallow version to resolve that.

Flask-Appbuilder should still support newer versions of marshmallow-sqlalchemy (this will fix the Airflow issue), which i think is just a matter of relaxing the version constraint here:

"marshmallow-sqlalchemy>=0.22.0, <0.29.0",

that should be changed to either "marshmallow-sqlalchemy>=0.22.0, <2.0.0" or "marshmallow-sqlalchemy>=0.22.0".

@dpgaspar can you please make this change? i was going to send a PR but i've been having issues getting my development environment working (pip-compile isn't cooperating 😕 )

@sloria
Copy link
Contributor

sloria commented Jan 8, 2025

sent #2298

@potiuk
Copy link
Contributor

potiuk commented Jan 8, 2025

Nice one !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants