Skip to content

Comments

Add no prompt exit option to repl#2758

Open
remisalmon wants to merge 5 commits intosnowflakedb:mainfrom
remisalmon:add-no-prompt-exit
Open

Add no prompt exit option to repl#2758
remisalmon wants to merge 5 commits intosnowflakedb:mainfrom
remisalmon:add-no-prompt-exit

Conversation

@remisalmon
Copy link

Pre-review checklist

  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated automated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • I've confirmed that my changes are working by executing CLI's commands manually on MacOS.
  • I've confirmed that my changes are working by executing CLI's commands manually on Windows.
  • I've confirmed that my changes are up-to-date with the target branch.
  • I've described my changes in the release notes.
  • I've described my changes in the section below.
  • I've described my changes in the documentation.

Changes description

This is adding a --no-prompt-exit option to the snow sql command to exit without getting prompted; tested locally.

@remisalmon remisalmon requested a review from a team as a code owner February 9, 2026 21:13
if self._next_input == default_text:
self._next_input = None

def yn_prompt(self, msg: str) -> str:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was only being called from the ask_yn function and can just be moved there?

Copy link
Contributor

@sfc-gh-jwilkowski sfc-gh-jwilkowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I like the idea, but I think it would be more useful you could set that as in config.toml or as env variable. You can find a similar implementation in _decimal_precision_callback. To make it clear that it's scoped only to repl, maybe it will be better to be explicit about it in the name, so something like no_prompt_exit_repl?

Please also add some unit tests for this change, here you'll find some examples

single_transaction = bool(single_transaction)
std_in = bool(std_in)

if no_prompt_exit_repl is None:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This follows the same order of precedence documented in https://docs.snowflake.com/en/developer-guide/snowflake-cli/connecting/configure-connections:

  • Command-line parameters
  • Environment variables overriding specific config.toml parameters, such as SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD
  • Connections defined in config.toml file manually or using snow connection add command

@remisalmon
Copy link
Author

Thanks for your contribution! I like the idea, but I think it would be more useful you could set that as in config.toml or as env variable. You can find a similar implementation in _decimal_precision_callback. To make it clear that it's scoped only to repl, maybe it will be better to be explicit about it in the name, so something like no_prompt_exit_repl?

Please also add some unit tests for this change, here you'll find some examples

Thank you for taking a look at this. I renamed the option and added a the and environment variable and config check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants