Conversation
Signed-off-by: Andre Furlan <[email protected]>
Signed-off-by: Andre Furlan <[email protected]>
Signed-off-by: Andre Furlan <[email protected]>
Signed-off-by: Andre Furlan <[email protected]>
Signed-off-by: Andre Furlan <[email protected]>
Signed-off-by: Andre Furlan <[email protected]>
Signed-off-by: Andre Furlan <[email protected]>
| excId, ok := ctx.Value(driverctx.ExecutionContextKey).(*Execution) | ||
| if !ok { | ||
| return nil | ||
| } | ||
| return excId |
There was a problem hiding this comment.
Nit: Since it's the Execution pointer and not Id being returned, perhaps use exc instead of excId
|
one idea to improve would be |
aldld
left a comment
There was a problem hiding this comment.
Took a quick look over, mainly focused on the interface. Looking forward to this!
| Authenticator string //TODO for oauth | ||
|
|
||
| RunAsync bool // TODO | ||
| RunAsync bool |
There was a problem hiding this comment.
Is there a particular reason why this is set at the config level, rather than on a per-query level? Or rather, is there any reason not to provide different methods for callers to use depending on whether they want the sync vs. async behaviour?
There was a problem hiding this comment.
no. It was the fastest way I got the PoC to work :-) . I have to think about the methods in the interface, maybe it does make sense to do as you say
| // i := v | ||
| // go func() { | ||
| // _, exc, err := db.QueryContext(ogCtx, fmt.Sprintf("select %s", i)) | ||
| rs, exc, err := db.QueryContext(ogCtx, `SELECT id FROM RANGE(100) ORDER BY RANDOM() + 2 asc`) |
There was a problem hiding this comment.
To make sure I'm understanding the semantics of this correctly:
- If the query has completed (direct results), then
rswill be set and the caller can fetch the results - Otherwise, the caller can use
excto get the operation ID(?), and use that to poll for query status?
There was a problem hiding this comment.
hi @aldld , that's the idea... there is more to the execution than the ID, but it is just data that can be saved and used later.
I am not very happy with the way to check the results yet with different methods to query, check, get results. There must be a simpler way to merge check and get results in the same call. See the example I added so you have an idea of what I am talking about.
PoC on one approach of supporting true async apis.
Goal
The goal is to support server restart while a query is running.
It is not the goal to support parallelism and non-blocking calls. These can easily be supported with go routines with the standard sql API.
API
Function and type names are not final.
sql.OpenDB(connector)works the same. No change. This is the synchronous API.dbsql.OpenDB(connector)is new. This is where the asynchronous APis live.So the user has to explicitly want to interact with asynchronous APIs.
dbsql.OpenDB()returns `DatabricksDB interface.The APIs support
DirectResults, which means that calls are synchronous up to 5s, then become asynchronous. The sql.Rows and sql.Result APIs remain exactly the same.Usage
A typical workflow would be something like: