"Too many positional args, still have" - While running `bq mk --table` command

29 Views Asked by At

I am trying to create a table in BigQuery with partitioning and clustering:

bq mk --table \
      --description "My table" \
      --schema $absolute_path \
      --clustering_fields user_email,referenced_project_id \
      --label label_app:bigquery-stats \
      --time_partitioning_field creation_time \
      --time_partitioning_type DAY \
      --require_partition_filter true \
      gcp-project.dataset.table

But I am getting the following error: Too many positional args, still have ['gcp-project.dataset.table']

I tried re-arranging the flags but could not fix it.

1

There are 1 best solutions below

0
Mel On

I think your bq mk command is ok except for the last line gcp-project.dataset.table. Based on the documentation, the project ID and dataset should be separated by a colon (:) instead of a dot/ period.

Try gcp-project:dataset.table

I found a similar post which also follows the same structure as PROJECT_ID:DATASET.TABLE.

Sample:

bq mk \
   --table \
   --schema PATH \
   --clustering_fields CLUSTER_COLUMNS \
   --description "DESCRIPTION" \
   --label KEY:VALUE,KEY:VALUE \
   PROJECT_ID:DATASET.TABLE