Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2022 09:10 AM
I was able to fix it. It was an issue with the nested files on the SFTP. I had to ensure that the parent folders were being created as well. Splitting out the local path and file made it easier to ensure that it existed with os.path.exists() and os.makedirs()
def sftp_read(sftp_object, bucket, prefix):
key = f'{prefix}/{sftp_object}'
local_path = '/local_disk0/tmp'
local_file = f'{local_path}/{os.path.basename(sftp_object)}'
if not os.path.exists(local_path):
os.makedirs(local_path)
sftp.get(sftp_object, local_file)
# do stuff
os.remove(local_file)All in all, not a databricks issue, just an issue that appeared on databricks.