You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/05/19 03:54:31 UTC

[GitHub] [incubator-superset] john-bodley commented on a change in pull request #9734: feat: implement csv upload configuration func for the schema enforcement

john-bodley commented on a change in pull request #9734:
URL: https://github.com/apache/incubator-superset/pull/9734#discussion_r427013763



##########
File path: superset/db_engine_specs/base.py
##########
@@ -454,55 +452,27 @@ def df_to_sql(cls, df: pd.DataFrame, **kwargs: Any) -> None:
         df.to_sql(**kwargs)
 
     @classmethod
-    def create_table_from_csv(cls, form: Form, database: "Database") -> None:
+    def create_table_from_csv(  # pylint: disable=too-many-arguments
+        cls,
+        filename: str,
+        table_name: str,

Review comment:
       This could be a good candidate for the [Table](https://github.com/apache/incubator-superset/blob/3cc540019f2aa6c3dac1d356f0f21eeca96b34f2/superset/sql_parse.py#L56) class (which may also remove the need for the `pylint` override).

##########
File path: superset/db_engine_specs/hive.py
##########
@@ -128,33 +134,19 @@ def convert_to_hive_type(col_type: str) -> str:
                 "No upload bucket specified. You can specify one in the config file."
             )
 
-        table_name = form.name.data
-        schema_name = form.schema.data
-
-        if config["UPLOADED_CSV_HIVE_NAMESPACE"]:
-            if "." in table_name or schema_name:
-                raise Exception(
-                    "You can't specify a namespace. "
-                    "All tables will be uploaded to the `{}` namespace".format(
-                        config["HIVE_NAMESPACE"]
-                    )
-                )
-            full_table_name = "{}.{}".format(
-                config["UPLOADED_CSV_HIVE_NAMESPACE"], table_name
+        if "." in table_name and schema_name:

Review comment:
       Is this coming from a form? If so it would be best to add the validation check there. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org