fixed typo + data table drop at script launch
This commit is contained in:
parent
8033002eea
commit
4e43ba853e
@ -1,5 +1,5 @@
|
|||||||
from tables import Answer
|
from tables import Answer
|
||||||
|
|
||||||
ANSWER = [
|
ANSWERS = [
|
||||||
|
|
||||||
]
|
]
|
@ -4,7 +4,7 @@ from sqlalchemy import engine as eg
|
|||||||
|
|
||||||
from tables import *
|
from tables import *
|
||||||
|
|
||||||
from data.answer import ANSWER
|
from data.answer import ANSWERS
|
||||||
from data.locales import LOCALES
|
from data.locales import LOCALES
|
||||||
from data.npc import NPCS
|
from data.npc import NPCS
|
||||||
from data.places import PLACES
|
from data.places import PLACES
|
||||||
@ -22,24 +22,55 @@ url_object = eg.URL.create(
|
|||||||
port=6776,
|
port=6776,
|
||||||
database="truthInquiry",
|
database="truthInquiry",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create Engine and tables
|
|
||||||
engine = create_engine(url_object)
|
engine = create_engine(url_object)
|
||||||
Base.metadata.create_all(engine)
|
|
||||||
|
|
||||||
|
|
||||||
|
# Reset data tables
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
|
|
||||||
|
|
||||||
|
session.execute("SELECT CONCAT('DROP TABLE IF EXISTS `', TABLE_SCHEMA, '`.`', TABLE_NAME, '`;') FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'mydb'")
|
||||||
|
Base.metadata.create_all(engine)
|
||||||
|
|
||||||
print("adding locales")
|
print("adding locales")
|
||||||
|
for locale in LOCALES:
|
||||||
|
print(locale)
|
||||||
session.add_all(LOCALES)
|
session.add_all(LOCALES)
|
||||||
|
|
||||||
|
|
||||||
print("adding places")
|
print("adding places")
|
||||||
|
for place in PLACES:
|
||||||
|
print(place)
|
||||||
session.add_all(PLACES)
|
session.add_all(PLACES)
|
||||||
|
|
||||||
|
|
||||||
print("adding NPCS")
|
print("adding NPCS")
|
||||||
|
for npc in NPCS:
|
||||||
|
print(npc)
|
||||||
session.add_all(NPCS)
|
session.add_all(NPCS)
|
||||||
|
|
||||||
|
|
||||||
print("adding trait")
|
print("adding trait")
|
||||||
|
for trait in TRAITS:
|
||||||
|
print(trait)
|
||||||
session.add_all(TRAITS)
|
session.add_all(TRAITS)
|
||||||
|
|
||||||
|
|
||||||
print("adding questions")
|
print("adding questions")
|
||||||
|
for question in QUESTIONS:
|
||||||
|
print(question)
|
||||||
session.add_all(QUESTIONS)
|
session.add_all(QUESTIONS)
|
||||||
|
|
||||||
|
|
||||||
print("adding answers")
|
print("adding answers")
|
||||||
session.add_all(ANSWER)
|
for answer in ANSWERS:
|
||||||
print("adding reaction")
|
print(answer)
|
||||||
|
session.add_all(ANSWERS)
|
||||||
|
|
||||||
|
|
||||||
|
print("adding reactions")
|
||||||
|
for reactions in REACTIONS:
|
||||||
|
print(reactions)
|
||||||
session.add_all(REACTIONS)
|
session.add_all(REACTIONS)
|
||||||
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
Loading…
Reference in New Issue
Block a user