spotfiresoftware / spotfire-python

Package for Building Python Extensions to Spotfire®
Other
18 stars 6 forks source link

Errors when detecting the SBDF column export type when column has all missing values #6

Closed bbassett-tibco closed 2 years ago

bbassett-tibco commented 3 years ago

When exporting SBDF from Python (usually encountered as part of writing the outputs for a data function), some column types like String can't be inferred if the entire column is empty. The error is informative, but doesn't really indicate how one should handle that case.
spotfire.sbdf.SBDFError: cannot determine type for column 'EmptyString'; all values are missing

In TERR/R's SBDF import/export we handle the roundtrip data type declarations by attaching an attribute to the column containing the original Spotfire data type on import and using that, if defined, to declare a specific data type on Export. We probably should implement something similar for Python SBDF. See https://docs.tibco.com/pub/enterprise-runtime-for-R/6.0.0/doc/html/Language_Reference/SpotfireData/setSBDFExportTypes.html for how the TERR/R one works.

Issue migrated from TIBCO Software JIRA [PYSRV-227] created by jorobert

bbassett-tibco commented 3 years ago

I've added the Known Issue to all previously-released versions, back to 1.0.0. 

I've updated 1.3.0, but I'm sitting on pushing out the publication until after we're cleared to release.  This KI will carry forward for (as-yet-uncreated) versions 1.3.1, 1.4.0, and 1.0.3 unless it's fixed. 

Comment migrated from TIBCO Software JIRA originally by kroan

jaybazile commented 2 years ago

I have this same issue in Python when trying to export using 1.8.0

bbassett-tibco commented 2 years ago

Thanks to @jorobert for his work on the feature/set-column-types branch, which provided a very good starting point for what was checked in. It basically works thusly: