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.
It turns out Dolt needs to have control over how
sql.Session
s are created, and it needs to modify the*sql.Context
prior to query execution. This MR adds two interfaces:driver.SessionBuilder
driver.ContextBuilder
When a driver is created, with
driver.New
, if the provider implements either of these interfaces, then the provider's implementation will be used for creating sessions/contexts. Otherwise, a default implementation is used. The Dolt provider can then implement those two interfaces and do the necessary work to setup the session/context:doltSession.AddDB
doltDatabase.SetRoot
sqle.RegisterSchemaFragments
Prior to adding
SessionBuilder
, attempting to execute a query would panic, when Dolt attempts to coerce the session into a Dolt session. Prior to addingContextBuilder
, some features would not work - for example, queries had no access to uncommitted changes.For reference, this is the Dolt driver implementation I'm working on.