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 2021/07/17 14:27:39 UTC

[GitHub] [superset] myheartsgoon edited a comment on issue #15692: "ERROR: Failed to fetch schemas allowed for csv upload in this database!" when trying to upload CSV

myheartsgoon edited a comment on issue #15692:
URL: https://github.com/apache/superset/issues/15692#issuecomment-881907266


   Currently I fixed this issue temporarily by adding below code to the funtion `get_schema_access_for_csv_upload ` on backend and rebuilt the image.
   ```
   from ast import literal_eval
   allowed_databases = literal_eval(allowed_databases)
   ```
   
   full code of function `get_schema_access_for_csv_upload` now.
   ```python
       def get_schema_access_for_csv_upload(  # pylint: disable=invalid-name
           self,
       ) -> List[str]:
           allowed_databases = self.get_extra().get("schemas_allowed_for_csv_upload", [])
           from ast import literal_eval
           allowed_databases = literal_eval(allowed_databases)
           if hasattr(g, "user"):
               extra_allowed_databases = config["ALLOWED_USER_CSV_SCHEMA_FUNC"](
                   self, g.user
               )
               allowed_databases += extra_allowed_databases
           return sorted(set(allowed_databases))
   ```
   
   ![image](https://user-images.githubusercontent.com/24839228/126040172-c287dae0-0247-49c8-873a-d301b7be22ac.png)
   
   


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

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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