Skip to content

Instantly share code, notes, and snippets.

@repodevs
Created November 16, 2025 09:28
Show Gist options
  • Select an option

  • Save repodevs/1c70246dc395a029b6b760b03235c79f to your computer and use it in GitHub Desktop.

Select an option

Save repodevs/1c70246dc395a029b6b760b03235c79f to your computer and use it in GitHub Desktop.
Metabase filter string as array using delimiter
SELECT
id, name
FROM table_users
WHERE 1=1
[[ AND name = ANY(STRING_TO_ARRAY({{ user_name }}, ',')) ]]
-- `user_name` is metabase variables, type: Text
-- `','` is the delimeter
-- usage: in variablse `user_name` -> `Sky,Blue,Green`
-- it's will equal to `AND name IN ('Sky', 'Blue', 'Greem')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment