[PyQt] 256 record limit with QOdbc working with MS Access
Scott Price
scottmprice at gmail.com
Fri Nov 6 19:29:10 GMT 2009
Ville M. Vainio wrote:
> On Thu, Nov 5, 2009 at 8:41 PM, Scott Price <scottmprice at gmail.com> wrote:
>
>
>> Anyone have any idea why the query only returns 256 records? Any ideas on
>> where I can even start looking for the cause? Is this an Access limitation
>> or a PyQt limitation?
>>
>
> Your test case seems short enough to translate to C++ Qt with
> reasonable effort - it might be worth the shot. Certainly it's more
> likely a Qt / Access problem than a PyQt one.
>
>
Ville M. Vainio wrote:
> On Thu, Nov 5, 2009 at 8:41 PM, Scott Price <scottmprice at gmail.com> wrote:
>
>
>> Anyone have any idea why the query only returns 256 records? Any ideas on
>> where I can even start looking for the cause? Is this an Access limitation
>> or a PyQt limitation?
>>
>
> Your test case seems short enough to translate to C++ Qt with
> reasonable effort - it might be worth the shot. Certainly it's more
> likely a Qt / Access problem than a PyQt one.
>
>
Just a follow-up after I figured out what is going on.
In the documentation for QSqlQueryModel, I found out that in databases
that don't report the size of a query, you need to use
QSqlQueryModel.fetchMore() to force it to fetch the entire database. So
I added a line like this:
while qryModel.canFetchMore():
qryModel.fetchMore()
And it reports that the initial fetch grabs 256 records, while the
second command fetches the rest.
Digging a little more shows that QSqlDriver.hasFeature() will tell
whether a database supports reporting the size of a query. Running a
little command on that showed that QODBC and MS Access db's do not
report the size. Therefore leaving me with an incomplete query result
set until the .fetchMore() command is used... Ugh. That seems a Highly
unsatisfactory way of dealing with odbc requests on MS's part.
Thanks again,
Scott
More information about the PyQt
mailing list