[Biopython-dev] [Bug 2734] db.load problem with postgresql and psycopg2

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Mon Feb 16 13:00:53 UTC 2009


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


andrea at biodec.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrea at biodec.com




------- Comment #7 from andrea at biodec.com  2009-02-16 08:00 EST -------
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #3)
> > > 
> > > What versions of biopython and the BioSQL schema are you using?
> > > 
> > > Cymon
> > 
> > According to the bug report, Stephen was using Biopython 1.49, so:
> > 
> > Stephen:
> > Biopython 1.49
> > postgresql 8.2 
> > BioSQL - schema version unspecified
> > psycopg2 - version unspecified
> > python - version unspecified
> > OS - Mac OS X
> > 
> > What about you Cymon - you have postgresql with psycopg2 working, but what
> > versions of things?
> > 
> > Peter
> > 
> 
> Peter,
> 
> I'm using:
> Biopython: CVS
> Posgresql: 8.1.11
> BioSQL: 1.0.1
> Python: 2.5.2
> Psycopg: 2.0.8 
> OS: Red Hat Enterprise 5.3
> 
> C.
> 

Hi,
the problem, according to me, is already solved.
It seems that Stephen has an old version of Loader.py.

I submitted a bug and patch that explain that for Postgres
is not possible to have double quotes in queries ("). 
Double quotes are reserved to Column names.

In the correct Loader.py version everything is corrected
and there aren't double quotes in any queries at all.

Stephen, please check if:
  Loader.DatabaseLoader._get_seqfeature_dbxref

is equivalent to:

    def _get_seqfeature_dbxref(self, seqfeature_id, dbxref_id, rank):
        """ Check for a pre-existing seqfeature_dbxref entry with the passed
            seqfeature_id and dbxref_id.  If one does not exist, insert new
            data

        """
        # Check for an existing record
        sql = r"SELECT seqfeature_id, dbxref_id FROM seqfeature_dbxref " \
              r"WHERE seqfeature_id = '%s' AND dbxref_id = '%s'"
        result = self.adaptor.execute_and_fetch_col0(sql, (seqfeature_id,
                                                           dbxref_id))
        # If there was a record, return without executing anything, else create
        # the record and return
        if result:
            return result
        return self._add_seqfeature_dbxref(seqfeature_id, dbxref_id, rank)

maybe in your version, there are still double quotes ("%s") instead
of single quotes ('%s')

Andrea 


-- 
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