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

feat: SQLAlchemy 1.4 support #1783

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flask_appbuilder/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def create_db():
"""
from flask_appbuilder.models.sqla import Model

engine = current_app.appbuilder.get_session.get_bind(mapper=None, clause=None)
engine = current_app.appbuilder.get_session.get_bind()
Model.metadata.create_all(engine)
click.echo(click.style("DB objects created", fg="green"))

Expand Down
2 changes: 1 addition & 1 deletion flask_appbuilder/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def create_db(app, appbuilder):
from flask_appbuilder.models.sqla import Base

_appbuilder = import_application(app, appbuilder)
engine = _appbuilder.get_session.get_bind(mapper=None, clause=None)
engine = _appbuilder.get_session.get_bind()
Base.metadata.create_all(engine)
click.echo(click.style("DB objects created", fg="green"))

Expand Down
2 changes: 1 addition & 1 deletion flask_appbuilder/security/sqla/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def register_views(self):

def create_db(self):
try:
engine = self.get_session.get_bind(mapper=None, clause=None)
engine = self.get_session.get_bind()
inspector = Inspector.from_engine(engine)
if "ab_user" not in inspector.get_table_names():
log.info(c.LOGMSG_INF_SEC_NO_DB)
Expand Down
2 changes: 1 addition & 1 deletion flask_appbuilder/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def update(self):

def tearDown(self):
self.appbuilder.get_session.close()
engine = self.db.session.get_bind(mapper=None, clause=None)
engine = self.db.session.get_bind()
engine.dispose()

def test_babel(self):
Expand Down
2 changes: 1 addition & 1 deletion flask_appbuilder/tests/test_mvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ def test_model_creation(self):
"""
from sqlalchemy.engine.reflection import Inspector

engine = self.db.session.get_bind(mapper=None, clause=None)
engine = self.db.session.get_bind()
inspector = Inspector.from_engine(engine)
# Check if tables exist
self.assertIn("model1", inspector.get_table_names())
Expand Down
27 changes: 15 additions & 12 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
apispec[yaml]==3.3.2
# via Flask-AppBuilder (setup.py)
attrs==21.2.0
attrs==21.4.0
# via jsonschema
babel==2.9.1
# via flask-babel
Expand Down Expand Up @@ -43,10 +43,14 @@ flask-sqlalchemy==2.5.1
# via Flask-AppBuilder (setup.py)
flask-wtf==0.14.3
# via Flask-AppBuilder (setup.py)
idna==3.2
greenlet==1.1.2
# via sqlalchemy
idna==3.3
# via email-validator
importlib-metadata==4.8.1
# via jsonschema
importlib-metadata==4.10.0
# via
# jsonschema
# sqlalchemy
itsdangerous==1.1.0
# via
# flask
Expand All @@ -61,7 +65,7 @@ markupsafe==2.0.1
# via
# jinja2
# wtforms
marshmallow==3.13.0
marshmallow==3.14.1
# via
# Flask-AppBuilder (setup.py)
# marshmallow-enum
Expand All @@ -82,11 +86,11 @@ python-dateutil==2.8.2
# via Flask-AppBuilder (setup.py)
python3-openid==3.2.0
# via flask-openid
pytz==2021.1
pytz==2021.3
# via
# babel
# flask-babel
pyyaml==5.4.1
pyyaml==6.0
# via apispec
six==1.16.0
# via
Expand All @@ -95,15 +99,14 @@ six==1.16.0
# prison
# python-dateutil
# sqlalchemy-utils
sqlalchemy==1.3.24
sqlalchemy==1.4.29
# via
# Flask-AppBuilder (setup.py)
# flask-sqlalchemy
# marshmallow-sqlalchemy
# sqlalchemy-utils
sqlalchemy-utils==0.37.8
sqlalchemy-utils==0.38.2
# via Flask-AppBuilder (setup.py)
typing-extensions==3.10.0.2
typing-extensions==4.0.1
# via importlib-metadata
werkzeug==1.0.1
# via
Expand All @@ -113,7 +116,7 @@ wtforms==2.3.3
# via
# Flask-AppBuilder (setup.py)
# flask-wtf
zipp==3.5.0
zipp==3.7.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ def desc():
"Flask-Babel>=1, <3",
"Flask-Login>=0.3, <0.5",
"Flask-OpenID>=1.2.5, <2",
# SQLAlchemy 1.4.0 breaks flask-sqlalchemy and sqlalchemy-utils
"SQLAlchemy<1.4.0",
"Flask-SQLAlchemy>=2.4, <3",
"Flask-WTF>=0.14.2, <0.15.0",
"Flask-JWT-Extended>=3.18, <4",
Expand Down