Skip to content

Commit 74f2df0

Browse files
committed
Updated extra command logic
1 parent fe81ae7 commit 74f2df0

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

mycli/main.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ def output_res(results: Generator[tuple], start: float) -> None:
837837
threshold = 1000
838838
# If this is a watch query, offset the start time on the 2nd+ iteration
839839
# to account for the sleep duration
840-
if command is not None and command["type"] == "command" and command["name"] == "watch":
840+
if command is not None and command["name"] == "watch":
841841
watch_seconds = float(command["seconds"])
842842
if result_count > 0:
843843
start += watch_seconds
@@ -1353,7 +1353,14 @@ def run_query(self, query: str, new_line: bool = True) -> None:
13531353
for result in results:
13541354
# discard the optional command portion of the results
13551355
# tuple since it is not used here currently
1356-
title, cur, headers, status, *_ = result
1356+
try:
1357+
title, cur, headers, status, _ = result
1358+
except ValueError:
1359+
title, cur, headers, status = result
1360+
except Exception as e:
1361+
self.echo("An unexpected error has occurred.", err=True, fg="red")
1362+
self.logger.error(f"Error unpacking results: {e}")
1363+
sys.exit(1)
13571364
self.main_formatter.query = query
13581365
self.redirect_formatter.query = query
13591366
output = self.format_output(

mycli/packages/special/iocommands.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ def watch_query(arg: str, **kwargs) -> Generator[tuple, None, None]:
567567
for sql, title in sql_list:
568568
cur.execute(sql)
569569
command = {
570-
"type": "command",
571570
"name": "watch",
572571
"seconds": seconds,
573572
}

0 commit comments

Comments
 (0)