TweetStream
Query public data flowing through Twitter.
View Specific Information
TweetStream is a stream that will continuously read public Tweets until the operation is killed.
Select
Below are the fields that can be specified to filter the results.
Follow | A comma-separated list of user Ids, indicating the users you are following whose Tweets should be delivered on the stream. |
Track | A comma-separated list of phrases that will be used to deliver the Tweets on the stream containing the phrases. |
Language | Return Tweets that have been detected as being written in the specified list of comma-separated languages. You must use BCP 47 language identifiers, such as 'en','fr','ja'. Twitter will respond with a "406 Not Acceptable" error if the coordinates entered were incorrect. |
Locations | A comma-separated list of longitude and latitude pairs specifying a set of bounding boxes to filter Tweets by. You must use at least two pairs of longitude and latitude coordinates, with the first pair indicating the southwest bound of the region you will search in. |
BackfillCount | When reconnecting to a streaming endpoint, the BackfillCount parameter may be included to attempt to backfill missed messages that occurred during the disconnect period. The supplied value can be an integer from 1 to 150000 or from -1 to -150000. If a positive number is specified, the stream will transition to live values once the backfilled values have been delivered to the client. If a negative number is specified, the stream will disconnect once the backfilled values have been delivered to the client. This filter is only allowed to users with these elevated access roles: Firehose, Links, Birddog and Shadow. Twitter will respond with a "416 Requested Range Not Satisfiable" error if your role does not support this filter. |
Filter_Level | The level of tweets returned. The default value is none, which includes all available Tweets. |
SELECT * FROM TweetStream WHERE Follow = '51192312'
If either Follow, Track, or Language, is not specified, a small random sample of all public Tweets will be returned, and using any other filter is not going to affect Twitter's streaming results.
Retrieve a large number of tweets that contain the word 'Assembly' in the tweet's body:
SELECT * FROM TweetStream WHERE Track = 'Assembly' AND Filter_Level='low'
The following filter will retrieve all tweets originating from New York City:
SELECT * FROM TweetStream WHERE Locations = '-74,40,-73,41'
Retrieve tweets in the French or English language containing the word 'fillet', and if disconnected, stop retrieving after 50 tweets:
SELECT * FROM TweetStream WHERE Track = 'fillet' AND Language = 'fr,en' AND BackfillCount='-50'
Columns
Name | Type | Description |
ID | String | The Id of the status update or tweet. Set this value when inserting to retweet an existing tweet. |
Created_At | Datetime | When the tweet was made. |
Text | String | The text of the tweet. |
Lang | String | Language code the tweet was made in. |
Source | String | Source of the tweet. |
Favorited | Boolean | Boolean indicating if this tweet has been favorited. |
Favorite_Count | Integer | The approximate number of times this tweet has been favorited. |
Retweeted | Boolean | Boolean indicating if this tweet has been retweeted. |
Retweet_Count | Integer | The number of times the tweet has been retweeted. |
Retweeted_Status_Id | String | Id of the tweet which was retweeted by this one. Empty if the current tweet is not a retweet. |
Truncated | Boolean | Boolean indicating if this tweet has been truncated. |
Filter_Level | String | Indicates the maximum value of the Filter_Level parameter that can be used and still stream this tweet. |
Possibly_Sensitive | String | This field is available only when a tweet contains a link. The meaning of the field does not pertain to the tweet content itself, but instead it is an indicator that the URL contained in the tweet may contain content or media identified as sensitive content. |
Contributors | String | A JSON collection of user objects (usually only one) indicating users who contributed to the authorship of the tweet, on behalf of the official tweet author. |
Coordinates_Coordinates | String | The geographic coordinates of this tweet (longitude first, then latitude). |
Coordinates_Type | String | The type of coordinate, if applicable. |
Place_Full_Name | String | The full name of the location of this tweet (city and state). |
Place_Country | String | The country of origin of this tweet. |
Current_User_Retweet_Id | String | Details the tweet Id of the authenticated users own retweet (if it exists) of this tweet. |
In_Reply_To_Status_Id | String | Represents the Id of the original status if this tweet is in reply to another. |
In_Reply_To_User_Id | String | Represents the Id of the original user if this tweet is in reply to another. |
From_User_Id | String | Id of the user who made the tweet. Use this in the WHERE clause to get tweets for the specified user. |
From_User_Screen_Name | String | Screen name of the user who made the tweet. Use this in the WHERE clause to get tweets for the specified user. |
From_User_Name | String | Name of the user who made the tweet. |
From_User_Location | String | Location of the user who made the tweet. |
From_User_Profile_URL | String | URL to the user who made the tweet. This is not returned when a SearchTerms is specified. |
From_User_Profile_Image_Url | String | URL to the profile image for the from user. |
User_Mentions | String | Mentions of other users in the tweet, returned as an JSON aggregate. |
URLs | String | URLs in the tweet, returned as an XML aggregate. |
Hashtags | String | Hashtags in the tweet, returned as an XML aggregate. |
Follow | String | A comma separated list of user IDs, indicating the users whose Tweets should be delivered on the stream. Following protected users is not supported. |
Track | String | A comma separated list of phrases which will be used to determine what Tweets will be delivered on the stream. |
Language | String | Setting this parameter to a comma-separated list of BCP 47 language identifiers corresponding to any of the languages listed on Twitter's advanced search page will only return Tweets that have been detected as being written in the specified languages. |
Locations | String | A comma separated list of longitude,latitude pairs specifying a set of bounding boxes to filter Tweets by. Only geolocated Tweets falling within the requested bounding boxes will be included unlike the Search API, the location of the user field is not used to filter Tweets. |
Pseudo-Columns
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source.
Name | Type | Description |
BackfillCount | String | When reconnecting to a streaming endpoint, the count parameter may included to attempt to backfill missed messages which occurred during the disconnect period. The supplied value may be an integer from 1 to 150000 or from -1 to -150000. If a positive number is specified, the stream will transition to live values once the backfill has been delivered to the client. If a negative number is specified, the stream will disconnect once the backfill has been delivered to the client. |