簡體   English   中英

我們如何在dbfs / filestore中保存或上傳.py文件

[英]How can we save or upload .py file on dbfs/filestore

在本地需求上,我們很少有.py文件可以存儲/保存在dbfs的fileStore路徑上。 我該如何實現?

嘗試使用dbUtils.fs模塊復制操作。

我嘗試了下面的代碼,但是沒有用,我知道源路徑不正確。 還是有更好的方法呢? 請指教

'''
dbUtils.fs.cp ("c:\\file.py", "dbfs/filestore/file.py")
'''

聽起來您想將本地文件復制到Azure Databricks服務器的dbfs路徑。 但是,由於基於瀏覽器的Azure Databricks筆記本的交互界面,它無法通過在雲上編程直接在本地操作文件。

因此,您可以嘗試以下解決方案。

  1. 就像@Jon在評論中所說,您可以按照官方文檔Databricks CLI通過Python工具命令pip install databricks-cli在本地pip install databricks-cli ,然后將文件復制到dbfs

  2. 按照官方文檔“ Accessing Data將“通過Drop files into or browse to files in the Import & Explore Data box on the landing page導入數據” Drop files into or browse to files in the Import & Explore Data box on the landing page ,但也建議使用CLI,如下圖所示。

    在此處輸入圖片說明

  3. 將您指定的文件上傳到Azure Blob存儲,然后按照官方文檔Data sources / Azure Blob Storage進行操作,包括dbutils.fs.cp

希望能幫助到你。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM