1
1
mirror of https://github.com/dbcli/pgcli.git synced 2024-10-04 09:17:08 +03:00

Merge pull request #1321 from dbcli/j-bennet/1320-redshift-status-rows

Add rowcount to status returned from redshift.
This commit is contained in:
Amjith Ramanujam 2022-03-01 20:28:47 -08:00 committed by GitHub
commit 43263a90d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -1,7 +1,10 @@
TBD
===
* [List new changes here].
Bug fixes:
----------
* Fix the bug with Redshift not displaying wor count in status ([related issue](https://github.com/dbcli/pgcli/issues/1320)).
3.4.0 (2022/02/21)
==================

View File

@ -1547,6 +1547,14 @@ def format_output(title, cur, headers, status, settings):
return data, headers
def format_status(cur, status):
# redshift does not return rowcount as part of status.
# See https://github.com/dbcli/pgcli/issues/1320
if cur and hasattr(cur, "rowcount") and cur.rowcount is not None:
if status and not status.endswith(str(cur.rowcount)):
status += " %s" % cur.rowcount
return status
output_kwargs = {
"sep_title": "RECORD {n}",
"sep_character": "-",
@ -1619,7 +1627,7 @@ def format_output(title, cur, headers, status, settings):
# Only print the status if it's not None and we are not producing CSV
if status and table_format != "csv":
output = itertools.chain(output, [status])
output = itertools.chain(output, [format_status(cur, status)])
return output