Run SQL query and return result CLI Example: .. code-block:: bash salt '*' oracle.run_query my_db "select * from my_table"
(db, query)
| 130 | |
| 131 | @depends("cx_Oracle", fallback_function=_cx_oracle_req) |
| 132 | def run_query(db, query): |
| 133 | """ |
| 134 | Run SQL query and return result |
| 135 | |
| 136 | CLI Example: |
| 137 | |
| 138 | .. code-block:: bash |
| 139 | |
| 140 | salt '*' oracle.run_query my_db "select * from my_table" |
| 141 | """ |
| 142 | log.debug("run query on %s: %s", db, query) |
| 143 | conn = _connect(show_dbs(db)[db]["uri"]) |
| 144 | return conn.cursor().execute(query).fetchall() |
| 145 | |
| 146 | |
| 147 | def show_dbs(*dbs): |