What I'm trying to do is to pull out a subset of tables from a Google Big Query Dataset based on the name of those tables and then add those tables to a Tableau datasource without having to join or union any of the tables.
I want to pull out all the tables beginning with System_1, from the below dataset
I have been able to do a wildcard search using Information_Schema.Tables to get all the names of the tables that begin with System_1, but I cannot figure out a way to then get all of the tables with those names as the output of the query (SQL below)
SELECT table_name
AS matchingTables
FROM dataset.INFORMATION_SCHEMA.TABLES
WHERE table_name LIKE 'System_1%'
How do I go about extracting those tables and not just the names of those tables?
~~~~~~~~~~~EDIT~~~~~~~~~~~~~
This is the best approximation as to how I could have done this but I'm getting a dataset not found error which is strange
SELECT *
FROM dataset
WHERE (SELECT table_name FROM dataset.INFORMATION_SCHEMA.TABLES)
LIKE 'System_1%'
Error Recieved:
Not found: Dataset dataset:dataset was not found in location EU
If I understand correctly you want the list of the table names in your dataset that start with "System_1_". You can obtain that with the following:
SELECT CONCAT("System_1_", _TABLE_SUFFIX) AS table_name
FROM `dataset.System_1_*`