Skip to content

Allow unquoted comma-containing favorite queries to be saved in ~/.myclirc - #2340

Merged
rolandwalker merged 1 commit into
mainfrom
RW/allow-unquoted-comma-containing-favorite-queries
Oct 7, 2026
Merged

rolandwalker merged 1 commit into
mainfrom
RW/allow-unquoted-comma-containing-favorite-queries

Conversation

@rolandwalker

Copy link
Copy Markdown
Contributor

Description

ConfigObj returns a list when it sees a comma, so mycli was capable of saving an item it could not read back on restart.

The fix is for values in the favorite_queries stanza to be treated differently, and never to be read in as a list.

Favorite queries are all triple-quoted on save, and there is an on-the-fly hack to the reader to triple-quote any favorite from past saves which are not triple-quoted.

There could be other stanzas of the config file which should have the same treatment.

Shipping this with one minor limitation noted in comments: saving SQL with both possible triple-quote delimiters as values internal to the SQL text is not possible.

Fixes #2339

Checklist

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

@rolandwalker rolandwalker self-assigned this Oct 7, 2026
@rolandwalker

Copy link
Copy Markdown
Contributor Author

This is more complex than I'd like it to be. It could be simpler to just entirely turn off ConfigObj's ability to interpret values as lists, and then hand-parse an enumerated list of keys which should have lists as values.

to be saved in ~/.myclirc.

ConfigObj returns a list when it sees a comma, so mycli was capable of
saving an item it could not read back on restart.

The fix is for values in the favorite_queries stanza to be treated
differently, and never to be read in as a list.

Favorite queries are all triple-quoted on save, and there is an
on-the-fly hack to the reader to triple-quote any favorite from past
saves which are not triple-quoted.

There could be other stanzas of the config file which should have the
same treatment.

Shipping this with one minor limitation noted in comments: saving SQL
with _both_ possible triple-quote delimiters as values internal to the
SQL text is not possible.
@rolandwalker
rolandwalker force-pushed the RW/allow-unquoted-comma-containing-favorite-queries branch from 256fd70 to 4c219d8 Compare October 7, 2026 16:32
@rolandwalker
rolandwalker merged commit 9933e4d into main Oct 7, 2026
12 checks passed
@rolandwalker
rolandwalker deleted the RW/allow-unquoted-comma-containing-favorite-queries branch October 7, 2026 16:38
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.

Favorite queries containing commas are saved unquoted and crash the completer on reload

1 participant