[Qgis-developer] Python Oracle getFeatures non working on non-geometric tables

mederic.ribreux mederic.ribreux at medspx.homenet.org
Tue Dec 9 08:47:19 PST 2014


I am trying to iterate over a non geographic table under PyQGis. The 
table is stored in an Oracle database and I use QGis Api to get the data 
(table is opened in a QGis project with Oracle provider). I have added 
primary key constraint to this table but I am not able to iterate 
through its features with the getFeatures() method. The following 
snippet always returns nothing:

layer = 
for f in layer.getFeatures():
   print f

I have tried with a geographic layer and there is no problem on this 
side because the above snippets prints a line for every feature in the 
table. I have also tried with opening the geographic table without 
geometry (geometry is "No Geometry"). In this configuration, I am not 
able to get access to the features...

I have tried to reproduce this on a PostgreSQL/PostGIS server and there 
is no bug: I am able to iterate over a non-geographic layer (even a 
geographic layer declared as non-geographic).

Is this a problem with the Oracle provider or just me having forgotten 
something in the table ?

Best regards


More information about the Qgis-developer mailing list