2015-04-13 20:58:32 +00:00
|
|
|
#!/usr/bin/env python3
|
2015-03-09 17:32:24 +00:00
|
|
|
|
2016-05-30 18:40:21 +00:00
|
|
|
import dbtools
|
2015-03-09 17:32:24 +00:00
|
|
|
|
2015-04-21 21:07:25 +00:00
|
|
|
import sys
|
|
|
|
|
2016-05-30 18:40:21 +00:00
|
|
|
def makeDB(db=dbtools.dbObject()):
|
2015-04-21 21:07:25 +00:00
|
|
|
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
|
|
|
|
2015-04-21 21:07:25 +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:
|
2016-05-30 18:40:21 +00:00
|
|
|
makeDB(dbtools.dbObject(path=sys.argv[1]))
|
2015-04-14 14:27:08 +00:00
|
|
|
except IndexError:
|
|
|
|
makeDB()
|