twitools/makedb.py

20 lines
670 B
Python
Raw Normal View History

2015-04-13 20:58:32 +00:00
#!/usr/bin/env python3
2015-03-09 17:32:24 +00:00
import dbtools
2015-03-09 17:32:24 +00:00
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));")
2015-04-14 14:27:08 +00:00
db.commit()
db.closeConnection()
2015-04-14 14:27:08 +00:00
if __name__ == "__main__":
2015-04-21 22:42:20 +00:00
if len(sys.argv) > 2:
raise ValueError(sys.argv[0] + " only takes one argument, the path of the new database file.")
2015-04-14 14:27:08 +00:00
try:
makeDB(dbtools.dbObject(path=sys.argv[1]))
2015-04-14 14:27:08 +00:00
except IndexError:
makeDB()