-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_database.py
More file actions
30 lines (23 loc) · 843 Bytes
/
Copy pathcreate_database.py
File metadata and controls
30 lines (23 loc) · 843 Bytes
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
# -*- coding: utf-8 -*-
"""
Script to create blank database of "Big 5" and "Other FBS" schools
Project page: https://github.com/inkjet/FBS_Power5
Author: Scott Rodkey, rodkeyscott@gmail.com
"""
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
import os
Base = declarative_base()
db_folder = os.getcwd() + '/FBS_schools.db'
db_location = 'sqlite:///' + db_folder
class School(Base):
__tablename__ = 'school'
id = Column(Integer, primary_key=True)
name = Column(String(100), default="Not Set", nullable=False)
isPowerFive = Column(Integer, default=1, nullable=False)
def create_db():
engine = create_engine(db_location)
Base.metadata.create_all(engine)
print('School database created at %s' % db_folder)
print(' ')