-
Notifications
You must be signed in to change notification settings - Fork 211
feat: query client and basic query execution flow #1542
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
base: preview-9.x
Are you sure you want to change the base?
Conversation
leahecole
left a comment
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.
Meta comment that I want to have this be in a branch off of preview-9.x for now because I will be using preview-9.x as a release branch
|
|
||
| ], | ||
| "exclude": [ | ||
| "system-test/fixtures/sample/**/*.ts" |
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.
What's the reasoning behind this?
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.
I was getting an error to compile the code, because those fixtures are used for pack-n-play tests.
> @google-cloud/bigquery@0.1.0 compile
> tsc -p . && cp -r protos build/ && minifyProtoJson
system-test/fixtures/sample/src/index.ts:19:168 - error TS2307: Cannot find module '@google-cloud/bigquery' or its corresponding type declarations.
19 import {DatasetServiceClient, JobServiceClient, ModelServiceClient, ProjectServiceClient, RoutineServiceClient, RowAccessPolicyServiceClient, TableServiceClient} from '@google-cloud/bigquery';
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.
Another thing is failing is that npm run fix is failing because it's missing "eslint-plugin-prettier", I was going to add to package.json too.
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.
I figured out if you remove the added include and the exclude the system tests run fine - I would strongly prefer to not modify this file at all because it's templated. Made suggestion comments
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.
Oooo I see why you included it - lint. Ugh! This should probably get changed at the template level imho
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.
OH I can get what I want - no changes to this file, if we move query.ts to just be under system-test - would you be okay with that?
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.
Another thing is failing is that
npm run fixis failing because it's missing"eslint-plugin-prettier", I was going to add topackage.jsontoo.
I am not seeing this locally or in CI for other PRs, but I'll keep an eye out for it and try to repro
src/query/client.ts
Outdated
| /** | ||
| * QueryClient is a client for running queries in BigQuery. | ||
| */ | ||
| export class QueryClient { |
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.
I am feeling skeptical about this being a separate client and I need to think more about what I don't like.
One thing I can think of is that if it is going to be its own separate client, I would want to see if defined more similarly to the other clients - where we have it be a class attribute of the bigQueryClient rather than the other way around
src/query/client.ts
Outdated
| */ | ||
| constructor(options?: BigQueryClientOptions) { | ||
| this.client = new BigQueryClient(options); | ||
| this.projectId = ''; |
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.
could initializing this to empty string cause an issue later? Would initializing it as undefined be a better choice?
These questions may become obsolete if we structure this client like the other ones
| if (this.projectId) { | ||
| return; | ||
| } | ||
| const {jobClient} = this.getBigQueryClient(); |
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.
Should we be having this instead mess with the underlying job client rather than the centralized one?
Thinking about this though, I do now see why you want the knowledge of the centralized BigQueryClient's existence and how you're going to be using it
src/query/iterator.ts
Outdated
| * Asynchronously iterates over the rows in the query result. | ||
| */ | ||
| async *[Symbol.asyncIterator](): AsyncGenerator<Row> { | ||
| // TODO: implement iterator |
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.
note to make sure there's a tracking bug
src/query/query.ts
Outdated
| options?: CallOptions, | ||
| ): Query { | ||
| const q = new Query(client); | ||
| q.location = response.location ?? ''; |
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.
Is it actually okay if this is undefined? What are the consequences of setting this to empty string?
| "test/*.ts", | ||
| "test/**/*.ts", | ||
| "system-test/*.ts", | ||
| "system-test/**/*.ts", |
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.
| "system-test/**/*.ts", |
| ], | ||
| "exclude": [ | ||
| "system-test/fixtures/sample/**/*.ts" | ||
| ] |
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.
| ], | |
| "exclude": [ | |
| "system-test/fixtures/sample/**/*.ts" | |
| ] | |
| ] |
|
|
||
| ], | ||
| "exclude": [ | ||
| "system-test/fixtures/sample/**/*.ts" |
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.
I figured out if you remove the added include and the exclude the system tests run fine - I would strongly prefer to not modify this file at all because it's templated. Made suggestion comments
|
|
||
| ], | ||
| "exclude": [ | ||
| "system-test/fixtures/sample/**/*.ts" |
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.
Oooo I see why you included it - lint. Ugh! This should probably get changed at the template level imho
|
|
||
| ], | ||
| "exclude": [ | ||
| "system-test/fixtures/sample/**/*.ts" |
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.
OH I can get what I want - no changes to this file, if we move query.ts to just be under system-test - would you be okay with that?
|
|
||
| ], | ||
| "exclude": [ | ||
| "system-test/fixtures/sample/**/*.ts" |
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.
Another thing is failing is that
npm run fixis failing because it's missing"eslint-plugin-prettier", I was going to add topackage.jsontoo.
I am not seeing this locally or in CI for other PRs, but I'll keep an eye out for it and try to repro
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| import {BigQueryClient, BigQueryClientOptions} from '../bigquery'; |
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.
| import {BigQueryClient, BigQueryClientOptions} from '../bigquery'; | |
| import {BigQueryClient} from '../bigquery'; |
This PR introduces the new query client with basic query execution flow (no retries yet) covering the 3 use cases:
Implements long pooling of job status in the background to mark query as complete.
Towards #1541