steampipe plugin install twitter

Table: twitter_user_tweet - Query Twitter User Tweets using SQL

Twitter is a social networking service where users post and interact with messages known as "tweets". It provides a platform for public conversation and content distribution, allowing users to post tweets and interact with others. The tweets can contain photos, videos, links, and text, making it a rich source of data for analysis and insights.

Table Usage Guide

The twitter_user_tweet table provides insights into tweets made by specific Twitter users. As a data analyst or social media manager, explore tweet-specific details through this table, including content, engagement metrics, and user details. Utilize it to uncover information about tweet patterns, engagement rates, and the impact of specific tweets, facilitating better understanding and decision-making for social media strategies.

Important Notes

  • The user_id field must be set in the where clause.

Examples

Last 5 tweets by the author

Explore the most recent social media activity of a specific user to understand their latest posts and updates. This is useful for tracking the latest updates from a user, potentially for monitoring or engagement purposes.

select
id,
text
from
twitter_user_tweet
where
user_id = '1318177503995985921' -- @steampipeio
order by
created_at desc
limit
5;
select
id,
text
from
twitter_user_tweet
where
user_id = '1318177503995985921' -- @steampipeio
order by
created_at desc
limit
5;

Explore user timelines on Twitter to uncover tweets related to the topic of open source. This could be beneficial in identifying discussions or sentiments about open source in a specific user's timeline.

select
id,
ca -> 'entity' ->> 'name' as context,
text
from
twitter_user_tweet,
jsonb_array_elements(context_annotations) as ca
where
user_id = '8092452' -- @turbothq
and ca -> 'entity' ->> 'name' = 'Open source';
select
id,
json_extract(ca.value, '$.entity.name') as context,
text
from
twitter_user_tweet,
json_each(context_annotations) as ca
where
user_id = '8092452' -- @turbothq
and json_extract(ca.value, '$.entity.name') = 'Open source';

Get tweet timeline by username

Explore the tweets made by a specific Twitter user. This could be useful for understanding the user's posting habits, recent activity, or content preferences. Via subselect:

select
id,
text
from
twitter_user_tweet as t
where
t.user_id in (
select
id
from
twitter_user
where
username = 'steampipeio'
);
select
id,
text
from
twitter_user_tweet as t
where
t.user_id in (
select
id
from
twitter_user
where
username = 'steampipeio'
);

Via join:

select
t.id,
t.text
from
twitter_user_tweet as t,
twitter_user as u
where
t.user_id = u.id
and u.username = 'steampipeio';
select
t.id,
t.text
from
twitter_user_tweet as t,
twitter_user as u
where
t.user_id = u.id
and u.username = 'steampipeio';

Schema for twitter_user_tweet

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
attachment_pollsjsonbPolls attached to the Tweet.
attachmentsjsonbSpecifies the type of attachments (if any) present in this Tweet.
authorjsonbAuthor of the Tweet.
author_idtextUnique identifier of the author of the Tweet.
cashtagsjsonbList of cashtags (e.g. $TWTR) mentioned in the Tweet.
context_annotationsjsonbContains context annotations for the Tweet.
conversation_idtextThe Tweet ID of the original Tweet of the conversation (which includes direct replies, replies of replies).
created_attimestamp with time zoneCreation time of the Tweet.
entitiesjsonbContains details about text that has a special meaning in a Tweet.
geojsonbContains details about the location tagged by the user in this Tweet, if they specified one.
hashtagsjsonbList of hashtags (e.g. #sql) mentioned in the Tweet.
idtextUnique identifier of this Tweet.
in_reply_to_user_idtextIf this Tweet is a Reply, indicates the user ID of the parent Tweet's author.
in_reply_userjsonbUser the Tweet was in reply to.
langtextLanguage of the Tweet, if detected by Twitter. Returned as a BCP47 language tag.
mentionsjsonbList of users (e.g. steampipeio) mentioned in the Tweet.
mentions_objjsonbUsers mentioned in the Tweet.
placejsonbPlace where the Tweet was created.
possibly_sensitivebooleanIndicates if this Tweet contains URLs marked as sensitive, for example content suitable for mature audiences.
public_metricsjsonbEngagement metrics for the Tweet at the time of the request.
quotedtextIf this Tweet is a Quote Tweet, indicates the ID of the original Tweet.
referenced_tweetsjsonbTweets referenced in this Tweet.
replied_totextIf this Tweet is a Reply, indicates the ID of the Tweet it is a reply to.
retweetedtextIf this Tweet is a Retweet, indicates the ID of the orginal Tweet.
sourcetextThe name of the app the user Tweeted from.
texttextThe content of the Tweet.
urlsjsonbList of URLs (e.g. https://steampipe.io) mentioned in the Tweet.
user_idtext=ID of the user the tweets are related to.
withheldjsonbContains withholding details for withheld content.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- twitter

You can pass the configuration to the command with the --config argument:

steampipe_export_twitter --config '<your_config>' twitter_user_tweet