ktmud commented on a change in pull request #14255:
URL: https://github.com/apache/superset/pull/14255#discussion_r617129624
##########
File path: superset/config.py
##########
@@ -791,9 +791,16 @@ class CeleryConfig: # pylint:
disable=too-few-public-methods
CSV_TO_HIVE_UPLOAD_DIRECTORY = "EXTERNAL_HIVE_TABLES/"
# Function that creates upload directory dynamically based on the
# database used, user and schema provided.
-CSV_TO_HIVE_UPLOAD_DIRECTORY_FUNC: Callable[
- ["Database", "models.User", str], Optional[str]
-] = lambda database, user, schema: CSV_TO_HIVE_UPLOAD_DIRECTORY
+def CSV_TO_HIVE_UPLOAD_DIRECTORY_FUNC(
+ database: "Database",
+ user: "models.User", # pylint: disable=unused-argument
+ schema: Optional[str],
+) -> str:
+ # Note the final empty path enforces a trailing slash.
+ return os.path.join(
+ CSV_TO_HIVE_UPLOAD_DIRECTORY, str(database.id), schema or "", ""
+ )
Review comment:
How about using `database.database_name` instead of `database.id` to
have more readable file paths (as well as allowing re-creating database yet
still uploading to the same directory)?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]