0
votes

I am able to query a view with a where clause (< or > operator) in BigQuery console but if I am running a same query in SDK with (< or > operator) I an getting access denied error. Is there any limitations in SDK while filtering the views?

Below query for reference

bq query --use_legacy_sql=false "select * from view where column1>'2018-06-30'"

1
Which user are you using when run it in SDK? Which permissions does this user have? You can check the permissions in IAM and make sure the user has enough permissions to run queries - enle lin
@enle lin: A user has created in my name and I have all access to it. Strange thing is that if I am running a query with where clause having = sign its running successfully but when I am using < or > operator it is throwing access denied error. Is there some limitations for a table in while accessing through SDK. - Nirod Baran
Could you edit your question and provide the queries (mask the data if needed). I understand that you can run same query with = but not with > or < in the WHERE clause, executing both queries through SDK. - enle lin
I have edited the question along with the query which I am running. - Nirod Baran
I tested it in my end and it worked fine for me. I have posted an answer with details reproduction steps for that - enle lin

1 Answers

0
votes

I tested your query with one of my views and it worked correctly with =, > and <.

IMHO, you may consider to do the same test on your end. To reproduce my test, I create my view from query result from a public dataset (save as view):

SELECT date FROM `bigquery-public-data.common_us.date_greg` where date > '2018-08-01' and date < '2018-08-30'

Then I run these command in the Cloud Console:

bq query --use_legacy_sql=false 'select * from MY_VIEW where date>"2017-06-30"'

bq query --use_legacy_sql=false 'select * from MY_VIEW where date="2017-06-30"'

bq query --use_legacy_sql=false 'select * from MY_VIEW where date<"2017-06-30"'

No error was given in the queries described above.