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

Function fetch

salt/modules/sqlite3.py:79–96  ·  view source on GitHub ↗

Retrieve data from an sqlite3 db (returns all rows, be careful!) CLI Example: .. code-block:: bash salt '*' sqlite3.fetch /root/test.db 'SELECT * FROM test;'

(db=None, sql=None)

Source from the content-addressed store, hash-verified

77
78
79def fetch(db=None, sql=None):
80 """
81 Retrieve data from an sqlite3 db (returns all rows, be careful!)
82
83 CLI Example:
84
85 .. code-block:: bash
86
87 salt '*' sqlite3.fetch /root/test.db 'SELECT * FROM test;'
88 """
89 cur = _connect(db)
90
91 if not cur:
92 return False
93
94 cur.execute(sql)
95 rows = cur.fetchall()
96 return rows
97
98
99def tables(db=None):

Callers

nothing calls this directly

Calls 3

fetchallMethod · 0.80
_connectFunction · 0.70
executeMethod · 0.45

Tested by

no test coverage detected