Skip to content

Instantly share code, notes, and snippets.

@xoelop
Last active January 13, 2021 11:19
Show Gist options
  • Save xoelop/d3223004ce4255848ea3b9efc427b296 to your computer and use it in GitHub Desktop.
Save xoelop/d3223004ce4255848ea3b9efc427b296 to your computer and use it in GitHub Desktop.
%
SELECT * FROM all_likes
WHERE match(lower(text), replaceRegexpAll({{String(search_term, ' ', description="Return tweets whose text matches this word (can include a regex pattern)", required=True)}}, ' ', '.?'))
AND (
multiSearchAnyCaseInsensitive(screenname, splitByString(',', {{String(usernames, ',', description="User names or handles, comma-separated")}}))
OR multiSearchAnyCaseInsensitive(username, splitByString(',', {{String(usernames, ',', description="User names or handles, comma-separated")}}))
)
AND date >= toStartOfDay(toDate({{Date(since, '2000-09-09', description="Start date, YYYY-MM-DD")}}))
AND date <= addDays(toStartOfDay(toDate({{Date(until, '2100-09-09', description="End date, YYYY-MM-DD")}})), 1)
ORDER BY date desc
LIMIT {{Int32(limit, 20000000, description="Max number of tweets to return", required=True)}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment