@@ -1273,7 +1273,7 @@ def format_output(
12731273 if title : # Only print the title if it's not None.
12741274 output = itertools .chain (output , [title ])
12751275
1276- if cur :
1276+ if headers or ( cur and title ) :
12771277 column_types = None
12781278 if isinstance (cur , Cursor ):
12791279
@@ -1283,7 +1283,7 @@ def get_col_type(col) -> type:
12831283
12841284 column_types = [get_col_type (tup ) for tup in cur .description ]
12851285
1286- if max_width is not None :
1286+ if max_width is not None and isinstance ( cur , Cursor ) :
12871287 cur = list (cur )
12881288
12891289 formatted = use_formatter .format_output (
@@ -1379,7 +1379,9 @@ def get_last_query(self) -> str | None:
13791379 is_flag = True ,
13801380 help = "Automatically switch to vertical output mode if the result is wider than the terminal width." ,
13811381)
1382- @click .option ("--show-warnings/--no-show-warnings" , is_flag = True , help = "Automatically show warnings after executing a SQL statement." )
1382+ @click .option (
1383+ "--show-warnings/--no-show-warnings" , "show_warnings" , is_flag = True , help = "Automatically show warnings after executing a SQL statement."
1384+ )
13831385@click .option ("-t" , "--table" , is_flag = True , help = "Display batch output in table format." )
13841386@click .option ("--csv" , is_flag = True , help = "Display batch output in CSV format." )
13851387@click .option ("--warn/--no-warn" , default = None , help = "Warn before running a destructive query." )
0 commit comments