I lasted tweeted on Dec 22. (It was, unsurprisingly, a link to a blog post about Mastodon.) Today I wondered what percentage of the people who appear in my Mastodon timeline today also appeared on Twitter today.
To start, I wrote this query, which tries to match Twitter and Mastodon usernames. When it finds a match, it reports the day on which that person last tweeted.
with mastodon as (
select
substring(username from 1 for 15) as username, — twitter names are max 15 chars
‘from:’ || substring(username from 1 for 15) as query — we will query twitter using, e.g., ‘from:judell’
from
mastodon_toot
where
timeline = ‘home’
limit
500
)
select
m.username as mastodon_person,
t.author->>’username’ as twitter_person,
max(to_char(t.created_at, ‘YYYY-MM-DD’)) as last_tweet_day
from
mastodon m
left join
twitter_search_recent t — see https://hub.steampipe.io/plugins/turbot/twitter/tables/twitter_search_recent
on
t.query = m.query
group by
mastodon_person,
twitter_person
order by
last_tweet_day desc
This is my favorite kind of Steampipe query: two different APIs, each represented as a Postgres table, combined with a SQL JOIN.