[storm] Type checking

Jamu Kakar jkakar at kakar.ca
Mon Feb 16 19:18:57 GMT 2009


Hi,

On Mon, Feb 16, 2009 at 7:03 PM, Ben Wilber <benwilber at gmail.com> wrote:
> This can, however, get overly complicated with complex types like
> datetimes and whatnot, but for something reasonably simple, like
> Unicode or Int, I feel defining the type once, in the model
> definition, and then trapping on impossible conversion exceptions
> should be sufficient.  But you're right that this is something pretty
> easy to do outside Storm.  In fact, I've started subclassing the Storm
> types to do the conversion as was suggested earlier, which is a pretty
> simple fix.

I'm on the "the default behaviour should not include automatic
coercion" side of the fence; however, I do think that many people
want what you want.  I wonder about providing this as an optional
feature of the column types.  For example, we could have a coerce
keyword:

id = Int(allow_none=False, coerce=True)

Another option would be to provide a global setting (or maybe even
per Store), something like:

storm.set_automatic_coercion(True)

or

store.set_automatic_coercion(True)

I think of those options, I like the coerce keyword option the best.
What do you think?

Thanks,
J.



More information about the storm mailing list