How to store a result of SQL query as String in python

500 Views Asked by At

I am using Robot framework in python and I am running below query:

${queryResults1}=  query  select count(*) from table

It gives me below result:

${queryResults2} = [(91,)]

How to convert above result as String?

1

There are 1 best solutions below

0
Todor Minakov On BEST ANSWER

The response format is a list of tuples - as can also be seen by the sample you've pasted. Thus get the 1st column of the first row (in python/Robot Framework the lists are 0-based), and pass that to Convert To String:

${the value as string}=    Convert To String    ${queryResults1[0][0]}