Search code examples
google-bigquerygcloudgoogle-cloud-shell

problem passing arguments to `bq add-iam-policy-binding`


Why bq doesn't see my params? I run:

bq add-iam-policy-binding <PROJECT>:<DATASET>.<TABLE> \
    --member='user:<EMAIL>' \
    --role='roles/bigquery.dataViewer' \
    --condition=None

And get error

FATAL Flags parsing error: flag --member=None: Flag --member must have a value other than None.
flag --role=None: Flag --role must have a value other than None.
Run 'bq.py help' to get help

I also tried different parameter/value styles like --member 'user:<EMAIL>' or --member=user:<EMAIL> but everything returns the same error.

Gcloud version:

$ gcloud --version
Google Cloud SDK 491.0.0
beta 2024.08.30
bq 2.1.8
bundled-python3-unix 3.11.9
core 2024.08.30
gcloud-crc32c 1.0.0
gke-gcloud-auth-plugin 0.5.9
gsutil 5.30
kubectl 1.28.12

Solution

  • In newer versions of bq, table specification should be at the end. This works:

    bq add-iam-policy-binding \
        --member='user:<EMAIL>' \
        --role='roles/bigquery.dataViewer' \
        <PROJECT>:<DATASET>.<TABLE>