youngyjd commented on a change in pull request #5787: Add schema level access
control on csv upload
URL:
https://github.com/apache/incubator-superset/pull/5787#discussion_r218953284
##########
File path: superset/forms.py
##########
@@ -66,8 +108,14 @@ def csv_enabled_dbs():
FileRequired(), FileAllowed(['csv'], _('CSV Files Only!'))])
con = QuerySelectField(
_('Database'),
- query_factory=csv_enabled_dbs,
+ query_factory=csv_allowed_dbs,
get_pk=lambda a: a.id, get_label=lambda a: a.database_name)
+ schema = StringField(
+ _('Schema'),
+ description=_('Specify a schema (if database flavour supports this).'),
+ validators=[Optional()],
+ widget=BS3TextFieldWidget(),
+ filters=[lambda x: x or None])
Review comment:
Took a quick look. I think the original author wrote this because that if no
`schema` is provided on the frontend, the backend will receive an empty string
which is `''`, but it should be `None` otherwise the database will throw some
kind of error like `schema does not exist`. So yes, I think it is just casting
falsy values, specifically `''` to `None`.
----------------------------------------------------------------
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]