I'm looking at the user-defined function docs for BigQuery, but I need to define a function to simplify the process of querying multiple tables. I have people who have to do stuff like this:
SELECT * FROM (TABLE_DATE_RANGE([SomeDataSet.SomeTableName_],DATE_ADD(CURRENT_TIMESTAMP(),-2,'DAY'),DATE_ADD(CURRENT_TIMESTAMP(),-1,'DAY'))) where magical_rainbows = 7;
Nobody is going to remember all of that, and they'll end up copy-pasting it in from some source, over and over. No big deal, except people are lazy and will inevitably develop the habit of setting that date range to be all-inclusive and run my bill through the roof.
I'd rather use a UDF to get all of that down to something they can remember - and type quickly:
SELECT * FROM da_tables([SomeDataSet.SomeTableName_], -2, -1) where .....
Everything I see in UDF, however, is about table schema production, and there doesn't appear to be a way for me to solve this headache.