Closed
Description
Environment details
Ubuntu 18.04.5 LTS
Python 3.7.10
pip 21.1.3
google-cloud-bigquery 2.20.0
google-cloud-bigquery-datatransfer 3.2.0
google-cloud-bigquery-storage 2.4.0
Steps to reproduce
- Use %%bigquery magic with the --use_rest_api flag on a project where I don't bigquery.readsession permissions.
- Observe that the query fails due to not having readsession permissions.
Code example
%%bigquery my_test --use_rest_api
SELECT
*
FROM `aaa-willyn-test.test_dataset.my_test`
Stack trace
PermissionDenied Traceback (most recent call last)
<ipython-input-9-f594b2ed9ec4> in <module>
----> 1 get_ipython().run_cell_magic('bigquery', 'my_test --use_rest_api', 'SELECT\n*\nFROM `aaa-willyn-test.test_dataset.abi_copy`\n')
/opt/conda/lib/python3.7/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
2401 with self.builtin_trap:
2402 args = (magic_arg_s, cell)
-> 2403 result = fn(*args, **kwargs)
2404 return result
2405
...skipping several frames here...
/opt/conda/lib/python3.7/site-packages/google/api_core/grpc_helpers.py in error_remapped_callable(*args, **kwargs)
67 return callable_(*args, **kwargs)
68 except grpc.RpcError as exc:
---> 69 six.raise_from(exceptions.from_grpc_error(exc), exc)
70
71 return error_remapped_callable
/opt/conda/lib/python3.7/site-packages/six.py in raise_from(value, from_value)
PermissionDenied: 403 request failed: the user does not have 'bigquery.readsessions.create' permission for 'projects/fc-product-demo'