Last active
August 1, 2024 05:15
-
-
Save davidclarance/b69559191e6628d32d8f2adf271e067f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE IF NOT EXISTS customers AS | |
SELECT 'Customer1' AS customer_id UNION ALL | |
SELECT 'Customer2' AS customer_id UNION ALL | |
SELECT 'Customer3' AS customer_id UNION ALL | |
SELECT 'Customer4' AS customer_id; | |
SELECT | |
c.customer_id, | |
('0x' || md5(c.customer_id)[:10])::int64 % 100 as assigned_bucket | |
FROM | |
customers c; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can see the python version here: https://gist.github.com/davidclarance/daeafad5fc3e28e019950a12b0da01f5