fix(motherduck): support motherduck_token in settings for direct profiles#734
Open
mjkanji wants to merge 1 commit into
Open
fix(motherduck): support motherduck_token in settings for direct profiles#734mjkanji wants to merge 1 commit into
mjkanji wants to merge 1 commit into
Conversation
…iles
In direct mode (path: "md:my_db"), motherduck_token in creds.settings was
neither consumed at connect time nor popped from settings, so
initialize_cursor would later re-issue SET motherduck_token = '...' on the
already-open connection — which the MotherDuck extension rejects as
init-only ("setting 'motherduck_token' can only be set during initialization").
Mirror the attach-branch behavior in update_connection_config: merge MD keys
from creds.settings into the connect config and pop them out of
creds.settings so they aren't re-applied via SET post-init.
Adds TestMDPluginWithSettings as a direct-mode counterpart to
TestMDPluginAttachWithSettings, subclassing TestMDPlugin to reuse all model
and assertion coverage with the settings-based profile shape.
Fixes duckdb#733
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.
Fixes #733.
What
For direct MotherDuck profiles (
path: "md:my_db"),motherduck_tokenincreds.settingswas neither consumed at connect time nor popped from settings, soinitialize_cursorwould later re-issueSET motherduck_token = '...'on the already-open connection — which the MotherDuck extension rejects as init-only:The
attachbranch already handled this correctly inconfigure_connection(set + pop). This PR mirrors that behavior inupdate_connection_configfor the direct branch: merge MD keys fromcreds.settingsinto the connect config and pop them out ofcreds.settingsso they aren't re-applied viaSETpost-init.Test
Adds
TestMDPluginWithSettingstotests/functional/plugins/motherduck/test_motherduck.pyas a direct-mode counterpart toTestMDPluginAttachWithSettings. It subclassesTestMDPluginto reuse all model and assertion coverage with the settings-based profile shape.The mocked
test_motherduck_user_agentcontinues to pass (verified locally).Other supported forms — unchanged
path: "md:my_db?motherduck_token=..."(worked before, still works)plugins: [{ module: motherduck, config: { token: ... } }](worked before, still works)