Querying different schemas in BigQuery

Viewed 13

I'm trying to query GA4 data in BigQuery from the same events table but from different schemas. Trying to avoid using UNION ALL since I have a significant number of different schemas to query.

Big query schemas screenshot

I tried in this way but it didn't work:

schemas_list =  ['251049','275928', '286498'],

date_range as (
select
    '20220901' as start_date,
    '20220910' as end_date)

select event_date, traffic_source.name
from `gtm-k3.analytics_*.events_*`,
date_range
where
    _table_suffix between date_range.start_date and date_range.end_date
and schema in schemas_list

Any ideas? Thanks a lot.

0 Answers
Related