Return string output for the sql to be run.
(executor, sql, rows_as_list=True)
| 272 | |
| 273 | |
| 274 | def run(executor, sql, rows_as_list=True): |
| 275 | """Return string output for the sql to be run.""" |
| 276 | results = [] |
| 277 | |
| 278 | for result in executor.run(sql): |
| 279 | rows = list(result.rows) if (rows_as_list and result.rows) else result.rows |
| 280 | results.append({ |
| 281 | "preamble": result.preamble, |
| 282 | "header": result.header, |
| 283 | "rows": rows, |
| 284 | "postamble": result.postamble, |
| 285 | "status": result.status, |
| 286 | "status_plain": result.status_plain, |
| 287 | }) |
| 288 | |
| 289 | return results |
| 290 | |
| 291 | |
| 292 | def set_expanded_output(is_expanded): |