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 ce299c9..cac9a73 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 3a558e0..53c002f 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()