Skip to content
Merged
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
6 changes: 5 additions & 1 deletion mycli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,11 @@ def format_output(
output_kwargs['missing_value'] = null_string

if use_formatter.format_name not in sql_format.supported_formats:
output_kwargs["preprocessors"] = (preprocessors.align_decimals,)
# will run before preprocessors defined as part of the format in cli_helpers
output_kwargs["preprocessors"] = (
preprocessors.convert_to_undecoded_string,
preprocessors.align_decimals,
)

if title: # Only print the title if it's not None.
output = itertools.chain(output, [title])
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies = [
"sqlparse>=0.3.0,<0.6.0",
"sqlglot[rs] == 27.*",
"configobj >= 5.0.5",
"cli_helpers[styles] >= 2.8.1",
"cli_helpers[styles] >= 2.9.0",
"pyperclip >= 1.8.1",
"pycryptodomex",
"pyfzf >= 0.3.1",
Expand Down
4 changes: 4 additions & 0 deletions test/test_tabular_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,7 @@ def description(self):
('abc', 1, NULL, 10.0e0, X'aa')
, ('d', 456, '1', 0.5e0, X'aabb')
;""")
# Test binary output format is a hex string
assert list(mycli.change_table_format("psql")) == [SQLResult(None, None, None, "Changed table format to psql")]
output = mycli.format_output(None, FakeCursor(), headers, False, False)
assert '0xaabb' in '\n'.join(output)