
This weekend @SanMo (original post) started freaking out and reposting the same tweets over and over again. Code superstar Chris Finke wasn’t available to help me track down the issue so I reanimated Chris Nelson for assistance. My initial thought was that Twitter had changed the way it served mentions. retweet.py stores the status_id of each status it retweets in a sqlite database so it doesn’t repeat itself. Browsing the database, I noticed that the two tweets it was repeating were the first with ids above 10 billion (a recent milestone). Chris pointed out that running sqlite> SELECT MAX(status_id) FROM retweets; Returned the id ’9663742534′ and not the true maximum. The table that retweet.py creates has two text columns, one for status_id and one for the timestamp. Changing the status_id column to integer causes MAX() to work properly (I’m not sure what the technical reason behind this failure is). To get retweet.py running again, I did the following (via Chris) from the command line:
# sqlite3 sanmo.sqlite
sqlite> CREATE TABLE retweets2 (status_id INTEGER PRIMARY KEY, timestamp TEXT);
sqlite> INSERT INTO retweets2 SELECT * FROM retweets;
sqlite> DROP TABLE retweets;
sqlite> ALTER TABLE retweets2 RENAME TO retweets;
sqlite> .quit
That will shift all the old data into a new table. The initial database creation routine needs to be fixed in retweet.py and will probably be in version 1.3. The fix above works for me but your mileage may vary.




