I'm trying to load some ndjson data. First, creating a table works flawlessly:
> bq mk --table <project-id>:<my-dataset.newtable> newtable.schema.json
Table '<project-id>:<my-database.newtable>' successfully created.
However, the bq load
command does not:
> bq load --source_format=NEWLINE_DELIMITED_JSON <project-id>:<my-dataset.newtable> gs://<project-id>.appspot.com/newtable.ndjson
BigQuery error in load operation: Not found: Project <project-friendly-name>
Please also note also:
I have no problem running the job from BigQuery's web interface.
I have set <project-id>
as the default project through the bq init
command, but I get the same error, even when creating a table, when I don't specify it.
Is there an issue with some environment variables that have not been set correctly ?
Ok. Interestingly and unlike with bq mk
, with bq load
, selecting the <project-id>
with [PROJECT_ID]:[DATASET].[TABLE]
, or throught bq init
(and the --location=[LOCATION]
option with a fully-qualified Cloud Storage URI as a file) is still irrelevant.
I still had to run either:
gcloud config set project <project-id>
bq load --project_id=<project-id> ...
or
gcloud init
and choose the targetted project as a default.So to sum up, this works:
bq load --project_id=<project-id> --source_format=NEWLINE_DELIMITED_JSON <my-dataset.newtable> gs://<project-id>.appspot.com/newtable.ndjson