Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: repr of QueryJob (and other jobs) should include job reference info (project ID, location, job ID) #958

Closed
tswast opened this issue Sep 9, 2021 · 1 comment · Fixed by #964
Assignees
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@tswast
Copy link
Contributor

tswast commented Sep 9, 2021

Without a job ID, there's not much I can do to follow-up with an investigation into test flakes. Project ID, location, and job ID are the first things backend engineers request if there is a problem with a query job. We should ensure that our exceptions include this information (I believe we do much of the time) and just as importantly the repr of the job, so that assertion errors like this include the right information.

Context

#947 had a system test flake.

        # Insert a few rows and check the stats.
        sql = f"""
            BEGIN TRANSACTION;
              INSERT INTO `{table_id}`
              VALUES ("one", 1), ("two", 2), ("three", 3), ("four", 4);

              UPDATE `{table_id}`
              SET bar = bar + 1
              WHERE bar > 2;
            COMMIT TRANSACTION;
        """
        query_job = Config.CLIENT.query(sql)
        query_job.result()

        # Transaction ID set by the server should be accessible
>       assert query_job.transaction_info is not None
E       AssertionError: assert None is not None
E        +  where None = <google.cloud.bigquery.job.query.QueryJob object at 0x7fa1b2732610>.transaction_info

tests/system/test_client.py:1583: AssertionError

https://source.cloud.google.com/results/invocations/10d5f32f-86da-4278-85d6-25799e2f8155/targets/cloud-devrel%2Fclient-libraries%2Fpython%2Fgoogleapis%2Fpython-bigquery%2Fpresubmit%2Fprerelease-deps-3.8/log

Without a job ID, there's little I can do to investigate further.

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Sep 9, 2021
@tswast tswast added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed api: bigquery Issues related to the googleapis/python-bigquery API. labels Sep 9, 2021
@plamut plamut self-assigned this Sep 9, 2021
@plamut
Copy link
Contributor

plamut commented Sep 9, 2021

Makes sense 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants