Skip to main content

Hi,

 

I'm trying to dynamically write some features to a Geopackage, but constantly get the error `OGCGEOPACKAGE writer: OGCGEOPACKAGE writer: For feature type 'd_y_n', primary key attribute 'fid' has unsupported type 'mediumint'. Primary key must have type 'int'`.

 

I'm reading the schema and features with a FeatureReader, from a PostGIS database.

 

Dynamic writers for other formats seem to be working fine (obviously not tried them all!). And I've tried manually changing the schema in the workbench (by altering the native type attribute), which also doesn't work.

 

If I manually set the output schema it works, but I can't do that...

 

Any ideas how I could resolve this issue?

 

(Using FME 2021.2 on MacOS)

Hello @Andy E​ , thanks for posting to the FME Community.

It seems like FME is trying to write a 32b integer when its expecting a 64b integer. We can try and use an AttributeCreator to fix this, (see image below):

 

force64bInteger 

Add an AttributeCreator before your Writer, and on your FID attribute, use the following to convert it to 64b integer:

 

@int64(@Value(fid))

 

I think this should allow FME to properly map it. If you try this and it doesn't resolve the issue, please let me know. Best, Kailin.


Hello @Andy E​ , thanks for posting to the FME Community.

It seems like FME is trying to write a 32b integer when its expecting a 64b integer. We can try and use an AttributeCreator to fix this, (see image below):

 

force64bInteger 

Add an AttributeCreator before your Writer, and on your FID attribute, use the following to convert it to 64b integer:

 

@int64(@Value(fid))

 

I think this should allow FME to properly map it. If you try this and it doesn't resolve the issue, please let me know. Best, Kailin.

Thanks.

 

In my case I was using a dynamic schema, so I checked the attribute list for a fme_data_type value of "fme_int32,PrimaryKey" and replaced it with "fme_int64,PrimaryKey".


@kailinatsafe​ @Andy E​ How did you solve it for the dynamic writer? I have not been able to find where/how I can replace "fme_int32,PrimaryKey" with "fme_int64,PrimaryKey"


@kailinatsafe​ @Andy E​ How did you solve it for the dynamic writer? I have not been able to find where/how I can replace "fme_int32,PrimaryKey" with "fme_int64,PrimaryKey"

For a dynamic schema, you need to edit the attribute list on the schema feautre(s).

I did this by exploding the attribute list, testing for any "fme_data_type" attributes with a value of "fme_int32,PrimaryKey" and changing those to "fme_int64,PrimaryKey". Then you need to rebuild the list and merge that back on to the schema feature.

Modifying Schema FeatureI also found in some cases I needed to add an entirely new Primary Key attribute for some tables that used non-numeric primary keys, you can use a creator to add a new feature in to the ListBuilder (and also remember to add attribute with the same name to the features too, using a counter is easiest).


Reply