[Biopython-dev] [Bug 2795] New: Add commit, rollback, close to DBServer object

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Fri Mar 20 17:32:50 UTC 2009


http://bugzilla.open-bio.org/show_bug.cgi?id=2795

           Summary: Add commit, rollback, close to DBServer object
           Product: Biopython
           Version: Not Applicable
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: BioSQL
        AssignedTo: biopython-dev at biopython.org
        ReportedBy: biopython-bugzilla at maubp.freeserve.co.uk


The DBServer object is defined in file BioSQL/BioSeqDatabase.py and it might
make sense to add the following methods to it:

    def commit(self):
        """Commits the current transaction to the database."""
        return self.adaptor.commit()

    def rollback(self):
        """Rolls backs the current transaction."""
        return self.adaptor.rollback()

    def close(self):
        """Close the connection. No further activity possible."""
        return self.adaptor.close()

I think the adaptor is intended to hide internal implementation details, so we
shouldn't be forcing people to use it directly for transaction support.
Consider this example from http://www.biopython.org/wiki/BioSQL currently:

from Bio import Entrez
from Bio import SeqIO
from BioSQL import BioSeqDatabase
server = BioSeqDatabase.open_database(driver="MySQLdb", user="root",
                     passwd = "", host = "localhost", db="bioseqdb")
db = server["orchids"]
handle = Entrez.efetch(db="nuccore", id="6273291,6273290,6273289",
rettype="genbank")
db.load(SeqIO.parse(handle, "genbank"))
server.adaptor.commit()

The last line would become just:

server.commit()

This seems cleaner.  Patch to follow...


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list