MCPcopy Index your code
hub / github.com/saltstack/salt / run_query

Function run_query

salt/modules/oracle.py:132–144  ·  view source on GitHub ↗

Run SQL query and return result CLI Example: .. code-block:: bash salt '*' oracle.run_query my_db "select * from my_table"

(db, query)

Source from the content-addressed store, hash-verified

130
131@depends("cx_Oracle", fallback_function=_cx_oracle_req)
132def 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
147def show_dbs(*dbs):

Callers 1

get_versionFunction · 0.70

Calls 6

show_dbsFunction · 0.85
debugMethod · 0.80
fetchallMethod · 0.80
cursorMethod · 0.80
_connectFunction · 0.70
executeMethod · 0.45

Tested by

no test coverage detected