Add QueryJob#num_dml_affected_rows and DDL/DML docs#2530
Add QueryJob#num_dml_affected_rows and DDL/DML docs#2530quartzmo merged 5 commits intogoogleapis:masterfrom
Conversation
|
I would like to get @tswast's review on this. |
|
@tswast Do you think we should add wrapper methods similar to |
|
In Python we return a job for the query helper (but then allow iterating over it for getting the results). Ideally one should be able to use the same helper to call DDL and DML queries, though it's tough when the helper returns "results". We suffered a similar problem in Java, where my solution was to special-case an "empty results" object for DDL queries. googleapis/google-cloud-java#3469 |
tswast
left a comment
There was a problem hiding this comment.
Property LGTM. I think the docs to recommend the job method are good for DDL / DML, but ideally one should be able to call the regular query method if they don't care about the detailed results.
|
@tswast Good suggestion, I've been working today on adding DDL/DML response info to the array type returned by |
Add job_gapi to Data. Update QueryJob#data to conditionally return empty Data.
@tswast @blowmage PTAL at the most recent commit:
|
| end | ||
|
|
||
| def ddl? | ||
| %w[CREATE_TABLE CREATE_TABLE_AS_SELECT DROP_TABLE CREATE_VIEW \ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| end | ||
|
|
||
| def dml? | ||
| %w[INSERT UPDATE DELETE].include? statement_type |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| end | ||
|
|
||
| def dml? | ||
| %w[INSERT UPDATE DELETE].include? statement_type |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| end | ||
|
|
||
| def ddl? | ||
| %w[CREATE_TABLE CREATE_TABLE_AS_SELECT DROP_TABLE CREATE_VIEW \ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| def data token: nil, max: nil, start: nil | ||
| return nil unless done? | ||
|
|
||
| if ddl? || dml? |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@tswast I updated totalRows to be |
[closes #2141]