MSc Bioinformatics

PEP 249: Accessing databases from Python

PEP242 is a standard application programming interface (API) for accessing databases from Python. Having database drivers that conform to this standard means that it is possible to switch from one database server to another with minimal changes to your code.

In this practical you will write a Perl script to access a database and read some data from it. Initially you will simply extract some results and print them. We will then introduce a little bit of HTML so that you can extend this to print out some data from a database as an HTML table. You will simply place this in a file which you can then view with a web browser.

We have provided a single table in a database which you can query. This is not particularly good database design; it is set up simply to make this practical straightforward.

Download the lecture slides.