fix(databases): GSheets and Clickhouse DBs are not allowed to upload files (#21065)

This commit is contained in:
Antonio Rivero Martinez
2022-09-26 14:08:11 -03:00
committed by GitHub
parent 82bd5a31b8
commit b36bd3f083
16 changed files with 626 additions and 47 deletions

View File

@@ -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(