Skip to content

Commit 206e9b9

Browse files
committed
be explicit about sqlite memory uri
1 parent ae15876 commit 206e9b9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

flask_sqlalchemy/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,10 +805,13 @@ def init_app(self, app):
805805
of an application not initialized that way or connections will
806806
leak.
807807
"""
808-
if app.config.get('SQLALCHEMY_DATABASE_URI') is None:
809-
warnings.warn(UserWarning('SQLALCHEMY_DATABASE_URI not set. Defaulting to sqlite.'))
808+
if 'SQLALCHEMY_DATABASE_URI' not in app.config:
809+
warnings.warn(
810+
'SQLALCHEMY_DATABASE_URI not set. Defaulting to '
811+
'"sqlite:///:memory:".'
812+
)
810813

811-
app.config.setdefault('SQLALCHEMY_DATABASE_URI', 'sqlite://')
814+
app.config.setdefault('SQLALCHEMY_DATABASE_URI', 'sqlite:///:memory:')
812815
app.config.setdefault('SQLALCHEMY_BINDS', None)
813816
app.config.setdefault('SQLALCHEMY_NATIVE_UNICODE', None)
814817
app.config.setdefault('SQLALCHEMY_ECHO', False)

0 commit comments

Comments
 (0)