Skip to main content
edited title
Link
ahmadhanb
  • 41.4k
  • 5
  • 54
  • 109

Is there a sequence stored in a qgisQGIS layer that can be accessed via pyqgis?

Source Link

Is there a sequence stored in a qgis layer that can be accessed via pyqgis?

I have a layer from spatialite. When I add a feature I want to know it's identifier (based on the primary key (integer) which is auto-incremental : for example XXXXXX-72) before the creation on the entity (attributeForm OK + commit) by using pyqgis.

My issue is when i delete one or several features. I can predict the next identifier only if I know how many features I've deleted which will quasi never be the case.

I can only access the number of features or every unique id but that doesn't help much when, for example, the last three features were deleted.

Is it possible to access the sequence of the table that store every unique identifier ?