-
Notifications
You must be signed in to change notification settings - Fork 556
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
Don't return query results from BigQuery DML/DDL statements #2141
Comments
@nfallen Thank you for bringing up this issue. This library originally used How many rows are you seeing? |
If you want to continue using tabledata.list for performance reasons you could use the presence of the field statistics.query.numDmlAffectedRows in the jobs.get response to indicate that the query was DML, and the presence of statistics.query.ddlTargetTable to indicate that the query was DDL. Since there is no maxResults value provided by default the call to tabledata.list will attempt to fetch all rows, and will only be limited by the size of the table or the maximum response size of tabledata.list. |
Thanks @nfallen, this is very helpful! |
@nfallen I believe the library actually provides a way to execute DML/DDL without fetching rows, as demonstrated in dataset_ddl_test.rb. There is no test for DML operations, but I believe it would work similarly. The library does not currently expose Does this sound OK to you? |
* Add #num_dml_affected_rows to QueryJob * Update QueryJob#data to conditionally return empty Data * Add DDL/DML attrs to Data * Add DDL/DML examples to #query_job and #query [closes #2141]
This client library uses tabledata.list to fetch query results, and so even for a DML/DDL statement it fetches rows. Instead, you could use the jobs.getQueryResults API, which correctly does not return any rows for DML/DDL.
The text was updated successfully, but these errors were encountered: