-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.py
More file actions
48 lines (37 loc) · 1.38 KB
/
Copy pathmodel.py
File metadata and controls
48 lines (37 loc) · 1.38 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine, Column, String, BLOB
__DB_NAME = 'github_status.db'
engine = create_engine('sqlite:///' + __DB_NAME, echo=True)
Session = sessionmaker(bind=engine)
session = Session()
Base = declarative_base()
defaut_value: str = 'default'
'''
class Status(Base):
__tablename__ = 'status'
id = Column(BLOB, primary_key=True)
actor = Column(BLOB, default=defaut_value)
org = Column(BLOB, default=defaut_value)
created_at = Column(BLOB, default=defaut_value)
payload = Column(BLOB, default=defaut_value)
public = Column(BLOB, default=defaut_value)
repo = Column(BLOB, default=defaut_value)
type = Column(BLOB, default=defaut_value)
'''
class Status(Base):
__tablename__ = 'status'
id = Column(String, primary_key=True)
actor = Column(String, default=defaut_value)
org = Column(String, default=defaut_value)
created_at = Column(String, default=defaut_value)
payload = Column(String, default=defaut_value)
public = Column(String, default=defaut_value)
repo = Column(String, default=defaut_value)
type = Column(String, default=defaut_value)
class Client(Base):
__tablename__ = 'client'
id = Column(String, primary_key=True)
name = Column(String)
mail = Column(String)
Base.metadata.create_all(engine)