-
Notifications
You must be signed in to change notification settings - Fork 211
MotherDuck plugin for DuckDB #511
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
base: main
Are you sure you want to change the base?
Conversation
Hi folks! If there's any more information you need from me, please let me know. Thanks! |
Hi! Just checking in on this again. Thanks! |
Is it fair to assume that the shell extensions project is dead? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! 😄
I've left a couple of improvements that I've seen by trying out MotherDuck myself.
plugins/motherduck/duckdb.go
Outdated
"github.com/1Password/shell-plugins/sdk/schema/credname" | ||
) | ||
|
||
func NotWhenAnyArgsContain(argsSequence ...string) sdk.NeedsAuthentication { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment on what this custom implementation does and why it is needed and can't be built with the existing functions?
That can increase the confidence that this plugin behaves as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced this with a more specific helper function. We only use need to authenticate with 1password if the connection string contains 'md:' but motherduck_token is not specified in the connection string and not set as an environment variable.
@edif2008 Thanks for the review, and sorry for the delayed response! I'll address your comments soon. |
If you're new to commit signing, there are different ways to set it up: Sign commits with
|
- length is not fixed so remove - token can include . and _
…duck. Defer to environment variable or provided token value if either is set.
4620375
to
14818e7
Compare
@edif2008 This should be ready for another look. Thanks! |
@edif2008 One design choice I'm not sure how to address that I'd love advice on. As it is now, if the user has set Ideally this would be something you could configure when you initialize the plugin, but I'm not sure if there's a good way to do that, but I'm not sure if that's supported. Other than that I think this is ready to go. Let me know if there's anything else I should address. Thanks! |
I've been using this locally now and it's been pretty convenient. I'd love to get it officially supported so I could promote it to people. Thanks! |
Overview
Creating a plugin for the DuckDB CLI to allow you to securely store your MotherDuck token using 1password.
Type of change
Related Issue(s)
How To Test
The plugin is used when the
duckdb
CLI is called and the user attempts to connect to MotherDuck without providing a token via environment variable or as part of the connection string.This would require authentication with 1password:
duckdb 'md:'
.From the DuckDB CLI interface, if you run
PRAGMA PRINT_MD_TOKEN;
it should print out the token that you have stored in 1password.These would not require authentication with 1password:
duckdb
duckdb localdb.ddb
duckdb 'md:my_db?motherduck_token=<motherduck_token>
motherduck_token=<motherduck_token> duckdb 'md:'
You can test that it uses the token from the connection string or environment variable (rather than 1password) by running the following commands:
duckdb 'md:my_db?motherduck_token=<motherduck_token> -c 'PRAGMA print_md_token'
motherduck_token=<motherduck_token> duckdb 'md:' -c 'PRAGMA print_md_token'
The token that is printed out should match the provided token rather than the one saved in 1password.
Changelog