Skip to content

Conversation

@scottnemes
Copy link
Contributor

@scottnemes scottnemes commented Dec 19, 2025

Description

Adds support for the automatic displaying of warnings after a SQL statement is executed. Addresses feature request from issue #555.

May be set with:

  • Commands \W and \w
  • In the config file with show_warnings
  • With --show-warnings/--no-show-warnings on the command line

Note there is currently some errors from mypy about Cursor.warning_count, however I already submitted a PR to typeshed to get that updated so the errors will go away once the change makes it into mypy for types-PyMySQL.
python/typeshed#15150 (comment)

Checklist

  • I've added this contribution to the changelog.md.
  • I've added my name to the AUTHORS file (or it's already there).
  • I ran uv run ruff check && uv run ruff format && uv run mypy --install-types . to lint and format the code.

@rolandwalker
Copy link
Contributor

Outstanding! Looks like the type stubs will be updated tomorrow.

@rolandwalker rolandwalker merged commit 977d821 into dbcli:main Dec 20, 2025
8 of 9 checks passed
@scottnemes scottnemes deleted the feature/555/support-warnings branch December 24, 2025 16:13
@your-diary
Copy link

For those who read the release note of v1.42.0 to find this functionality and tried to use SELECT INTO @var with --show-warnings but got no automatic warning display, there is a follow-up PR to complete the feature that has NOT been released yet.

The PR says

Currently the new automatic show_warnings logic does not work for queries that return zero results, like DDL.

If you want to test the functionality in v1.42.0, try this:

SELECT 1 + '0 foo';

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.

3 participants