Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BigQuery bq command with asterisk (*) doesn't work in Compute Engine

I have a directory with a file named file1.txt

And I run the command:

bq query "SELECT * FROM [publicdata:samples.shakespeare] LIMIT 5"

In my local machine it works fine but in Compute Engine I receive this error:

Waiting on bqjob_r2aaecf624e10b8c5_0000014d0537316e_1 ... (0s) Current status: DONE
BigQuery error in query operation: Error processing job 'my-project-id:bqjob_r2aaecf624e10b8c5_0000014d0537316e_1': Field 'file1.txt' not found.

If the directory is empty it works fine. I'm guessing the asterisk is expanding the file(s) into the query but I don't know why.

like image 935
Eyal Levin Avatar asked Jun 27 '26 05:06

Eyal Levin


1 Answers

Apparently the bq command which is located at /usr/bin/bq has the following script:

#!/bin/sh
exec /usr/lib/google-cloud-sdk/bin/bq ${@}

which expands the asterisk.

As a current workaround I'm calling /usr/lib/google-cloud-sdk/bin/bq directly.

like image 119
Eyal Levin Avatar answered Jun 30 '26 14:06

Eyal Levin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!