I'm trying to check if an item is in the database before attempting to delete it as part of my test setup.
The issue: The 'Check if Exists in Database' keyword works on its own, but not when combined with the built in keyword 'Run Keyword and Return Status'.
that gets the error: 'InterfaceError: not a query'
Code is below:
***Settings***
Documentation RF DB Test
Library DatabaseLibrary
***Variables***
${token} '<token>'
***Test Cases***
Set Log Level
Set Log Level TRACE
Connect to DB
Connect To Database Using Custom Params cx_Oracle <connection details>
Cleanup DB
${EntryExists}= Run Keyword and Return Status Check if Exists in Database select * from MY_TABLE where token=${token}
Edit
Thanks for your formatting answers and suggestions folks. I also received the error for this line
Query delete from MY_TABLE where token=${token}
10:14:40.984 FAIL InterfaceError: not a query 10:14:40.984 DEBUG Traceback (most recent call last): File "...Python\Python35\lib\site-packages\DatabaseLibrary\query.py", line 56, in query allRows = cur.fetchall()
Basically, I was trying to use the delete command with the Query keyword, but found that the undocumented keyword 'Execute Sql String' worked
Execute Sql String delete from MY_TABLE where token=${token}
Check if Exists in Databaseand the query statement. Also, please show the complete and exact error message. - Bryan Oakley