from table_def import Map
from .table_def import *
+
class RainbowDB():
- engine=None
+ engine = None
def __init__(self):
if not os.path.isfile('rainbow.db'):
"""
Session = sessionmaker(bind=self.engine)
session = Session()
- res = session.query(Map).filter("rainbow_id =:rid").params(rid=rid).all()
+ res = session.query(Map).filter_by(rainbow_id=rid).all()
return res
def tweet_query(self, tid):
"""
Session = sessionmaker(bind=self.engine)
session = Session()
- res = session.query(Map).filter("tweet_id =:tid").params(tid=tid).all()
- return res
-
- def truncate(self):
- """
- Truncate table
- """
- Session = sessionmaker(bind=self.engine)
- session = Session()
- session.query(Map).delete()
- session.commit()
+ res = session.query(Map).filter_by(tweet_id=tid).all()
+ return res
\ No newline at end of file