Skip to content

Instantly share code, notes, and snippets.

@morsapaes
Created April 25, 2022 10:03
Show Gist options
  • Save morsapaes/83ca99ebd7749644403e9da5f9790cf2 to your computer and use it in GitHub Desktop.
Save morsapaes/83ca99ebd7749644403e9da5f9790cf2 to your computer and use it in GitHub Desktop.
CREATE VIEW twitter_tweets_enriched AS
SELECT tweet_text AS tweet,
username,
CASE WHEN tweet_type = 'quoted' THEN 'quoted retweet'
WHEN tweet_type = 'replied to' THEN 'tweet reply'
ELSE 'tweet'
END AS tweet_type,
created_at
FROM twitter_tweets tt
--This is a streaming join!
JOIN twitter_users tu ON tt.user_id = tu.user_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment