Skip to content

Commit

Permalink
Twitter: Avoid duplicate primary key at database level
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilhem Saurel committed Mar 25, 2016
1 parent 196368e commit d7f13b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions twitter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ def already_said(id):
self.bot.say({'text': text, 'xhtml': xhtml})
tweets.add(tweet['id'])
last_tweet.last = timeline[0]['id']
for tweet in tweets - set(t[0] for t in self.bot.session.query(LastTweets.last).all()):
self.bot.session.add(Tweets(id=tweet))
for tweet in tweets:
self.bot.session.merge(Tweets(id=tweet))
self.bot.session.commit()

0 comments on commit d7f13b3

Please sign in to comment.