1 from sqlalchemy
import *
2 from sqlalchemy
.ext
.declarative
import declarative_base
4 engine
= create_engine('sqlite:///rainbow.db', echo
=False)
5 Base
= declarative_base()
10 __tablename__
= "tweet"
12 rainbow_id
= Column(Integer
, primary_key
=True)
13 tweet_id
= Column(Integer
)
15 def __init__(self
, tweet_id
):
16 self
.tweet_id
= tweet_id
21 __tablename__
= "message"
23 rainbow_id
= Column(Integer
, primary_key
=True)
24 message_id
= Column(Integer
)
26 def __init__(self
, message_id
):
27 self
.message_id
= message_id
32 __tablename__
= "theme"
34 theme_id
= Column(Integer
, primary_key
=True)
35 theme_name
= Column(String(20))
37 def __init__(self
, theme_name
):
38 self
.theme_name
= theme_name
42 Base
.metadata
.create_all(engine
)