Skip to content

Commit

Permalink
Merge pull request #5 from Shopify/allow-disable-limit
Browse files Browse the repository at this point in the history
Allow disabling LIMIT clause
  • Loading branch information
tanner-bruce committed Jan 26, 2021
2 parents a6f4e31 + f330a95 commit ff94f9a
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
14 changes: 7 additions & 7 deletions dist/module.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/module.js.map

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion dist/partials/query.editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,16 @@
<gf-form-switch class="gf-form"
label="Convert time filters to UTC"
label-class="query-keyword"
checked="ctrl.target.convertToUTC"
checked="ctrl.target.convertToUTC">
</gf-form-switch>
</div>
<div>
<gf-form-switch class="gf-form"
label="Disable LIMIT"
label-class="query-keyword"
checked="ctrl.target.disableLimit">
</gf-form-switch>
</div>
<div class="gf-form">
<label class="gf-form-label query-keyword">Processing Location</label>
<div class="">
Expand Down
1 change: 1 addition & 0 deletions src/bigquery_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export default class BigQueryQuery {
target.timeColumn = target.timeColumn || '-- time --';
target.timeColumnType = target.timeColumnType || 'TIMESTAMP';
target.metricColumn = target.metricColumn || 'none';
target.disableLimit = target.disableLimit || false;
target.group = target.group || [];
target.where = target.where || [{ type: 'macro', name: '$__timeFilter', params: [] }];
target.select = target.select || [[{ type: 'column', params: ['-- value --'] }]];
Expand Down
2 changes: 1 addition & 1 deletion src/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ export class BigQueryDatasource {
q = this._updateAlias(q, modOptions, query.refId);
}
const limit = q.match(/[^]+(\bLIMIT\b)/gi);
if (limit == null) {
if (limit == null && !this.queryModel.target.disableLimit) {
const limitStatement = ' LIMIT ' + options.maxDataPoints;
const limitPosition = q.match(/\$__limitPosition/g);
if (limitPosition !== null) {
Expand Down
9 changes: 8 additions & 1 deletion src/partials/query.editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,16 @@
<gf-form-switch class="gf-form"
label="Convert time filters to UTC"
label-class="query-keyword"
checked="ctrl.target.convertToUTC"
checked="ctrl.target.convertToUTC">
</gf-form-switch>
</div>
<div>
<gf-form-switch class="gf-form"
label="Disable LIMIT"
label-class="query-keyword"
checked="ctrl.target.disableLimit">
</gf-form-switch>
</div>
<div class="gf-form">
<label class="gf-form-label query-keyword">Processing Location</label>
<div class="">
Expand Down

0 comments on commit ff94f9a

Please sign in to comment.