Commit 63600485 authored by Cody Zacharias's avatar Cody Zacharias Committed by GitHub

Update spacing / Add values

parent bbe48859
...@@ -21,9 +21,12 @@ def init(db): ...@@ -21,9 +21,12 @@ def init(db):
retweets integer, retweets integer,
hashtags text, hashtags text,
link text link text
retweet bool,
user_rt text
); );
""" """
cursor.execute(table_tweets) cursor.execute(table_tweets)
table_users = """ table_users = """
CREATE TABLE IF NOT EXISTS CREATE TABLE IF NOT EXISTS
users ( users (
...@@ -34,6 +37,7 @@ def init(db): ...@@ -34,6 +37,7 @@ def init(db):
); );
""" """
cursor.execute(table_users) cursor.execute(table_users)
table_search = """ table_search = """
CREATE TABLE IF NOT EXISTS CREATE TABLE IF NOT EXISTS
searches ( searches (
...@@ -45,6 +49,7 @@ def init(db): ...@@ -45,6 +49,7 @@ def init(db):
); );
""" """
cursor.execute(table_search) cursor.execute(table_search)
table_followers = """ table_followers = """
CREATE TABLE IF NOT EXISTS CREATE TABLE IF NOT EXISTS
followers ( followers (
...@@ -55,6 +60,7 @@ def init(db): ...@@ -55,6 +60,7 @@ def init(db):
); );
""" """
cursor.execute(table_followers) cursor.execute(table_followers)
table_following = """ table_following = """
CREATE TABLE IF NOT EXISTS CREATE TABLE IF NOT EXISTS
following ( following (
...@@ -65,6 +71,7 @@ def init(db): ...@@ -65,6 +71,7 @@ def init(db):
); );
""" """
cursor.execute(table_following) cursor.execute(table_following)
return conn return conn
except Exception as e: except Exception as e:
return str(e) return str(e)
...@@ -95,17 +102,17 @@ def tweets(conn, Tweet): ...@@ -95,17 +102,17 @@ def tweets(conn, Tweet):
entry = (Tweet.id, entry = (Tweet.id,
Tweet.user_id, Tweet.user_id,
Tweet.datestamp, Tweet.datestamp,
Tweet.timestamp,
Tweet.timezone, Tweet.timezone,
Tweet.location, Tweet.location,
Tweet.username, Tweet.username,
Tweet.tweet, Tweet.tweet,
Tweet.replies,
Tweet.likes, Tweet.likes,
Tweet.retweets, Tweet.retweets,
",".join(Tweet.hashtags), ",".join(Tweet.hashtags),
Tweet.link,) Tweet.link,
cursor.execute("INSERT INTO tweets VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)", entry) Tweet.is_retweet,
Tweet.user_rt)
cursor.execute('INSERT INTO tweets VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)', entry)
conn.commit() conn.commit()
except sqlite3.IntegrityError: except sqlite3.IntegrityError:
pass pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment