You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
857 B
Python
35 lines
857 B
Python
#!/usr/bin/python
|
|
# -*- coding: UTF-8 -*-
|
|
|
|
"""
|
|
Authors : Jean-Damien Généro
|
|
Affiliation : French National Center for Scientific Research (CNRS)
|
|
Assigned at the Centre de recherches historiques (CRH, UMR 8558)
|
|
Date : 2022-10-11
|
|
Update :
|
|
"""
|
|
|
|
|
|
from peewee import *
|
|
from tqdm import tqdm
|
|
|
|
from modeles.princes_db_tables import db, Institution, State, Place, Diplo_type, Document, Acte
|
|
|
|
from data.institution_data import institution
|
|
|
|
|
|
def _create_institution(data_lst: list)-> None:
|
|
for data in tqdm(data_lst, desc="Populating Institution..."):
|
|
Institution.create(**data)
|
|
|
|
|
|
def init():
|
|
db.connect()
|
|
print("Dropping existing DB...")
|
|
db.drop_tables([Institution, State, Place, Diplo_type, Document, Acte])
|
|
print("Re-creating schema...")
|
|
db.create_tables([Institution, State, Place, Diplo_type, Document, Acte])
|
|
_create_institution(institution)
|
|
|
|
init()
|