datalite icon indicating copy to clipboard operation
datalite copied to clipboard

Handle Optional[] Types

Open tclancy opened this issue 3 years ago • 1 comments

I tried using this with a dataclass which contained a number of types marked Optional[type] and it failed with

datalite/commons.py in _convert_type(type_, type_overload)
     23         return type_overload[type_]
     24     except KeyError:
---> 25         raise TypeError("Requested type not in the default or overloaded type table."

I was able to work around this by defining the fields with default values but it feels like either should work.

tclancy avatar Apr 28 '21 00:04 tclancy

Yeah I agree, I don't have much time nowadays but this should be a part of a rewamp of the type system in general, the default behaviour should be to add NOT NULL when dealing with non-Optional types and Optional should remove that constraint.

ambertide avatar May 01 '21 11:05 ambertide