unknow bug in Mac OS: Stream process die after db is truncated
authorOrakaro <nhatminh_179@hotmail.com>
Wed, 28 May 2014 15:52:44 +0000 (00:52 +0900)
committerOrakaro <nhatminh_179@hotmail.com>
Wed, 28 May 2014 15:52:44 +0000 (00:52 +0900)
rainbowstream/db.py
rainbowstream/rainbow.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
index 3a558e0d7e57f608d0637b3945f94c63b77f41d7..53c002fbee7239dbec8f3282a0fdd0693f520092 100644 (file)
@@ -322,7 +322,7 @@ def quit():
     """
     Exit all
     """
-    db.truncate()
+    os.system('rm -rf rainbow.db')
     os.kill(g['stream_pid'], signal.SIGKILL)
     sys.exit()