Как я добавляю твиты в базу данных (
Код: Выделить всё
parsedКод: Выделить всё
# query to add each tweet to the database
for tweet in parsed:
c.execute("INSERT OR IGNORE INTO tweets VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
[tweet['id'],
tweet['url'],
tweet['created_at'],
tweet['hashtags'],
tweet['favorite_count'],
tweet['user_mentions'],
tweet['text'],
tweet['user_verified'],
tweet['user_following_count'],
tweet['retweet_count'],
tweet['user_name'],
tweet['user_id'],
tweet['user_screen_name'],
tweet['geo'],
tweet['lang'],
tweet['user_followers_count']]
)
Код: Выделить всё
update_tweet_query = '''UPDATE tweets
SET url = ? ,
created_at = ? ,
hashtags = ? ,
favorite_count = ? ,
user_mentions = ? ,
text = ? ,
user_verified = ? ,
user_following_count = ? ,
retweet_count = ? ,
user_name = ? ,
user_id = ? ,
user_screen_name = ? ,
geo = ? ,
lang = ? ,
user_followers_count = ?
WHERE id = ?'''