Home > Software design >  How can i get the project name in Big Query that I'm working on?
How can i get the project name in Big Query that I'm working on?

Time:09-25

I need to get the project name that i'm actually working on Big Query in a field within the tables inside of the project.

This is the query I'm working at the moment:

SELECT A.table_name FROM `myproject.dataset.INFORMATION_SCHEMA.TABLES` A where A.table_name in ('tbl_project1','tbl_project2','tbl_project3');

But i also need to retrieve the project name in that view.

CodePudding user response:

As you can see in the GCP documentation, you can obtain the ID of the project that contains the dataset including the table_catalog column in your query:

SELECT A.table_catalog, A.table_name FROM `myproject.dataset.INFORMATION_SCHEMA.TABLES` A where A.table_name in ('tbl_project1','tbl_project2','tbl_project3');
  • Related