mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix(databases): GSheets and Clickhouse DBs are not allowed to upload files (#21065)
This commit is contained in:
committed by
GitHub
parent
82bd5a31b8
commit
b36bd3f083
@@ -52,6 +52,7 @@ class UploadToDatabaseForm(DynamicForm):
|
||||
file_enabled_db
|
||||
for file_enabled_db in file_enabled_dbs
|
||||
if UploadToDatabaseForm.at_least_one_schema_is_allowed(file_enabled_db)
|
||||
and UploadToDatabaseForm.is_engine_allowed_to_file_upl(file_enabled_db)
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
@@ -89,6 +90,19 @@ class UploadToDatabaseForm(DynamicForm):
|
||||
return True
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def is_engine_allowed_to_file_upl(database: Database) -> bool:
|
||||
"""
|
||||
This method is mainly used for existing Gsheets and Clickhouse DBs
|
||||
that have allow_file_upload set as True but they are no longer valid
|
||||
DBs for file uploading.
|
||||
New GSheets and Clickhouse DBs won't have the option to set
|
||||
allow_file_upload set as True.
|
||||
"""
|
||||
if database.db_engine_spec.supports_file_upload:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class CsvToDatabaseForm(UploadToDatabaseForm):
|
||||
name = StringField(
|
||||
|
||||
Reference in New Issue
Block a user