Table: twitter_user_following - Query Twitter User Followings using SQL
Twitter User Following is a feature within Twitter that allows a user to follow other Twitter users, thereby receiving their tweets and updates. It is a way for users to curate their Twitter feed based on their interests and preferences. This feature forms a fundamental part of the Twitter social media platform, enabling user interaction and engagement.
Table Usage Guide
The twitter_user_following
table provides insights into the users that a specific Twitter user is following. As a Social Media Analyst, explore user-specific details through this table, including the list of users they follow, their interests, and their engagement. Utilize it to understand user behavior, their preferences, and to create targeted marketing strategies.
Important Notes
- The
user_id
field must be set in thewhere
clause.
Examples
List the follows for a user
Discover the segments that a specific user is following on Twitter, providing insights into their interests and affiliations. This can be useful for social media analysis and targeted marketing strategies.
select *from twitter_user_followingwhere user_id = '1318177503995985921';-- @steampipeio
select *from twitter_user_followingwhere user_id = '1318177503995985921';-- @steampipeio
List follows by username
Discover the segments that are followed by a specific Twitter user, enabling you to gain insights into their interests and connections. This could be beneficial in understanding their network and potential influence. Via subselect:
select uf.id, uf.usernamefrom twitter_user_following as ufwhere uf.user_id in ( select id from twitter_user where username = 'steampipeio' );
select uf.id, uf.usernamefrom twitter_user_following as ufwhere uf.user_id in ( select id from twitter_user where username = 'steampipeio' );
Find all users followed by both turbothq and nathanwallace
Discover the shared connections between two specific Twitter users to understand their common interests or potential collaborations. This can be beneficial in social media analysis or targeted marketing strategies.
select id, usernamefrom twitter_user_followingwhere user_id in ( select id from twitter_user where username = 'turbothq' );intersectselect id, usernamefrom twitter_user_followingwhere user_id in ( select id from twitter_user where username = 'nathanwallace' );
select id, usernamefrom twitter_user_followingwhere user_id in ( select id from twitter_user where username = 'turbothq' )unionselect id, usernamefrom twitter_user_followingwhere user_id in ( select id from twitter_user where username = 'nathanwallace' );
Find users who follow you, but you don't follow them
Discover the segments of your Twitter audience that follow your account, but whom you have not followed back. This can be useful for identifying potential influencers or key accounts to engage with for networking and community-building purposes.
with account as ( select id from twitter_user where username = 'turbothq'),following as ( select id, username from twitter_user_following where user_id in ( select id from account )),followers as ( select id, username from twitter_user_follower where user_id in ( select id from account ))select usernamefrom followerswhere username not in ( select username from following )order by username;
with account as ( select id from twitter_user where username = 'turbothq'),following as ( select id, username from twitter_user_following where user_id in ( select id from account )),followers as ( select id, username from twitter_user_follower where user_id in ( select id from account ))select usernamefrom followerswhere username not in ( select username from following )order by username;
Schema for twitter_user_following
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
created_at | timestamp with time zone | The UTC datetime that the user account was created on Twitter. | |
description | text | The text of this user's profile description (also known as bio), if the user provided one. | |
entities | jsonb | Entities are JSON objects that provide additional information about hashtags, urls, user mentions, and cashtags associated with the description. | |
id | text | The unique identifier of this user. | |
location | text | The location specified in the user's profile, if the user provided one. As this is a freeform value, it may not indicate a valid location, but it may be fuzzily evaluated when performing searches with location queries. | |
name | text | The name of the user, as they’ve defined it on their profile. Not necessarily a person’s name. | |
pinned_tweet | jsonb | Contains withholding details for withheld content, if applicable. | |
pinned_tweet_id | text | Unique identifier of this user's pinned Tweet. | |
profile_image_url | text | The URL to the profile image for this user, as shown on the user's profile. | |
protected | text | Indicates if this user has chosen to protect their Tweets (in other words, if this user's Tweets are private). | |
public_metrics | jsonb | Contains details about activity for this user. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
url | text | The URL specified in the user's profile, if present. | |
user_id | text | = | ID of the user who is followed by these users. |
username | text | The Twitter screen name, handle, or alias that this user identifies themselves with. Usernames are unique but subject to change. | |
verified | boolean | Indicates if this user is a verified Twitter User. | |
withheld | jsonb | Contains withholding details for withheld content, if applicable. |
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_following