[QGIS-Developer] pyqgis: new sqlite layer - no records in attribute table

Jürgen E. Fischer jef at norbit.de
Mon Nov 6 08:17:18 PST 2017


Hi Martin,

On Mon, 06. Nov 2017 at 16:51:30 +0100, Martin Landa wrote:
> layer = QgsVectorLayer("test.sqlite", "test", "ogr") # empty layer
> created by GDAL
> layer.dataProvider().addAttributes([...])
> layer.updateFields()

Don't use the provider directly, but the layer, ie. startEditing, addFeature,
commitChanges - or layer.reload() after changing via the provider.

Jürgen

-- 
Jürgen E. Fischer           norBIT GmbH             Tel. +49-4931-918175-31
Dipl.-Inf. (FH)             Rheinstraße 13          Fax. +49-4931-918175-50
Software Engineer           D-26506 Norden             http://www.norbit.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20171106/a7c53b6c/attachment.sig>


More information about the QGIS-Developer mailing list