mirror of
https://github.com/skylanix/MamieHenriette.git
synced 2026-02-06 23:10:36 +01:00
Création d'une page de gestion des humeurs
This commit is contained in:
@@ -6,7 +6,12 @@ webapp.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
|
||||
db = SQLAlchemy(webapp)
|
||||
|
||||
with webapp.app_context():
|
||||
with open('database/schema.sql', 'r') as f:
|
||||
sql_script = f.read()
|
||||
db.session.execute(text(sql_script))
|
||||
db.session.commit()
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user