class TweetHashtag(db.Model): __tablename__ = 'tweet_hashtag' tweet_id = db.Column(db.BigInteger, db.ForeignKey( 'base_tweets.tweet_id'), primary_key=True) hashtag = db.Column(db.String(50), db.ForeignKey( 'hashtags.hashtag'), primary_key=True) tweet_id_relationship = db.relationship(BaseTweet, backref='tweet_hashtag') hashtag_relationship = db.relationship(Hashtag, backref='tweet_hashtag')
class Place(db.Model): __tablename__ = 'places' place_id = db.Column(db.String(20), primary_key=True) name = db.Column(db.String(50)) latitude = db.Column(db.Float) longitude = db.Column(db.Float) country_code = db.Column( db.String(5), db.ForeignKey('countries.country_code'))
class BaseTweet(db.Model): __tablename__ = 'base_tweets' tweet_id = db.Column(db.BigInteger, primary_key=True) tweet_id_str = db.Column(db.String(20)) tweet_text = db.Column(db.Text) source = db.Column(db.String(512)) favorited = db.Column(db.Boolean) retweeted = db.Column(db.Boolean) favorite_count = db.Column(db.Integer) retweet_count = db.Column(db.Integer) result_type = db.Column(db.String(20)) created_at = db.Column(db.DateTime) lang = db.Column(db.String(10)) possibly_sensitive = db.Column(db.Boolean) place_id = db.Column(db.String(20), db.ForeignKey('places.place_id')) place = db.relationship('Place', backref='base_tweets') hashtags = db.relationship( 'Hashtag', secondary='tweet_hashtag', backref='base_tweets')
class RetweetedUser(db.Model): __tablename__ = 'retweeted_users' user_id = db.Column(db.BigInteger, db.ForeignKey( 'users.id'), primary_key=True) tweet_id = db.Column(db.BigInteger, db.ForeignKey( 'base_tweets.tweet_id'), primary_key=True)
class TweetWordSentiment(db.Model): __tablename__ = 'tweet_word_sentiment' tweet_id = db.Column(db.BigInteger, db.ForeignKey( 'base_tweets.tweet_id'), primary_key=True) word = db.Column(db.Text, primary_key=True) score = db.Column(db.Integer)