pohek321 commented on a change in pull request #22331:
URL: https://github.com/apache/airflow/pull/22331#discussion_r829610102
##########
File path: airflow/providers/databricks/hooks/databricks.py
##########
@@ -379,20 +379,27 @@ def import_notebook(self, notebook_name: str, raw_code:
str, language: str, over
raise ValueError(f"results: format must be one of the following:
{str(format_options)}")
# encode notebook
- encodedBytes = base64.b64encode(raw_code.encode("utf-8"))
- encodedStr = str(encodedBytes, "utf-8")
+ encoded_bytes = base64.b64encode(raw_code.encode("utf-8"))
+ encoded_str = str(encoded_bytes, "utf-8")
# create parent directory if not exists
- self._do_api_call(WORKSPACE_MKDIR_ENDPOINT, {'path':
"/Shared/airflow"})
+ path_parts = dbfs_path.split('/')
+ path_parts.pop(0)
+ path_parts = path_parts[:-1]
+
+ path = ''
+ for part in path_parts:
+ path += f'/{part}'
+ self._do_api_call(WORKSPACE_MKDIR_ENDPOINT, {'path': path})
Review comment:
I think we might have a disconnect here. This isn't using the os.path
lib, it's just a string. That being said, would it still need to be be tested
on different machines?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]