0

is there any possibility to specify a default dataset id in the google.datalab.bigquery module while querying? I do not want to specify the whole project_id+dataset_id+table_id, write only the table_id in queries and then add the other ones manually.

Some colleagues do have the possibility in PHP, I'll write more if I reach them out for further information.

Nico Albers
  • 1,556
  • 1
  • 15
  • 32
  • What is the reason for not wanting to specify the dataset? – Graham Polley Oct 25 '17 at 09:12
  • The reason is on the one hand comfort and on the other hand that I want to change that by config later but not change the query itself (e.g. for change between staging/production). So I want to specify it, but I don't want to specify it in the query itself, rather in some config files. – Nico Albers Oct 25 '17 at 17:02

1 Answers1

0

I'd be curious how your colleagues are doing it in PHP, because AFAIK you always need to specify at a minimum the dataset and the table in a query. However, you may omit the project id if you wish, and and the default will be used (whatever you have set it to).

Graham Polley
  • 14,393
  • 4
  • 44
  • 80
  • They probably used the option to pass to the query mentioned as [default dataset in the docs](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs) somewhat. But I wasn't able to figure out how to to this with the pydatalab package. – Nico Albers Oct 25 '17 at 17:01
  • 1
    Ah, I see. You want to create a query job configuration and set the default dataset and not specify it in the SQL query itself, is that right? – Graham Polley Oct 25 '17 at 22:43