This is not an ideal solution. But it looks like he is doing this job.
In my previous request, I passed the list of IDs as a parameter in the external process that built the request. I wanted this process to not be aware of any logic implemented in the request.
In the end, we came up with this solution:
Instead of passing a list of identifiers, we pass a JSON that contains the corresponding metadata for each identifier. We parse this JSON in the Table_Query () function. Therefore, instead of requesting a physical lookup table, we request some kind of "table variable" that we entered in JSON.
The following is an example of a query that runs in a public dataset that demonstrates this solution.
SELECT YEAR, COUNT (*) CNT FROM TABLE_QUERY([fh-bigquery:weather_gsod], 'table_id in (Select table_id From (Select table_id,concat(Right(table_id,4),"0101") as TBL_Date from [fh-bigquery:weather_gsod.__TABLES_SUMMARY__] where table_id Contains "gsod" )TBLs CROSS JOIN (select Regexp_Replace(Regexp_extract(SPLIT(DatesInput,"},{"),r"\"fromDate\":\"(\d\d\d\d-\d\d-\d\d)\""),"-","") as fromDate, Regexp_Replace(Regexp_extract(SPLIT(DatesInput,"},{"),r"\"toDate\":\"(\d\d\d\d-\d\d-\d\d)\""),"-","") as toDate, FROM (Select "[ { \"CycleID\":\"123456\", \"fromDate\":\"1929-01-01\", \"toDate\":\"1950-01-10\" },{ \"CycleID\":\"123456\", \"fromDate\":\"1970-02-01\", \"toDate\":\"2000-02-10\" } ]" as DatesInput)) RefDates WHERE TBLs.TBL_Date>=RefDates.fromDate AND TBLs.TBL_Date<=RefDates.toDate )') GROUP BY YEAR ORDER BY YEAR
This solution is not ideal because it requires the external process to know the data stored in lookup tables. Ideally, the BigQuery team will again include this very useful feature.