How to access databases from RF?

799 views
Skip to first unread message

Claes

unread,
Apr 9, 2009, 5:39:44 AM4/9/09
to robotframework-users
How do you access databases from RF?

Have you built a database library or have you prepared scripts that
you start from RF?

I'm asking because it would be nice to be able to verify content in a
database from Robot Framework or even prepare a database for running
tests.

/Claes

Pekka Klärck

unread,
Apr 9, 2009, 3:32:29 PM4/9/09
to claes...@gmail.com, robotframework-users
2009/4/9 Claes <claes...@gmail.com>:

>
> How do you access databases from RF?
>
> Have you built a database library or have you prepared scripts that
> you start from RF?

I'm not aware of any generic, publicly available, database library for
Robot Framework.

> I'm asking because it would be nice to be able to verify content in a
> database from Robot Framework or even prepare a database for running
> tests.

Having such a library would be awesome. Are there enough people who
would be interested about this so that it would make sense to start a
separate project for it? Unfortunately the core development team
doesn't have resources to take responsibility of it but we definitely
can help.

One possible way to get started would be modifying Gojko Adzic's DbFit
[1] so that it supports RF. Robot's library API is pretty simple but
still flexible and this could actually be relative simple task. AFAIK
DbFit doesn't work with Python, though, but it ought to work with
Jython.

[1] http://gojko.net/fitnesse/dbfit/

Cheers,
.peke

chethan

unread,
Apr 15, 2009, 12:34:52 PM4/15/09
to robotframework-users
Robot Framework currently does not have any libraries specific to
database access.
Since RF s\ is completely in python, we can plug in python libraries
to access database and extend them to RF keywords.

One such good library is pyODBC. I have worked on this and can be used
to access MySQL, SQL Server and DB2.

Let me know if you need more information on this.

Cheers,
.cSp

On Apr 10, 12:32 am, Pekka Klärck <p...@iki.fi> wrote:
> 2009/4/9 Claes <claes.pi...@gmail.com>:

Claes

unread,
Apr 16, 2009, 3:42:06 AM4/16/09
to robotframework-users
> One such good library is pyODBC. I have worked on this and can be used
> to access MySQL, SQL Server and DB2.
>
> Let me know if you need more information on this.

In my specific case I have PostgreSQL, but I'd love to see your
pyODBC library.

/Claes

Himani

unread,
May 19, 2009, 5:42:45 AM5/19/09
to robotframework-users
Hi
Could you please tell me how to how to extend this library to RF
Keywords? I need to access Database from Robot Framework.
Thanks

chethan che

unread,
May 19, 2009, 9:12:39 AM5/19/09
to himani...@gmail.com, robotframework-users
Himani,
 
Can you let me know which DB you need to access.
In general follow the steps below:
 
1. Install pyODBC library.
2. Create keywords using the API.
 
 
Regards,
Chethan

Radek

unread,
May 19, 2009, 10:03:39 AM5/19/09
to robotframework-users
I wrote a simple DB library using SQLAlchemy (http://
www.sqlalchemy.org). It lets you access all databases once you have
python modules installed. The drawback here is that you can't use
Jython - I don't. They can probably be implemented for Jython using
some other library or with some limitations.

Here is a list of keywords my library provides.

Open Connection
Switch Connection
Close All Connections
Close Connection
Execute Sql
Get Row
Get Column Value
Get Column Values

I am thinking about giving the code to the project but have to ask for
permission and test on different systems.

--
Radek.

Pekka Klärck

unread,
May 19, 2009, 6:24:08 PM5/19/09
to rade...@gmail.com, robotframework-users
2009/5/19 Radek <rade...@gmail.com>:

>
> I wrote a simple DB library using SQLAlchemy (http://
> www.sqlalchemy.org). It lets you access all databases once you have
> python modules installed. The drawback here is that you can't use
> Jython - I don't. They can probably be implemented for Jython using
> some other library or with some limitations.

Very cool! Using SQLAlchemy is a good choice. It is a popular Python
module and it will very likely be supported on Jython sooner than
later:
http://wiki.python.org/jython/SqlAlchemyOnJython

> I am thinking about giving the code to the project but have to ask for
> permission and test on different systems.

I think DBLibrary should be a separate project similarly as e.g.
SeleniumLibrary and SwingLibrary. Interested to start such a project?
Anyone else here interested to help with it?

Cheers,
.peke

Radek

unread,
May 20, 2009, 9:35:03 AM5/20/09
to robotframework-users
> I think DBLibrary should be a separate project similarly as e.g.
> SeleniumLibrary and SwingLibrary. Interested to start such a project?
> Anyone else here interested to help with it?

I created a google project for it and I'm clearing it with my company.
I think all should be approved. It's really a simple at the moment but
I'm willing to expand it and contribute. Watch the project's page for
info:
http://code.google.com/p/robotframework-databaselibrary/

--
Radek.

Pekka Klärck

unread,
May 22, 2009, 12:53:36 PM5/22/09
to rade...@gmail.com, robotframework-users
2009/5/20 Radek <rade...@gmail.com>:

Awesome! I hope everyone who has been looking for DBLibrary for Robot
Framework gives this a shot and hopefully you also get some help
developing the library further. Feel free to use this list and
robotframework-devel for all discussion and questions related the new
library.

Cheers,
.peke

Himani

unread,
May 29, 2009, 1:53:05 AM5/29/09
to robotframework-users
Hi

I am using SQL Server 2008 on windows XP. I need to connect my Robot
Framework script to the database. How is it possible? Kindly help.

Thanks
> > > >     .peke- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages