Invoke a single SQL statement and automatically close the HTTP connection when done.
(stmt)
| 132 | |
| 133 | |
| 134 | def _execute_sql(stmt): |
| 135 | """ |
| 136 | Invoke a single SQL statement and automatically close the HTTP connection |
| 137 | when done. |
| 138 | """ |
| 139 | with connect(crate.http_url) as conn: |
| 140 | c = conn.cursor() |
| 141 | try: |
| 142 | c.execute(stmt) |
| 143 | return c |
| 144 | except ConnectionError as e: |
| 145 | logfile = os.path.join(crate.logs_path, crate.cluster_name + '.log') |
| 146 | with open(logfile, 'r') as f: |
| 147 | logs = f.read() |
| 148 | msg = str(e) + '\n' + logs |
| 149 | raise ConnectionError(msg, e.error_trace) |
| 150 | |
| 151 | |
| 152 | def wait_for_schema_update(schema, table, column): |
no test coverage detected