Skip to main content
Question

OGC Geopackage Writer and UNIQUE constraint failed

  • 27 August 2020
  • 6 replies
  • 184 views

Hello dear Community,

Despite having a Sorter, DulicateFilter and Tester right out of the gate in my model, I still seem to be experiencing this issue on the ID field of my model -

 

OGCGEOPACKAGE writer: failed to execute insert : UNIQUE constraint failed

 

If I run it one at a time, it seems to work, but I'm trying to write to make different Geopackages, with 4 tables in each (with spatial data).

 

I've been racking my brain about this for some time, changing writers from manual to automatic, deleting any output data after each test run to ensure it's not conflicting, making sure there's no duplicates in the ID field that would trip up the writers, but to no avail - and wondered if anyone here may have a lifeline to throw me.

Thank you

6 replies

Userlevel 5

It is possible that the GeometryValidator is the culprit, if there are errors that lead to decomposed/split geometries.

Try moving the DuplicateFilters after the GeometryValidator.

Badge +4

Hi David, still no luck with this setup unfortunately

Badge +13

Hi Joe,

I have a similar issue. (How) were you able to solve it?

Badge +13

Hi Joe and others looking for this problem,

 

I think I found the solution. By default, the Primary Index Column is 'id'. If your data contains an attribute id, it gets mixed up. Creating an attribute id_gpkg for example bypasses the problem. I hope this helps.

 

id_gpkg  

 

Badge +4

Hi Joe and others looking for this problem,

 

I think I found the solution. By default, the Primary Index Column is 'id'. If your data contains an attribute id, it gets mixed up. Creating an attribute id_gpkg for example bypasses the problem. I hope this helps.

 

id_gpkg  

 

Hi Jelle, thank for this solution. I also ran into this problem. Apparently id is not allowed as an attribute name.

Badge +1

It is possible that the GeometryValidator is the culprit, if there are errors that lead to decomposed/split geometries.

Try moving the DuplicateFilters after the GeometryValidator.

For me this worked, I used a deaggregator (flattened at all levels) → Geometry Extractor → DuplicateFilter to remove all the duplicate geometries. 

Reply