max_results parameter is not working
Hello Goccy,
Recently came across a bug/issue where noticed that max_results parameter is not working which we generally use to set/get max total no. of records from query job. Below mentioned is sample code which returns all records from table (no effect of max_results parameter)
import typing from typing import Union from google.auth.credentials import AnonymousCredentials from google.api_core.client_options import ClientOptions
if typing.TYPE_CHECKING: from google.cloud.bigquery import LoadJob, CopyJob, ExtractJob, QueryJob
def create_job() -> "Union[LoadJob, CopyJob, ExtractJob, QueryJob]": # [START bigquery_create_job] from google.cloud import bigquery
# Construct a BigQuery client object.
client = bigquery.Client(
"dummy-local",
client_options=ClientOptions(api_endpoint="http://bigquery:9050"),
credentials=AnonymousCredentials(),
)
query_job = client.query("""
SELECT id,percent,name,bq_decrypt_data(name) as dname
FROM `dummy-local.dataset1.table_csv`
""") # Make an API request.
result = query_job.results(max_results=1)
for row in result:
print(str(row))
print(create_job())
Could you help to fix it please.
Best Regards, Onkar Kulkarni
Hi @Kulkarnionkar2007. I accidentally made a duplicate of this issue at #262 and have implemented a fix at #263.