mirror of
https://github.com/apache/superset.git
synced 2026-04-23 18:14:56 +00:00
refactor: Repeated boilerplate code between upload to database forms (#16756)
* abstract boilerplate code into class and rename csv to file * add db migration * fix some stuff * more renaming of csv to file * rename in translations * update down revision * update down revision * bump chart version * switch to alter column name approach in db migration * fix db migration for MySQL * db migration conflict
This commit is contained in:
committed by
GitHub
parent
4f1d202430
commit
ef3afbde82
@@ -48,10 +48,10 @@ def sqlalchemy_uri_validator(
|
||||
) from ex
|
||||
|
||||
|
||||
def schema_allows_csv_upload(database: Database, schema: Optional[str]) -> bool:
|
||||
if not database.allow_csv_upload:
|
||||
def schema_allows_file_upload(database: Database, schema: Optional[str]) -> bool:
|
||||
if not database.allow_file_upload:
|
||||
return False
|
||||
schemas = database.get_schema_access_for_csv_upload()
|
||||
schemas = database.get_schema_access_for_file_upload()
|
||||
if schemas:
|
||||
return schema in schemas
|
||||
return security_manager.can_access_database(database)
|
||||
|
||||
Reference in New Issue
Block a user