[PyQt] writing SQL driver with PyQt

Phil Thompson phil at riverbankcomputing.com
Thu Nov 13 14:47:21 GMT 2008


On Tue, 11 Nov 2008 00:46:21 +0100, Gijs Molenaar <gijs at pythonic.nl> wrote:
> Hi people,
> 
> I'm trying to write a QT SQL driver for monetdb, but I've not been
> successful. MonetDB is a database system that supports SQL and has
> python bindings. Please see attachment for my initial tryout. The code
> is far from complete, but I'm stuck at the beginning, the DriverCreator.
> 
> I subclass QSqlDriverCreatorBase To create a factory that returns
> monetdb SQL driver instances, but when I run it I get the error:
> 
> TypeError: QtSql.QSqlDriverCreatorBase represents a C++ abstract class
> and cannot be instantiated
> 
> So I assume that I'm not allowed to inherit this class from python. Am
> I'm doing something wrong or is it only possible to do this with a C++
> driver for now? This isn't really clear in the documentation or I can't
> find it.
> 
> Is there anybody here who knows more about this, or tried to do
> something similar?

SIP uses the class name to determine if it is a sub-class of an abstract
class (not very clever I admit). Your sub-class has the same name as the
abstract class. If you rename it the problem should go away.

Phil


More information about the PyQt mailing list