-
Notifications
You must be signed in to change notification settings - Fork 1
/
database_orm.py
32 lines (29 loc) · 1.14 KB
/
database_orm.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 sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy import Column, String, Integer,Float,ForeignKey,DateTime
from datetime import datetime
from sqlalchemy.ext.declarative import declarative_base
Base=declarative_base()
class BoardData(Base):
__tablename__="board"
board_id =Column(Integer,primary_key=True)
board_name=Column(String)
created_date=Column(DateTime,default=datetime.utcnow)
updated_date=Column(DateTime,default=datetime.utcnow)
class ListItems():
__tablename__="task_list"
list_id =Column(Integer,primary_key=True)
list_name=Column(String)
board=(String,ForeignKey('Board.id'))
created_date=Column(DateTime,default=datetime.utcnow)
updated_date=Column(DateTime,default=datetime.utcnow)
class Taskcard():
__tablename__="task_items"
task_id =Column(Integer,primary_key=True)
card_name=Column(String)
created_date=Column(DateTime,default=datetime.utcnow)
updated_date=Column(DateTime,default=datetime.utcnow)
list=(String,ForeignKey('list.id'))
if __name__ == "__main__":
engine = create_engine('sqlite:///trolly.sqlite3')
Base.metadata.create_all(engine)