lutraconsulting / ostranslator-ii

A graphical QGIS plugin for loading Ordnance Survey MasterMap into PostGIS.
16 stars 8 forks source link

Import of v7 schema data results in error due to NULL fid #63

Open sb2259 opened 5 months ago

sb2259 commented 5 months ago

This looks like the behaviour described in #18.

I'm importing OSMM Topology data with v7 schema.

Tiles on the boundary appear to be missing the fid column. In other tiles fid is present with the usual 'osgb'+16 digit format. Where fid is missing, it gets imported with a NULL value, and this subsequently raises an error on import against the not-null constraint on the column.

For me, adding args.extend(['-forceNullable',]) towards the end of build_args() in utils.py did the trick. This prevents any not-null constraints making their way to the imported tables and avoids the error. If a unique or non-null fid is required, this can be dealt with after the import.

I seemed to get an ogc_fid primary key added to the imported data with and without this option, along with the original osgb fid values in a separate column.