Home > Enterprise >  Any alternativer to EXPLAIN command in BigQuery to validate table existence?
Any alternativer to EXPLAIN command in BigQuery to validate table existence?

Time:12-21

I am trying to use the EXPLAIN command in BigQuery to validate if a table exists in my database. Ex:

EXPLAIN SELECT 1 FROM table

However, when I run the command, I get an error saying that EXPLAIN is not a recognized keyword. Is there a way to use EXPLAIN in BigQuery to check if a table exists, or is there an alternative method I can use?

CodePudding user response:

Querying the INFORMATION_SCHEMA.TABLES view is probably a better solution

CodePudding user response:

You can also try Bigquery Exists command, an example given below:-

select if(exists(select * from proj.dataset.table), 'yes exist', 'not exist') as result;
  • Related