SQL Database automation Using Robot Frame work

I would like to share some issues which I am facing in robot framework like,
1 how to create a table util Keywords for below statement
${output}= Query CREATE TABLE if not exists ${DBName}.${table_name} (PersonID int,Player_name varchar(255),Salary int, PRIMARYKEY(PersonID));
here each column have attribute COL_Name, data type , and constraints (like Null)
values get varied.
2 ${output} not returning any output it shows as empty while executing query successfully.
Thanks in advance.


Hi @Vishwa,

Which type of SQL database are you connected to?

If I remember correctly most (all?) SQL variants don’t return anything for a CREATE TABLE query, at least not table columns maybe just a Boolean return state like true or false or maybe an Integer with the number of columns, pretty sure it’s the same with Insert where you at most get number of rows created.

Perhaps you need to combine the CREATE TABLE with a SELECT and wrap the whole thing in a SQL TRANSACTION?

That’s the reason I asked which type of SQL database are you connected to? this behaviour can vary from database engine to database engine, and DatabaseLibrary can only return to your test what the database server returned to it.


1 Like

You should use Query only when using SELECT commands.
In this case you can use Execute SQL String.

Here is a screen capture of RIDE and the documentation of those keywords.