Skip to content

Instantly share code, notes, and snippets.

@lfy79001
Created April 30, 2024 16:55
Show Gist options
  • Save lfy79001/56c5025a31e4f5d76efd7636353988a8 to your computer and use it in GitHub Desktop.
Save lfy79001/56c5025a31e4f5d76efd7636353988a8 to your computer and use it in GitHub Desktop.
DECLARE
my_drug_list ARRAY<STRING>;
SET
my_drug_list = [ 'Premarin',
'Calcium disodium versenate',
'Keytruda',
'Vioxx',
'Humira' ];
SELECT
id AS drug_id,
name AS drug_chembl_name,
tradeNameList.element AS drug_trade_name,
drugType AS drug_type,
isApproved AS drug_is_approved,
blackBoxWarning AS drug_blackbox_warning,
hasBeenWithdrawn AS drug_withdrawn,
FROM
`open-targets-prod.platform.molecule`,
UNNEST (tradeNames.list) AS tradeNameList
WHERE
(tradeNameList.element) IN UNNEST(my_drug_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment