-
Notifications
You must be signed in to change notification settings - Fork 443
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
Adds an option to return raw results from BigQuery #1872
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1872 +/- ##
============================================
+ Coverage 91.59% 91.65% +0.05%
- Complexity 4412 4421 +9
============================================
Files 305 305
Lines 13100 13110 +10
============================================
+ Hits 11999 12016 +17
+ Misses 1101 1094 -7
Continue to review full report at Codecov.
|
@@ -146,6 +146,9 @@ public function __construct( | |||
* **Defaults to** `10000` milliseconds (10 seconds). | |||
* @type int $maxRetries The number of times to poll the Job status, | |||
* until the job is complete. By default, will poll indefinitely. | |||
* @type bool $returnRawResults Returns the raw data types returned from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A common way to execute queries is through BigQueryClient::runQuery
which does a little magic to hide the interaction with the QueryResults
class. Could we please make sure to also surface configuration option there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Dave. I started looking into this and was hoping you could help me come with an example? In the snippet below I used the runQuery
command, get a result set back, and then pass the returnRawResults
option while retrieving rows.
$queryJobConfig = $bigQuery->query($query);
$queryResults = $bigQuery->runQuery($queryJobConfig);
$rows = $queryResults->rows(['returnRawResults' => true]);
foreach ($rows as $row) {
print_r($row);
}
Does this look like what you had in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close, I was thinking like this:
$queryResults = $bigQuery->runQuery($queryJobConfig, [
'returnRawResults' => true // make sure this is surfaced in the `runQuery` documentation
]);
foreach ($queryResults as $row) {
// ....
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dwsupplee - The option is being passed via the runQuery result now 👍
See #1287