Open
Conversation
anujdh1
commented
Mar 18, 2026
driver/statement.go
Outdated
| query.Labels = map[string]string{ | ||
| "account_id": statement.connection.config.accountID, | ||
| } | ||
| logrus.Infof("bq driver: set job label account_id=%s", |
anujdh1
commented
Mar 18, 2026
driver/statement.go
Outdated
| } | ||
| if statement.connection.config.jobTimeout > 0 { | ||
| query.JobTimeout = statement.connection.config.jobTimeout | ||
| logrus.Infof("bq driver: set job timeout=%s", |
anujdh1
commented
Mar 19, 2026
driver/driver.go
Outdated
| config.location = fields[0] | ||
| } | ||
|
|
||
| logrus.Infof( |
Collaborator
Author
There was a problem hiding this comment.
remove the comment
anujdh1
commented
Mar 19, 2026
driver/driver.go
Outdated
| scopes: getScopes(u.Query()), | ||
| endpoint: u.Query().Get("endpoint"), | ||
| disableAuth: u.Query().Get("disable_auth") == "true", | ||
| accountID: u.Query().Get("account_id"), |
Collaborator
Author
There was a problem hiding this comment.
what happens if account ID is not set? we should fetch it best-effort
26b4d65 to
63821dc
Compare
Parse account_id and job_timeout from DSN query parameters and apply them to BigQuery queries: - account_id is set as a job label for server-side cost attribution - job_timeout sets JobTimeout on the query for bounded execution - Fix QueryContext to use caller's context instead of context.Background() DSN format: bigquery://project/dataset?account_id=X&job_timeout=5m
63821dc to
f212971
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
account_idandjob_timeoutfrom DSN query parameters inconfigFromUri()account_idas a BigQuery job label inbuildQuery()for server-side cost attribution; defaults to"UNSPECIFIED"when not set (best-effort, never fails)job_timeoutasJobTimeouton queries for bounded execution; parsing is best-effort (silently ignores invalid values)query.Read(ctx)intoquery.Run(ctx)+job.Read(ctx)inExecContext/QueryContextto get a job handlego job.Cancel(context.Background())to cancel the server-side BQ job (fire-and-forget, non-blocking)ExecContext,QueryContext,Exec,Query(keep pre-existinglogrus.DebugfinbuildParameterhelpers)logrusdependency fromdriver.goDSN format:
bigquery://project/dataset?account_id=X&job_timeout=5mNote on
JobTimeout: BigQuery'sJobTimeout(configuration.jobTimeoutMs) applies only to job execution time, not queue/pending time. If a job is waiting for slots, that wait does not count toward the timeout. The timeout clock starts when the job begins executing. BQ also floors the minimum timeout to 1 second.Test Plan
E2E Validation on dev-113 (via sdmain vendor)
Deployment: dev-113 | Test Account: jtijl1035 | GCP Project: spark-dev-113
turing-devops-serviceto dev-113jtijl1035, ingested 2 records, ran read querybq show -j:configuration.labels.account_id=jtijl1035configuration.jobTimeoutMs=300000(5 min)status.state=DONETimeout + Server-Side Cancellation Test
job_timeout=1msin DSN (BQ floors to 1 second minimum)bq show -j:status.errorResult.reason=stoppedstatus.errorResult.message=Job execution was cancelled: Job timed out after 1 secContext Cancellation
ExecContext/QueryContextsplit query execution intoRun+Readphasesjob.Read(ctx)fails andctx.Err() != nil, firesgo job.Cancel(context.Background())to cancel the BQ job server-sideaccount_idjobTimeoutMs: 300000)stoppedaccount_idUNSPECIFIEDjob_timeout