unknow bug in Mac OS: Stream process die after db is truncated
[rainbowstream.git] / rainbowstream / db.py
index ce299c9559f7e219c75118ba8135cd6b57c88e10..cac9a73d6a62dd0f05ab45cea3afa1520891561e 100644 (file)
@@ -30,7 +30,7 @@ class RainbowDB():
         """
         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):
@@ -39,14 +39,5 @@ class RainbowDB():
         """
         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