connect to database psycopg2 connectiondetails
${count}= row count select count(*) from trial;
log to console ${count}
-----Here m getting result as [(2,)] ,though I want to compare this result with the string as value '2'. How to grab that from list.
CodePudding user response:
The Query results are always returned like that; a list with a tuple, or using an option returnAsDict
You access the value by indexing, or convert to other format. In your example:
# ${count} is [(2,)]
log to console ${count[0][0]}
But if you look to the example of Row Count
in the documentation, you see that they don't use the count(*)
, so your code should be:
${count}= row count select * from trial;
log to console ${count}