mirror of
https://github.com/skylanix/MamieHenriette.git
synced 2026-02-06 14:50:34 +01:00
17 lines
417 B
Python
17 lines
417 B
Python
from flask_sqlalchemy import SQLAlchemy
|
|
from webapp import webapp
|
|
|
|
webapp.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
|
|
db = SQLAlchemy(webapp)
|
|
|
|
with webapp.app_context():
|
|
with open('database/schema.sql', 'r') as f:
|
|
sql = f.read()
|
|
connection = db.session.connection().connection
|
|
try:
|
|
cursor = connection.cursor()
|
|
cursor.executescript(sql)
|
|
cursor.close()
|
|
finally:
|
|
connection.close()
|