def setup_db(connection_string):
db = dataset.connect(connection_string)
connections = db['connection']
users = db['user']
tweets = db['tweet']
medias = db['media']
mentions = db['mention']
urls = db['url']
hashtags = db['hashtag']
tweets.create_index(['tweet_id'])
medias.create_index(['tweet_id'])
mentions.create_index(['user_id'])
mentions.create_index(['mentioned_user_id'])
urls.create_index(['tweet_id'])
hashtags.create_index(['tweet_id'])
users.create_index(['user_id'])
connections.create_index(['friend_id'])
connections.create_index(['follower_id'])
return db
评论列表
文章目录