You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Desired: Given the following schema: [ 'ID', 'Name', 'Description'], a record { 'id': 1, 'Name': 'John Doe' } should successfully write to the shapefile either with an empty value for Description or possibly a pre-defined default value.
Actual: "ValueError: Record does not match collection schema" is raised.
Operating system
Mac OS X 10.14.2.
Fiona and GDAL version and provenance
Fiona 1.8.4 MacOS wheel installed with pip 18.1, Python 3.7.2
GDAL 2.3.1 installed via Homebrew
The text was updated successfully, but these errors were encountered:
Not sure if the comment about defaultdict got deleted or something else happened. I did try using a defaultdict, but unfortunately that did not work either.
Could there possibly be an optional "strict" vs. "loose" schema validation that defaults to "strict" to prevent users from accidentally doing something they don't want to?
@klinden defaultdict almost works, but Fiona compares schema and feature properties keys and that's where defaultdict fails.
This is a reasonable feature request and related to others. In my mind, it's a bit blocked by discussion about the future of Fiona's schema system and properties validation, and will have to wait for a while.
I've got a stopgap solution, which you may have already considered, in which case I apologize. You always know the properties schema for a Collection opened in any mode. If your features are coming from another system that doesn't know this schema or only has a partial view of it, you can overlay those feature properties on default values using the standard behavior of Python's dict type:
Expected behavior and actual behavior.
Desired: Given the following schema: [ 'ID', 'Name', 'Description'], a record { 'id': 1, 'Name': 'John Doe' } should successfully write to the shapefile either with an empty value for Description or possibly a pre-defined default value.
Actual: "ValueError: Record does not match collection schema" is raised.
Operating system
Mac OS X 10.14.2.
Fiona and GDAL version and provenance
Fiona 1.8.4 MacOS wheel installed with pip 18.1, Python 3.7.2
GDAL 2.3.1 installed via Homebrew
The text was updated successfully, but these errors were encountered: