Commit 7ad25b6c authored by Francesco Poldi's avatar Francesco Poldi

Fix `Search_name` in dbs

parent c963364c
......@@ -91,7 +91,7 @@ def init(db):
);
"""
cursor.execute(table_followers)
table_following = """
CREATE TABLE IF NOT EXISTS
following (
......@@ -127,7 +127,7 @@ def fTable(Followers):
table = "followers_names"
else:
table = "following_names"
return table
def uTable(Followers):
......@@ -135,7 +135,7 @@ def uTable(Followers):
table = "followers"
else:
table = "following"
return table
def follow(conn, Username, Followers, User):
......@@ -168,7 +168,7 @@ def user(conn, Username, Followers, User):
User.media_count,
User.is_private,
User.is_verified,
User.avatar,
User.avatar,
date_time,
Username,)
query = 'INSERT INTO {} VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'.format(uTable(Followers))
......@@ -198,7 +198,7 @@ def tweets(conn, Tweet, config):
Tweet.user_rt,
",".join(Tweet.mentions),
date_time,
config.search_name,)
config.Search_name,)
cursor.execute('INSERT INTO tweets VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', entry)
conn.commit()
except sqlite3.IntegrityError:
......
......@@ -21,7 +21,7 @@ def init(hostname,Database,db_user,db_pwd):
passwd=db_pwd, # your password
db=Database,# name of the data base
charset='utf8mb4',
use_unicode=True)
use_unicode=True)
cursor = conn.cursor()
#here would be the code for creating the tables if them don't exist
return conn
......@@ -33,7 +33,7 @@ def fTable(Followers):
table = "followers_names"
else:
table = "following_names"
return table
def uTable(Followers):
......@@ -41,7 +41,7 @@ def uTable(Followers):
table = "followers"
else:
table = "following"
return table
def follow(conn, Username, Followers, User):
......@@ -74,16 +74,16 @@ def user(conn, Username, Followers, User):
User.media_count,
User.is_private,
User.is_verified,
User.avatar,
User.avatar,
date_time,
Username,)
query = 'INSERT INTO {} VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)'.format(uTable(Followers))
cursor.execute(query, entry)
conn.commit()
except MySQLdb.IntegrityError:
pass
def tweets(conn, Tweet, config):
try:
......@@ -106,7 +106,7 @@ def tweets(conn, Tweet, config):
Tweet.user_rt,
",".join(Tweet.mentions),
date_time,
config.search_name,)
config.Search_name,)
cursor.execute('INSERT INTO tweets VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)', entry)
conn.commit()
except MySQLdb.IntegrityError:
......
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