File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1139,7 +1139,9 @@ class Dataset extends ServiceObject {
11391139 }
11401140
11411141 query ( options : Query ) : Promise < QueryRowsResponse > ;
1142+ query ( options : string ) : Promise < QueryRowsResponse > ;
11421143 query ( options : Query , callback : SimpleQueryRowsCallback ) : void ;
1144+ query ( options : string , callback : SimpleQueryRowsCallback ) : void ;
11431145 /**
11441146 * Run a query scoped to your dataset.
11451147 *
@@ -1151,7 +1153,7 @@ class Dataset extends ServiceObject {
11511153 * @returns {Promise<QueryRowsResponse> } See {@link BigQuery#query} for full documentation of this method.
11521154 */
11531155 query (
1154- options : Query ,
1156+ options : Query | string ,
11551157 callback ?: SimpleQueryRowsCallback
11561158 ) : void | Promise < QueryRowsResponse > {
11571159 if ( typeof options === 'string' ) {
Original file line number Diff line number Diff line change @@ -2271,6 +2271,7 @@ class Table extends common.ServiceObject {
22712271 }
22722272
22732273 query ( query : Query ) : Promise < SimpleQueryRowsResponse > ;
2274+ query ( query : string ) : Promise < SimpleQueryRowsResponse > ;
22742275 query ( query : Query , callback : SimpleQueryRowsCallback ) : void ;
22752276 /**
22762277 * Run a query scoped to your dataset.
@@ -2281,9 +2282,14 @@ class Table extends common.ServiceObject {
22812282 * @returns {Promise<SimpleQueryRowsResponse> }
22822283 */
22832284 query (
2284- query : Query ,
2285+ query : Query | string ,
22852286 callback ?: SimpleQueryRowsCallback
22862287 ) : void | Promise < SimpleQueryRowsResponse > {
2288+ if ( typeof query === 'string' ) {
2289+ query = {
2290+ query,
2291+ } ;
2292+ }
22872293 this . dataset . query ( query , callback ! ) ;
22882294 }
22892295
Original file line number Diff line number Diff line change @@ -2784,7 +2784,7 @@ describe('BigQuery/Table', () => {
27842784 describe ( 'query' , ( ) => {
27852785 it ( 'should pass args through to datasetInstance.query()' , done => {
27862786 table . dataset . query = ( a : { } , b : { } ) => {
2787- assert . strictEqual ( a , 'a' ) ;
2787+ assert . deepStrictEqual ( a , { query : 'a' } ) ;
27882788 assert . strictEqual ( b , 'b' ) ;
27892789 done ( ) ;
27902790 } ;
You can’t perform that action at this time.
0 commit comments