-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.py
33 lines (28 loc) · 841 Bytes
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
from config.log_config import log
from models.database import *
from utils.database_config import database
if __name__ == "__main__":
directory = os.path.dirname(os.path.abspath(__file__))
log.info("Start PUBG BOT's Setup")
# Database
engine = create_engine(
"mysql+pymysql://{username}:{password}@{host}:{port}/{database}".format(
**database
)
)
with Session(engine) as session:
for table in [
CurrentSeasonInfo,
FavoritePlayer,
MatchesPlayer,
NormalStats,
OnlinePlayer,
Player,
RankedStats
]:
table.__base__.metadata.create_all(session.bind)
session.commit()
engine.dispose()