tests to see if manual flush is useful.

Apparently not !

keep that in mind though.
This commit is contained in:
Julien Lengrand-Lambert
2013-01-04 20:40:01 +01:00
parent 0720c0debf
commit c3bbb84edd
4 changed files with 13 additions and 4 deletions

Binary file not shown.

BIN
twiderboard.db-journal Normal file

Binary file not shown.

View File

@@ -73,7 +73,7 @@ class Counter():
#print "Error, can't get more than one member. Exiting"
raise ElementException # FIXME : Take care
self.flush()
#self.flush()
except ElementException:
print "Exception on %s " % (tweet)
@@ -120,11 +120,20 @@ class Counter():
Returns the number of Members in table
"""
self.member_count()
query = self.session.query(Member).order_by(Member.id).all()
print "Members: %d" % (len(query))
for q in query:
print q
def member_count(self):
"""
debug
Returns the number of Members in table
"""
query = self.session.query(Member).order_by(Member.id).all()
print "Members: %d" % (len(query))
def flush(self):
"""
Flushes data to db if enough data has to be updated
@@ -148,4 +157,5 @@ class ElementException(Exception):
c = Counter(engine_url)
c.count()
#c.member_show()
c.member_count()
c.member_show()

View File

@@ -124,7 +124,6 @@ class Tweet(Base):
return (len(self.hashtag) != 0 and self.hashtag is not None)
def __repr__(self):
# FIXME: Solve this!
try:
return "<%s('%s','%s', '%s')>" % (self.author.encode('utf-8'), self.created.encode('utf-8'), self.hashtag.encode('utf-8'), self.text.encode('utf-8'))
except UnicodeDecodeError: