-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseed_db.py
36 lines (27 loc) · 869 Bytes
/
seed_db.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
33
34
35
36
from app import app
from database.db import db
from model.detector import Detector
from model.organization import Organization
def seed_db():
with app.app_context():
db.create_all()
# Create Some organizations
organizations = [
Organization(id=1, name='Hunters'),
Organization(id=2, name='Google'),
Organization(id=3, name='Databricks'),
Organization(id=4, name='Amazon')
]
detectors = [
Detector(id=1, name='suspicious_signin'),
Detector(id=2, name='platform_alerts')
]
# Insert organizations
for org in organizations:
db.session.add(org)
# Insert detectors
for detector in detectors:
db.session.add(detector)
db.session.commit()
if __name__ == "__main__":
seed_db()