Is there a way to select table_id in a Bigquery Table Wildcard Query -


i have set of day-sharded data individual entries not contain day. use table wildcards select available data , data grouped both column interested in , day captured. something, in other words, this:

select table_id, identifier, sum(appanalytic) appanalyticcount       (table_query(database_main,'table_id contains "title_" , length(table_id) >= 4'))      group identifier, table_id order appanalyticcount desc limit 10  

of course, not work because table_id not visible in table aggregation resulting table_query function. there way accomplish this? sort of join on table metadata perhaps?

this functionality available in bigquery through _table_suffix pseudocolumn. full documentation @ https://cloud.google.com/bigquery/docs/querying-wildcard-tables. couple of things note:

  • you need use standard sql enable table wildcards
  • you have rename _table_suffix else in select list, i.e. following example illustrates it

    select _table_suffix table_id, ... `mydataset.mytableprefix_*`


Comments