Sam's Lists escribió:
> This used to work pretty well under mysql but I'm now having trouble
> with the following under postgresql:
>
> #!/usr/bin/env python
>
> import sqlobject
> connection =
> sqlobject.connectionForURI("postgres://connection_string_here")
> sqlobject.sqlhub.processConnection = connection
>
> def qa(query):
>     print "\tRunnng query: ", query
>     return connection.queryAll(query)
>     print
>
> qa("drop table the_wines_backup")
>
> -----
>
> Now it does drop the table, so that's good.  But it also errors out
> with this error message:
>
>   Runnng query:  drop table the_wines_backup
> Traceback (most recent call last):
>   File "./adjustdb.py", line 13, in <module>
>     qa("drop table the_wines_backup")
>   File "./adjustdb.py", line 10, in qa
>     return connection.queryAll(query)
>   File
> "/usr/lib/python2.5/site-packages/SQLObject-0.10.2-py2.5.egg/sqlobject/dbconnection.py",
> line 350, in queryAll
>     return self._runWithConnection(self._queryAll, s)
>   File
> "/usr/lib/python2.5/site-packages/SQLObject-0.10.2-py2.5.egg/sqlobject/dbconnection.py",
> line 250, in _runWithConnection
>     val = meth(conn, *args)
>   File
> "/usr/lib/python2.5/site-packages/SQLObject-0.10.2-py2.5.egg/sqlobject/dbconnection.py",
> line 344, in _queryAll
>     value = c.fetchall()
> psycopg2.ProgrammingError: no results to fetch
>
>
> Any ideas what's wrong? 

The error is "no results to fetch", due you perform a drop table
statement, that does not retrieve any data. For this kind of operations
you can use connection.query() instead of queryAll(). It seems the only
difference between both is that queryAll also fetch the (assumed that
there exist) results.




-- jonhattan


>
> Thanks
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> ------------------------------------------------------------------------
>
> _______________________________________________
> sqlobject-discuss mailing list
> sqlobject-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>   


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to