twitools/makedb.py
Klaus-Uwe Mitterer aad1531392 Futher preparation for MySQL, which is not working yet though...
Make filler handle direct messages
Add table and functions for direct messages
2016-06-30 12:33:09 +02:00

19 lines
670 B
Python
Executable file

#!/usr/bin/env python3
import dbtools
import sys
def makeDB(db=dbtools.dbHelper()):
db.executeQuery("CREATE TABLE tweets(`tweet_id` INTEGER NOT NULL, `in_reply_to_status_id` TEXT, `in_reply_to_user_id` TEXT, `timestamp` TEXT, `source` TEXT, `text` TEXT, `retweeted_status_id` TEXT, `retweeted_status_user_id` TEXT, `retweeted_status_timestamp` TEXT, `expanded_urls` TEXT, PRIMARY KEY(tweet_id));")
db.commit()
db.closeConnection()
if __name__ == "__main__":
if len(sys.argv) > 2:
raise ValueError(sys.argv[0] + " only takes one argument, the path of the new database file.")
try:
makeDB(dbtools.dbObject(path=sys.argv[1]))
except IndexError:
makeDB()