Skip to content

Commit bc5757f

Browse files
authored
Bump flask-sqlalchemy to 3.0.2 (#28)
1 parent 390262f commit bc5757f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

examples/flask/app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
from sqlalchemy_file.storage import StorageManager
1515
from sqlalchemy_file.validators import ContentTypeValidator, SizeValidator
1616

17+
db = SQLAlchemy(engine_options={"echo": True})
1718
app = Flask(__name__)
1819
app.config[
1920
"SQLALCHEMY_DATABASE_URI"
2021
] = "sqlite:////tmp/example.db?check_same_thread=False"
21-
db = SQLAlchemy(app, engine_options={"echo": True})
22+
db.init_app(app)
2223

2324

2425
class Book(db.Model):
@@ -120,5 +121,6 @@ def serve_files(storage, file_id):
120121
"documents", driver.get_container(container_name="documents")
121122
)
122123

123-
db.create_all()
124+
with app.app_context():
125+
db.create_all()
124126
app.run(debug=True)

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ apache-libcloud = ">=3.6.0,<3.7"
3535
pytest = "^7.2.0"
3636
mypy = "0.991"
3737
black = "22.10.0"
38-
ruff = "0.0.143"
38+
ruff = "0.0.146"
3939
sqlmodel = "^0.0.8"
4040
Pillow = "^9.3.0"
4141
fasteners = "^0.18"
@@ -44,12 +44,11 @@ mkdocs-material = "^8.5.10"
4444
PyMySQL = { extras = ["rsa"], version = "^1.0.2" }
4545
psycopg2-binary = "^2.9.5"
4646
mkdocstrings = { extras = ["python"], version = "^0.19.0" }
47-
fastapi = "^0.87.0"
47+
fastapi = "^0.88.0"
4848
uvicorn = "^0.20.0"
4949
python-multipart = "^0.0.5"
5050
Flask = "^2.2.2"
51-
Flask-SQLAlchemy = "^2.5.1"
52-
importlib-metadata = { version = "<5.0", python = "<=3.7" }
51+
Flask-SQLAlchemy = "^3.0.2"
5352

5453

5554
[tool.coverage.report]

0 commit comments

Comments
 (0)