1
votes

I am using this official example to import from file:

https://github.com/GoogleCloudPlatform/php-docs-samples/blob/master/bigquery/api/src/functions/import_from_file.php

However, it supports only CSV and JSON files.

How can I import AVRO file via the PHP API which should be supported as per:

https://cloud.google.com/bigquery/loading-data#loading_avro_files

1

1 Answers

1
votes

It's a sample file that was written before Avro was available. Can you just add the relevant condition to that block?

elseif ('avro' === $pathInfo['extension']) {
  $options['jobConfig'] = ['sourceFormat' => 'AVRO'];
}