john-bodley opened a new pull request #5445: [wtforms] Using wtforms-json which prevents encoding empty strings in the database URL: https://github.com/apache/incubator-superset/pull/5445 This issue has been plaguing me for some time, though the actual fix was somewhat trivial. FAB uses [WTForms](https://github.com/wtforms/wtforms) which regrettably coerces a `None` value into an empty string per [here](https://github.com/wtforms/wtforms/blob/3d5af963f060add8e42a99bec880321e8d2b41b3/src/wtforms/fields/core.py#L610). This means that for the database tables associated with forms string/text columns include a combination of `NULL` of empty strings (alongside non-empty values). The fix is to use the [wtforms-json](https://github.com/kvesteri/wtforms-json) package which adds supports for `None` types per [here](http://wtforms-json.readthedocs.io/en/latest/#what-does-it-do). The package monkey patches the processing of the field and assigns the default value (`None`) when the value evaluates to [false](https://github.com/kvesteri/wtforms-json/blob/master/wtforms_json/__init__.py#L200) which includes empty strings. This PR also performs the necessary migration to retroactively resolve all forms which have encoded empty strings in the database. to: @graceguo-supercat @michellethomas @mistercrunch @timifasubaa
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
