MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / _output_query

Method _output_query

mssqlcli/mssql_cli.py:380–393  ·  view source on GitHub ↗

Specifies how query output is handled

(self, output)

Source from the content-addressed store, hash-verified

378 return output
379
380 def _output_query(self, output):
381 """ Specifies how query output is handled """
382 if self.interactive_mode:
383 click.echo_via_pager('\n'.join(output))
384 else:
385 if self.output_file:
386 try:
387 with open(self.output_file, 'w', encoding='utf-8') as f:
388 click.echo('\n'.join(output), file=f)
389 except IOError as e:
390 click.secho(str(e), err=True, fg='red')
391 sys.exit(1)
392 else:
393 click.echo('\n'.join(output))
394
395 def run(self):
396 """ Spins up CLI. """

Callers 1

execute_queryMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected