Lison
Lison

Reputation: 23

Google BigQuery "bq show" command returning: sqlite3.OperationalError: database is locked

I have this error and really don't understand why it happens,

I am running a few scripts every 10 minutes, they do a few things on the same dataset in BigQuery, the scripts basically are comparing rows of some tables and extracting/putting some data on them, they use "bq show" "bq query with --replace to a table in the dataset" and "bq extract" for some reason some times I am getting a "database locked" error , however I don't think any of the things I am running would block the DB, it's only.

the error is this one:

    Traceback (most recent call last):
    File "/usr/lib64/google-cloud-sdk/bin/bootstrapping/bq.py", line 79, in <module>
exceptions.HandleError(e, 'bq')
    File "/usr/lib64/google-cloud-sdk/bin/bootstrapping/bq.py", line 75, in <module>
bootstrapping.CheckCredOrExit()
    File "/usr/lib64/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 110, in CheckCredOrExit
c_store.Load()
    File "/usr/lib64/google-cloud-sdk/lib/googlecloudsdk/core/credentials/store.py", line 358, in Load
Refresh(cred)
    File "/usr/lib64/google-cloud-sdk/lib/googlecloudsdk/core/credentials/store.py", line 377, in Refresh
credentials.refresh(http_client or http.Http())
    File "/usr/lib64/google-cloud-sdk/lib/third_party/oauth2client/client.py", line 571, in refresh
self._refresh(http.request)
    File "/usr/lib64/google-cloud-sdk/lib/third_party/oauth2client/client.py", line 793, in _refresh
self._do_refresh_request(http_request)
    File "/usr/lib64/google-cloud-sdk/lib/third_party/oauth2client/client.py", line 837, in _do_refresh_request
self.store.locked_put(self)
    File "/usr/lib64/google-cloud-sdk/lib/googlecloudsdk/core/credentials/creds.py", line 227, in locked_put
getattr(self._credentials, 'rapt_token', None))
    File "/usr/lib64/google-cloud-sdk/lib/googlecloudsdk/core/credentials/creds.py", line 181, in Store
(account_id, access_token, token_expiry, rapt_token))
    File "/usr/lib64/google-cloud-sdk/lib/googlecloudsdk/core/credentials/creds.py", line 167, in _Execute
cur.Execute(*args)
    File "/usr/lib64/google-cloud-sdk/lib/googlecloudsdk/core/credentials/creds.py", line 106, in Execute
return self._cursor.execute(*args)
    sqlite3.OperationalError: database is locked

Any ideas ??

Upvotes: 2

Views: 535

Answers (1)

Will Faris
Will Faris

Reputation: 199

It is likely that another process is using the credentials.db file. The credentials.db file exists in your user config directory which you can find by running gcloud info.

On linux you can see what process is using a file with the

fuser 'FILE' command.

Upvotes: 2

Related Questions