john-bodley commented on a change in pull request #5303: [csv-hive] Use schema 
form field in upload csv
URL: 
https://github.com/apache/incubator-superset/pull/5303#discussion_r199312596
 
 

 ##########
 File path: superset/db_engine_specs.py
 ##########
 @@ -984,14 +984,22 @@ def convert_to_hive_type(col_type):
             return tableschema_to_hive_types.get(col_type, 'STRING')
 
         table_name = form.name.data
+        schema_name = form.schema.data
+
+        if '.' in table_name and schema_name:
+            raise Exception(
+                "You can't specify a namespace both in the name of the table "
+                'and in the schema field. Please remove one')
         if config.get('UPLOADED_CSV_HIVE_NAMESPACE'):
-            if '.' in table_name:
+            if '.' in table_name or schema_name:
 
 Review comment:
   If we're ok with not enforcing using the required namespace, isn't something 
like this more compact and clearer?
   ```
   schema_name = form.schema.data or schema_name or 
config.get('UPLOAD_CSV_HIVE_NAMESPACE')
   
   if schema:
       if '.' in table_name:
           raise Exception("You can't specify both an explicit schema and the 
schema in the table name")
       
       table_name = '{}.{}'.format(schema, table_name)
   ```

----------------------------------------------------------------
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]

Reply via email to