Skip to content

docs: add short mode query sample & test #1978

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

Merged
merged 5 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
comments/formatting
  • Loading branch information
shollyman committed Jul 19, 2024
commit f205f8b02b33afdf616c4c282ebc1a0e2863a8a6
7 changes: 4 additions & 3 deletions samples/client_query_shortmode.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def client_query_shortmode() -> None:

query = """
SELECT
name,
name,
gender,
SUM(number) AS total
SUM(number) AS total
FROM
bigquery-public-data.usa_names.usa_1910_2013
GROUP BY
Expand All @@ -37,7 +37,8 @@ def client_query_shortmode() -> None:
total DESC
LIMIT 10
"""
# Run the query and process the returned row iterator.
# Run the query. The returned `rows` iterator can return information about
# how the query was executed as well as the result data.
rows = client.query_and_wait(query)

if rows.job_id is not None:
Expand Down
2 changes: 1 addition & 1 deletion samples/tests/test_client_query_shortmode.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@


def test_client_query_shortmode(capsys: "pytest.CaptureFixture[str]") -> None:
job = client_query_shortmode.client_query_shortmode()
client_query_shortmode.client_query_shortmode()
out, err = capsys.readouterr()
assert "Query was run" in out