[BioPython] biosql problem - AttributeError: 'Cursor' object has no attribute 'insert_id'

Bela Tiwari btiwari at ceh.ac.uk
Fri Nov 4 04:39:00 EST 2005


Hello,

I am new to using biopython and biosql. I have been following the information in the document Basic BioSQL with Biopython to try and get familiar with using biopython to work with mysql databases and specifically I have tried to load a Genbank file containing a small bacterial genome into a database.

I believe I have carried out all the instructions correctly (i.e. interpreted to fit the system I am working on - Debian Sarge). The code and traceback call that results is:

#############################
>>> from BioSQL import BioSeqDatabase
>>> from Bio import GenBank
>>> server = BioSeqDatabase.open_database(driver="MySQLdb", user="root", host="localhost", db="bioseqdb")
>>> db = server.new_database("testorama7")
>>> parser = GenBank.FeatureParser()
>>> iterator = GenBank.Iterator(open("CP000010.gbk"), parser)
>>> db.load(iterator)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.3/site-packages/BioSQL/BioSeqDatabase.py", line 414, in load
    db_loader.load_seqrecord(cur_record)
  File "/usr/lib/python2.3/site-packages/BioSQL/Loader.py", line 37, in load_seqrecord
    bioentry_id = self._load_bioentry_table(record)
  File "/usr/lib/python2.3/site-packages/BioSQL/Loader.py", line 225, in _load_bioentry_table
    taxon_id = self._get_taxon_id(record)
  File "/usr/lib/python2.3/site-packages/BioSQL/Loader.py", line 198, in _get_taxon_id
    taxon_id = self.adaptor.last_id("taxon")
  File "/usr/lib/python2.3/site-packages/BioSQL/BioSeqDatabase.py", line 148, in last_id
    return self.dbutils.last_id(self.cursor, table)
  File "/usr/lib/python2.3/site-packages/BioSQL/DBUtils.py", line 34, in last_id
    return cursor.insert_id()
AttributeError: 'Cursor' object has no attribute 'insert_id'
################################

I have seen information on the web suggesting that MySQLdb has undergone an API change such that the insert_id() function has moved from the cursor to the database object. Is it possible that such a change is at the core of my problem? Or have I just done something wrong?

I am working on Debian Sarge, using biopython version 1.40b (though I have checked the code for the latest release and nothing under BioSQL has changed). 

Any advice anyone has about how to sort out this error would be greatly appreciated.

cheers

Bela


*************************
Dr. Bela Tiwari
Lead Bioinformatician
NERC Environmental 
Bioinformatics Centre

CEH Oxford
Mansfield Road
Oxford, OX1 3SR
01865 281975

*************************


This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any views or opinions expressed are those of the author and do not represent the views of NERC unless otherwise explicitly stated. The information contained in this e-mail may be subject to public disclosure under the Freedom of Information Act 2000. Unless the information is legally exempt from disclosure, the confidentiality of this e-mail and your reply cannot be guaranteed.


*************************
Dr. Bela Tiwari
Lead Bioinformatician
NERC Environmental 
Bioinformatics Centre

CEH Oxford
Mansfield Road
Oxford, OX1 3SR
01865 281975

*************************


This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any views or opinions expressed are those of the author and do not represent the views of NERC unless otherwise explicitly stated. The information contained in this e-mail may be subject to public disclosure under the Freedom of Information Act 2000. Unless the information is legally exempt from disclosure, the confidentiality of this e-mail and your reply cannot be guaranteed.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Header
Type: application/octet-stream
Size: 1533 bytes
Desc: not available
Url : http://portal.open-bio.org/pipermail/biopython/attachments/20051104/a05f586a/Header-0001.obj


More information about the BioPython mailing list