Explorer
January 5, 2026
Solved
MySQL / MariaDB Connector
- January 5, 2026
- 3 replies
- 713 views
Hi, I'm doing some playbooks and I always need to make a code snippet after a MySQL Run query connector (SELECT) to get
- If query returns some data
- Number of rows query returns
My code snippet is always like this.
if isinstance({{vars.steps.Query_CMDB.data}},list: print(len({{vars.steps.Query_CMDB.data}})) else: print(0)As I know when query returns data it always returns an array with N dicts inside (rows). But when there is no data, only return "success", so if I try with jinja to run
{{vars.steps.Query_CMDB.data | count}} > 0Always return > 0 because when its "success" it counts the letters... There is a better way to avoid my "length" step? and only have the MySQL query step and after that, the decision step (if rows > 0 -> then X, else Y)
