Skip to content
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

Pass ctx properly in internal client.ExecuteStatement #242

Open
shelldandy opened this issue Aug 5, 2024 · 0 comments · May be fixed by #244
Open

Pass ctx properly in internal client.ExecuteStatement #242

shelldandy opened this issue Aug 5, 2024 · 0 comments · May be fixed by #244

Comments

@shelldandy
Copy link
Contributor

shelldandy commented Aug 5, 2024

// ExecuteStatement is a wrapper around the thrift operation ExecuteStatement
// If RecordResults is true, the results will be marshalled to JSON format and written to ExecuteStatement<index>.json
func (tsc *ThriftServiceClient) ExecuteStatement(ctx context.Context, req *cli_service.TExecuteStatementReq) (*cli_service.TExecuteStatementResp, error) {
ctx = startClientMethod(ctx, clientMethodExecuteStatement)
var log *logger.DBSQLLogger
log, ctx = LoggerAndContext(ctx, req)
msg, start := log.Track("ExecuteStatement")
// We use context.Background to fix a problem where on context done the query would not be cancelled.
resp, err := tsc.TCLIServiceClient.ExecuteStatement(context.Background(), req)

This needs to actually pass ctx so custom authenticators can make use of the context.

The bug was introduced here:

https://github.com/databricks/databricks-sql-go/pull/60/files#diff-3b1f8149deb45d304c69c856bcd1b9b628961fb6000486cb39172a99cb8de514L91-R90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant