termcolor is not defined when running `bq`
allejo opened this issue · comments
TL;DR
Using bq
in GitHub Actions after using this action results in a NameError: name 'termcolor' is not defined
warning that can cause problems if you're redirecting output.
See this demo run: https://github.com/allejo/dev-null/actions/runs/7111817851/workflow
Expected behavior
For termcolor
to exist and to be used correctly without any warnings/errors being thrown.
Observed behavior
termcolor
is not defined.
Action YAML
on:
push: ~
jobs:
big_query:
name: Big Query
runs-on: ubuntu-latest
steps:
- id: auth
uses: google-github-actions/auth@v1
with:
credentials_json: '${{ secrets.GCLOUD_BIG_QUERY }}'
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: List datasets
run: |
bq query \
--quiet \
--headless \
--format=csv \
--use_legacy_sql=false \
"SELECT * FROM \`vlad_test.mockaroo\`"
Log output
You have encountered a bug in the BigQuery CLI. Please file a bug report in our
public issue tracker:
https://issuetracker.google.com/issues/new?component=187149&template=0
Please include a brief description of the steps that led to this issue, as well
as any rows that can be made public from the following information:
========================================
== Platform ==
CPython:3.11.6:Linux-6.2.0-1016-azure-x86_64-with-glibc2.35
== bq version ==
2.0.99
== Command line ==
['/opt/hostedtoolcache/gcloud/456.0.0/x64/platform/bq/bq.py', '--application_default_credential_file', '/home/runner/.config/gcloud/legacy_credentials/gh-actions-tester@newagent-9d89b.iam.gserviceaccount.com/adc.json', '--credential_file', '/home/runner/.config/gcloud/legacy_credentials/gh-actions-tester@newagent-9d89b.iam.gserviceaccount.com/singlestore_bq.json', '--project_id=newagent-9d89b', 'query', '--quiet', '--headless', '--format=csv', '--use_legacy_sql=false', 'SELECT * FROM `vlad_test.mockaroo`']
== UTC timestamp ==
2023-12-06 08:09:22
== Error trace ==
Traceback (most recent call last):
File "/opt/hostedtoolcache/gcloud/456.0.0/x64/platform/bq/bq.py", line 891, in RunSafely
return_value = self.RunWithArgs(*args, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/gcloud/456.0.0/x64/platform/bq/bq.py", line 7640, in RunWithArgs
termcolor.cprint(
^^^^^^^^^
NameError: name 'termcolor' is not defined
========================================
Unexpected exception in init operation: You have encountered a bug in the
BigQuery CLI. Please file a bug report in our
public issue tracker:
https://issuetracker.google.com/issues/new?component=187149&template=0
Please include a brief description of the steps that led to this issue, as well
as any rows that can be made public from the following information:
id,first_name,last_name,email,gender,ip_address
199,Cris,Jenney,cjenney5i@answers.com,Male,22.208.63.132
318,Talbert,Lagden,tlagden8t@webnode.com,Male,180.46.120.0
Additional information
I tried installing termcolor
in a separate step with,
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: pip install termcolor
but it had no effect.
Please follow the instructions in the log output:
Unexpected exception in init operation: You have encountered a bug in the
BigQuery CLI. Please file a bug report in our public issue tracker:
https://issuetracker.google.com/issues/new?component=187149&template=0
@allejo additionally, it looks like you included PII for your customer database in your response. You may want to edit your message to remove that information and contact the affected customer(s).
Gotcha, will go ahead and use that tracker there! I thought since this seemed specific to the GHA environment (bq
works perfectly on my computer), it belonged here.
As for the PII in the logs, it's all mock data that I generated and am hosting in a dataset but thank you for the heads up!