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

SQLAlchemy.__repr__ raises KeyError when the default engine is not set. #1295

Open
FossenWang opened this issue Dec 27, 2023 · 1 comment · Fixed by #1296
Open

SQLAlchemy.__repr__ raises KeyError when the default engine is not set. #1295

FossenWang opened this issue Dec 27, 2023 · 1 comment · Fixed by #1296
Assignees

Comments

@FossenWang
Copy link

from flask import Flask
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()
app = Flask(__name__)
app.config['SQLALCHEMY_BINDS'] = {'x': 'sqlite:///:memory:'}

db.init_app(app)
with app.app_context():
    print(db)

# KeyError: None

Environment:

  • Python version: 3.9.12
  • Flask-SQLAlchemy version: 3.0.3
  • SQLAlchemy version: 2.0.22
@pamelafox pamelafox self-assigned this Dec 27, 2023
@pamelafox pamelafox mentioned this issue Dec 27, 2023
6 tasks
@pamelafox
Copy link
Contributor

Thanks for the report! I've proposed a fix at https://github.com/pallets-eco/flask-sqlalchemy/pull/1296/files

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

Successfully merging a pull request may close this issue.

2 participants