Problem
In omniload.source.filesystem.adapter:resource_for_reader, we are currently using a very basic implementation to forward omniload reader hints to Polars read_xyz kwargs, which does not support casting ingress parameters (all str) to their designated target types as defined by Polars' function signature. In this spirit, the procedure currently just barely works for string argument types.
reader = reader.bind(**ref.hints)
Because no type conversion takes place, it is currently not possible to convey int, float, bool, nor any container types like list or dict.
Solution
Short-term, in order to forward all kwargs to polars.read_excel properly, let's either supply a custom mapper tailored to the problem at hand, or, more generic, introspect the target read_excel function to learn about relevant types at runtime to be able to automatically cast them to their expected types, when possible. For list and dict types, let's use compact JSON as serialized representation (no whitespace), when possible.
Outlook
In the long run, this could be another candidate for a more thorough approach using Pydantic.
Originally posted by @amotl in #123 (comment)
Problem
In
omniload.source.filesystem.adapter:resource_for_reader, we are currently using a very basic implementation to forward omniload reader hints to Polarsread_xyzkwargs, which does not support casting ingress parameters (allstr) to their designated target types as defined by Polars' function signature. In this spirit, the procedure currently just barely works for string argument types.Because no type conversion takes place, it is currently not possible to convey
int,float,bool, nor any container types likelistordict.Solution
Short-term, in order to forward all kwargs to polars.read_excel properly, let's either supply a custom mapper tailored to the problem at hand, or, more generic, introspect the target
read_excelfunction to learn about relevant types at runtime to be able to automatically cast them to their expected types, when possible. Forlistanddicttypes, let's use compact JSON as serialized representation (no whitespace), when possible.Outlook
In the long run, this could be another candidate for a more thorough approach using Pydantic.
Originally posted by @amotl in #123 (comment)