Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Bug Fixes
* Display `DATE` and `TIME` scalars returned by `.|` transforms.
* Stop truncating `/llm` table schemas at MySQL's `group_concat_max_len`.
* Allow backslash-escaped apostrophes in REPL queries with or without Polars transforms.
* Stop stripping trailing semicolons from favorite query names in listings.


Documentation
Expand Down
1 change: 1 addition & 0 deletions mycli/AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Contributors:
* François Pietka
* Frederic Aoustin
* Georgy Frolov
* goul4rt
* Heath Naylor
* Huachao Mao
* Ishaan Bhimwal
Expand Down
4 changes: 2 additions & 2 deletions mycli/packages/special_commands/favorite_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ def _set_query(self, config: Any, name: str, query: str) -> None:
config[self.section_name] = {}
config[self.section_name][name] = query

def list(self) -> list[str | None]:
return [self._clean_query(x) for x in self.config.get(self.section_name, {})]
def list(self) -> list[str]:
return list(self.config.get(self.section_name, {}))

def get(self, name) -> str | None:
return self._clean_query(self.config.get(self.section_name, {}).get(name, None))
Expand Down
8 changes: 8 additions & 0 deletions mycli_test/pytests/test_favoritequeries.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,3 +768,11 @@ def test_delete_restores_runtime_query_after_write_failure() -> None:
favorites.delete('existing')

assert config['favorite_queries'] == {'existing': 'select 1'}


def test_list_returns_names_unchanged() -> None:
config = read_config_file(StringIO('[favorite_queries]\n"q;" = SELECT 1\n'))
assert config is not None
favorites = FavoriteQueries(config)
assert favorites.list() == ['q;']
assert favorites.get('q;') == 'SELECT 1'