[PyQt] writing SQL driver with PyQt
Gijs Molenaar
gijs at pythonic.nl
Thu Nov 13 14:54:07 GMT 2008
Phil Thompson wrote:
> 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.
>
Yes I saw too late that I was using the same name... I shouldn't write
code after 12 PM ;).
After some more strange SIP problems I have the driver partly working
now. The code is online; if somebody is interested:
https://gijs.pythonic.nl/svn/uva/adt/task4/monetdb-navigator/src/QtMonetdbDriver.py
Thanks for the reply!
- gijs
More information about the PyQt
mailing list