使用 Azure Data Lake Tools for Visual Studio CodeUse Azure Data Lake Tools for Visual Studio Code

在本文中,您將了解如何使用 Azure Data Lake Tools for Visual Studio Code (VS Code) 來建立、測試及執行 U-SQL 指令碼。In this article, learn how you can use Azure Data Lake Tools for Visual Studio Code (VS Code) to create, test, and run U-SQL scripts. 下列影片中也涵蓋此資訊︰The information is also covered in the following video:

先決條件Prerequisites

Azure Data Lake Tools for VS Code 支援 Windows、Linux 與 macOS。Azure Data Lake Tools for VS Code supports Windows, Linux, and macOS. U-SQL 本機執行與本機偵錯僅適用於 Windows。 U-SQL local run and local debug works only in Windows.

若為 MacOS 和 Linux:For MacOS and Linux:

安裝 Azure Data Lake 工具Install Azure Data Lake Tools

安裝完必要條件之後,您就可以安裝 Azure Data Lake Tools for VS Code。After you install the prerequisites, you can install Azure Data Lake Tools for VS Code.

安裝 Azure Data Lake ToolsTo install Azure Data Lake Tools

  1. 開啟 Visual Studio Code。Open Visual Studio Code.

  2. 在左窗格中,選取 [延伸模組] 。Select Extensions in the left pane. 在搜尋方塊中輸入 Azure Data Lake ToolsEnter Azure Data Lake Tools in the search box.

  3. 選取 [Azure Data Lake Tools] 旁邊的 [安裝] 。Select Install next to Azure Data Lake Tools.

    Data Lake Tools 的安裝選取項目

    幾秒鐘後,[安裝] 按鈕會變為 [重新載入] 。After a few seconds, the Install button changes to Reload.

  4. 選取 [重新載入] 以啟用 [Azure Data Lake Tools] 延伸模組。Select Reload to activate the Azure Data Lake Tools extension.

  5. 選取 [重新載入視窗] 進行確認。Select Reload Window to confirm. 您會在 [延伸模組] 窗格中看到 [Azure Data Lake Tools] 。You can see Azure Data Lake Tools in the Extensions pane.

啟動 Azure Data Lake ToolsActivate Azure Data Lake Tools

建立一個 .usql 檔案或開啟現有的 .usql 檔案,以啟用延伸模組。Create a .usql file or open an existing .usql file to activate the extension.

使用 U-SQLWork with U-SQL

若要使用 U-SQL,您需要開啟 U-SQL 檔案或資料夾。To work with U-SQL, you need open either a U-SQL file or a folder.

開啟範例指令碼To open the sample script

開啟命令選擇區 (Ctrl+Shift+P),然後輸入 ADL: Open Sample ScriptOpen the command palette (Ctrl+Shift+P) and enter ADL: Open Sample Script. 它會開啟此範例的另一個執行個體。It opens another instance of this sample. 您也可以在此執行個體上編輯、設定及提交指令碼。You can also edit, configure, and submit a script on this instance.

開啟 U-SQL 專案的資料夾To open a folder for your U-SQL project

  1. 從 Visual Studio Code 選取 [檔案] 功能表,然後選取 [開啟資料夾] 。From Visual Studio Code, select the File menu, and then select Open Folder.

  2. 指定資料夾,然後選取 [選取資料夾] 。Specify a folder, and then select Select Folder.

  3. 選取 [檔案] 功能表,然後選取 [新增] 。Select the File menu, and then select New. 專案中就會加入一個 Untitled-1 檔案。An Untitled-1 file is added to the project.

  4. 在 Untitled-1 檔案中輸入以下程式碼:Enter the following code in the Untitled-1 file:

     @departments  = 
         SELECT * FROM 
             (VALUES
                 (31,    "Sales"),
                 (33,    "Engineering"), 
                 (34,    "Clerical"),
                 (35,    "Marketing")
             ) AS 
                   D( DepID, DepName );
      
     OUTPUT @departments
         TO "/Output/departments.csv"
     USING Outputters.Csv();
    

    這個指令碼會在 /output 資料夾中建立 departments.csv 檔案並納入一些資料。The script creates a departments.csv file with some data included in the /output folder.

  5. 在開啟的資料夾中,將檔案儲存為 myUSQL.usqlSave the file as myUSQL.usql in the opened folder.

編譯 U-SQL 指令碼To compile a U-SQL script

  1. 選取 Ctrl+Shift+P 以開啟命令選擇區。Select Ctrl+Shift+P to open the command palette.
  2. 輸入 ADL: Compile ScriptEnter ADL: Compile Script. 編譯結果會出現在 [輸出] 視窗中。The compile results appear in the Output window. 您也可以在指令碼檔案上按一下滑鼠右鍵,然後選取 [ADL: Compile Script] 來編譯 U-SQL 作業。You can also right-click a script file, and then select ADL: Compile Script to compile a U-SQL job. 編譯結果會出現在 [輸出] 窗格中。The compilation result appears in the Output pane.

提交 U-SQL 指令碼To submit a U-SQL script

  1. 選取 Ctrl+Shift+P 以開啟命令選擇區。Select Ctrl+Shift+P to open the command palette.
  2. 輸入 ADL: Submit JobEnter ADL: Submit Job. 您也可以在指令碼檔案上按一下滑鼠右鍵,然後選取 [ADL: Submit Job] 。You can also right-click a script file, and then select ADL: Submit Job.

在提交 U-SQL 作業後,提交記錄會出現在 VS Code 的 [輸出] 視窗中。After you submit a U-SQL job, the submission logs appear in the Output window in VS Code. 作業檢視會出現在右窗格中。The job view appears in the right pane. 如果提交成功,則作業 URL 也會出現。If the submission is successful, the job URL appears too. 您可以在網頁瀏覽器中開啟作業 URL 來追蹤即時的作業狀態。You can open the job URL in a web browser to track the real-time job status.

在作業檢視的 [摘要] 索引標籤上,您可以看到作業詳細資料。On the job view's SUMMARY tab, you can see the job details. 主要功能包括重新提交指令碼、複製指令碼,以及在入口網站中開啟。Main functions include resubmit a script, duplicate a script, and open in the portal. 在作業檢視的 [資料] 索引標籤上,您可以參考輸入檔案、輸出檔案及資源檔案。On the job view's DATA tab, you can refer to the input files, output files, and resource files. 您可以將檔案下載到本機電腦。Files can be downloaded to the local computer.

作業檢視中的 [摘要] 索引標籤

作業檢視中的 [資料] 索引標籤

設定預設內容To set the default context

如果您尚未個別設定檔案的參數,便可以設定預設內容以將此設定套用至所有指令碼檔案。You can set the default context to apply this setting to all script files if you have not set parameters for files individually.

  1. 選取 Ctrl+Shift+P 以開啟命令選擇區。Select Ctrl+Shift+P to open the command palette.

  2. 輸入 ADL: Set Default ContextEnter ADL: Set Default Context. 在指令碼編輯器上按一下滑鼠右鍵,然後選取 [ADL: Set Default Context] 。Or right-click the script editor and select ADL: Set Default Context.

  3. 選擇您想要的帳戶、資料庫及結構描述。Choose the account, database, and schema that you want. 此設定會儲存到 xxx_settings.json 設定檔。The setting is saved to the xxx_settings.json configuration file.

    設定為預設內容的帳戶、資料庫及結構描述

設定指令碼參數To set script parameters

  1. 選取 Ctrl+Shift+P 以開啟命令選擇區。Select Ctrl+Shift+P to open the command palette.

  2. 輸入 ADL: Set Script ParametersEnter ADL: Set Script Parameters.

  3. xxx_settings.json 檔案隨即開啟,其中含有下列屬性:The xxx_settings.json file is opened with the following properties:

    • account:您 Azure 訂用帳戶底下編譯和執行 U-SQL 作業所需的 Azure Data Lake Analytics 帳戶。account: An Azure Data Lake Analytics account under your Azure subscription that's needed to compile and run U-SQL jobs. 您必須在編譯和執行 U-SQL 作業之前,先設定電腦帳戶。You need configure the computer account before you compile and run U-SQL jobs.
    • database:您帳戶底下的資料庫。database: A database under your account. 預設值為 masterThe default is master.
    • schema:您資料庫底下的結構描述。schema: A schema under your database. 預設值為 dboThe default is dbo.
    • optionalSettingsoptionalSettings:
      • priority:優先順序範圍是從 1 到 1000,其中 1 是最高優先順序。priority: The priority range is from 1 to 1000, with 1 as the highest priority. 預設值為 1000The default value is 1000.
      • degreeOfParallelism:平行處理原則的範圍是從 1 到 150。degreeOfParallelism: The parallelism range is from 1 to 150. 預設值為您 Azure Data Lake Analytics 帳戶中允許的平行處理原則上限。The default value is the maximum parallelism allowed in your Azure Data Lake Analytics account.

    JSON 檔案的內容

注意

在儲存設定後,如果您尚未設定預設內容,帳戶、資料庫和結構描述資訊就會出現在對應之 .usql 檔案左下角的狀態列上。After you save the configuration, the account, database, and schema information appear on the status bar at the lower-left corner of the corresponding .usql file if you don’t have a default context set up.

設定 Git 忽略To set Git ignore

  1. 選取 Ctrl+Shift+P 以開啟命令選擇區。Select Ctrl+Shift+P to open the command palette.

  2. 輸入 ADL: Set Git IgnoreEnter ADL: Set Git Ignore.

    • 如果您的 VS Code 工作資料夾中沒有 .gitIgnore 檔案,系統就會在您的資料夾中建立名為 .gitIgnore 的檔案。If you don’t have a .gitIgnore file in your VS Code working folder, a file named .gitIgnore is created in your folder. 預設會在檔案中新增四個項目 (usqlCodeBehindReferenceusqlCodeBehindGenerated.cacheobj) 預設會新增至檔案。Four items (usqlCodeBehindReference, usqlCodeBehindGenerated, .cache, obj) are added in the file by default. 您可以視需要進行更多更新。You can make more updates if needed.
    • 如果您的 VS Code 工作資料夾中已經有 .gitIgnore 檔案,且檔案中未包含四個項目 (usqlCodeBehindReferenceusqlCodeBehindGenerated.cacheobj),工具就會在您的 .gitIgnore 檔案中新增這四個項目。If you already have a .gitIgnore file in your VS Code working folder, the tool adds four items (usqlCodeBehindReference, usqlCodeBehindGenerated, .cache, obj) in your .gitIgnore file if the four items were not included in the file.

    .gitIgnore 檔案中的項目

使用程式碼後置檔案:C Sharp、Python 和 RWork with code-behind files: C Sharp, Python, and R

Azure Data Lake Tools 支援多個自訂程式碼。Azure Data Lake Tools supports multiple custom codes. 如需相關指示,請參閱在 VS Code 中使用 Python、R 和 C Sharp 來開發適用於 Azure Data Lake Analytics 的 U-SQLFor instructions, see Develop U-SQL with Python, R, and C Sharp for Azure Data Lake Analytics in VS Code.

使用組件Work with assemblies

如需有關開發組件的資訊,請參閱針對 Azure Data Lake Analytics 作業開發 U-SQL 組件For information on developing assemblies, see Develop U-SQL assemblies for Azure Data Lake Analytics jobs.

您可以使用 Data Lake Tools 在 Data Lake Analytics 目錄中註冊自訂程式碼組件。You can use Data Lake Tools to register custom code assemblies in the Data Lake Analytics catalog.

註冊組件To register an assembly

您可以透過 ADL: Register AssemblyADL: Register Assembly (Advanced) 命令來註冊組件。You can register the assembly through the ADL: Register Assembly or ADL: Register Assembly (Advanced) command.

透過 ADL: Register Assembly command 命令來進行註冊To register through the ADL: Register Assembly command

  1. 選取 Ctrl+Shift+P 以開啟命令選擇區。Select Ctrl+Shift+P to open the command palette.
  2. 輸入 ADL: Register AssemblyEnter ADL: Register Assembly.
  3. 指定本機組件路徑。Specify the local assembly path.
  4. 選取 Data Lake Analytics 帳戶。Select a Data Lake Analytics account.
  5. 選取資料庫。Select a database.

入口網站會在瀏覽器中開啟,並顯示組件註冊程序。The portal is opened in a browser and displays the assembly registration process.

有另一個更容易觸發 ADL: Register Assembly 命令的方式,就是對「檔案總管」中的 .dll 檔案按一下滑鼠右鍵。A more convenient way to trigger the ADL: Register Assembly command is to right-click the .dll file in File Explorer.

透過 ADL: Register Assembly (Advanced) 命令來進行註冊To register through the ADL: Register Assembly (Advanced) command

  1. 選取 Ctrl+Shift+P 以開啟命令選擇區。Select Ctrl+Shift+P to open the command palette.

  2. 輸入 ADL: Register Assembly (Advanced)Enter ADL: Register Assembly (Advanced).

  3. 指定本機組件路徑。Specify the local assembly path.

  4. 隨即會顯示 JSON 檔案。The JSON file is displayed. 請視需要檢閱並編輯組件相依性及資源參數。Review and edit the assembly dependencies and resource parameters, if needed. 指示會顯示在 [輸出] 視窗中。Instructions are displayed in the Output window. 若要繼續進行組件註冊,請儲存 (Ctrl + S) JSON 檔案。To proceed to the assembly registration, save (Ctrl+S) the JSON file.

    含有組件相依性和資源參數的 JSON 檔案

注意

  • Azure Data Lake Tools 會自動偵測 DLL 是否有任何相依項目。Azure Data Lake Tools autodetects whether the DLL has any assembly dependencies. 在偵測到相依項目後,就會在 JSON 檔案中顯示這些相依項目。The dependencies are displayed in the JSON file after they're detected.
  • 您可以在註冊組件時上傳 DLL 資源 (例如 .txt、.png 和 .csv)。You can upload your DLL resources (for example, .txt, .png, and .csv) as part of the assembly registration.

另一個可觸發 ADL: Register Assembly (Advanced) 命令的方式,是對檔案總管中的 .dll 檔案按一下滑鼠右鍵。Another way to trigger the ADL: Register Assembly (Advanced) command is to right-click the .dll file in File Explorer.

下列 U-SQL 程式碼示範如何呼叫組件。The following U-SQL code demonstrates how to call an assembly. 在此範例中,組件名稱是 testIn the sample, the assembly name is test.

    REFERENCE ASSEMBLY [test];

    @a = 
        EXTRACT 
            Iid int,
        Starts DateTime,
        Region string,
        Query string,
        DwellTime int,
        Results string,
        ClickedUrls string 
        FROM @"Sample/SearchLog.txt" 
        USING Extractors.Tsv();

    @d =
        SELECT DISTINCT Region 
        FROM @a;

    @d1 = 
        PROCESS @d
        PRODUCE 
            Region string,
        Mkt string
        USING new USQLApplication_codebehind.MyProcessor();

    OUTPUT @d1 
        TO @"Sample/SearchLogtest.txt" 
        USING Outputters.Tsv();

針對 Windows 使用者使用 U-SQL 本機執行和本機偵錯Use U-SQL local run and local debug for Windows users

U-SQL 本機執行會先測試您的本機資料並在本機驗證您的指令碼,然後才將您的程式碼發行至 Data Lake Analytics。U-SQL local run tests your local data and validates your script locally before your code is published to Data Lake Analytics. 您可以使用本機偵錯功能先完成下列工作,再將您的程式碼提交給 Data Lake Analytics:You can use the local debug feature to complete the following tasks before your code is submitted to Data Lake Analytics:

  • 偵錯您的 C# 程式碼後置。Debug your C# code-behind.
  • 逐步執行程式碼。Step through the code.
  • 在本機驗證您的指令碼。Validate your script locally.

本機執行與本機偵錯功能僅適用於 Windows 環境,在 macOS 與 Linux 型作業系統上不支援。The local run and local debug feature only works in Windows environments, and is not supported on macOS and Linux-based operating systems.

如需本機執行和本機偵錯的指示,請參閱使用 Visual Studio Code 來進行 U-SQL 本機執行和本機偵錯For instructions on local run and local debug, see U-SQL local run and local debug with Visual Studio Code.

連接到 AzureConnect to Azure

您必須先連線到 Azure 帳戶,才能在 Data Lake Analytics 中編譯和執行 U-SQL 指令碼。Before you can compile and run U-SQL scripts in Data Lake Analytics, you must connect to your Azure account.

使用命令來連線至 AzureTo connect to Azure by using a command

  1. 選取 Ctrl+Shift+P 以開啟命令選擇區。Select Ctrl+Shift+P to open the command palette.

  2. 輸入 ADL: 登入。Enter ADL: Login. 登入資訊會出現在右下方。The login information appears on the lower right.

    輸入登入命令

    登入和驗證的相關通知

  3. 選取 [複製及開啟] 以開啟登入網頁Select Copy & Open to open the login webpage. 將程式碼貼到方塊中,然後選取 [繼續] 。Paste the code into the box, and then select Continue.

    登入網頁

  4. 依照網頁上的指示登入。Follow the instructions to sign in from the webpage. 當您已連線時,您的 Azure 帳戶名稱會出現在 VS Code 視窗左下角的狀態列上。When you're connected, your Azure account name appears on the status bar in the lower-left corner of the VS Code window. 

注意

  • 如果您未登出,下次 Data Lake Tools 就會自動將您登入。Data Lake Tools automatically signs you in the next time if you don't sign out.
  • 如果您的帳戶已啟用雙因素驗證,建議您使用電話驗證而非使用 PIN 碼。If your account has two factors enabled, we recommend that you use phone authentication rather than using a PIN.

若要登出,請輸入命令 ADL: LogoutTo sign out, enter the command ADL: Logout.

從總管連線至 AzureTo connect to Azure from the explorer

展開 [AZURE DATALAKE] ,選取 [登入 Azure] ,然後依照使用命令來連線至 Azure 的步驟 3 和步驟 4 進行操作。Expand AZURE DATALAKE, select Sign in to Azure, and then follow step 3 and step 4 of To connect to Azure by using a command.

總管中的 [登入 Azure] 選取項目

您無法從總管登出。You can't sign out from the explorer. 若要登出,請參閱使用命令來連線至 AzureTo sign out, see To connect to Azure by using a command.

建立擷取指令碼Create an extraction script

您可以使用 ADL: Create EXTRACT Script 命令或從 Azure Data Lake 總管,建立 .csv、.tsv 及 .txt 檔案的擷取指令碼。You can create an extraction script for .csv, .tsv, and .txt files by using the command ADL: Create EXTRACT Script or from the Azure Data Lake explorer.

使用命令來建立擷取指令碼To create an extraction script by using a command

  1. 選取 Ctrl+Shift+P 以開啟命令選擇區,並輸入 ADL: Create EXTRACT ScriptSelect Ctrl+Shift+P to open the command palette, and enter ADL: Create EXTRACT Script.
  2. 指定 Azure 儲存體檔案的完整路徑,然後選取 Enter 鍵。Specify the full path for an Azure Storage file, and select the Enter key.
  3. 選取帳戶。Select one account.
  4. 若為 .txt 檔案,請選取用來擷取檔案的分隔符號。For a .txt file, select a delimiter to extract the file.

建立擷取指令碼的程序

系統會根據您的輸入來產生擷取指令碼。The extraction script is generated based on your entries. 對於無法偵測資料行的指令碼,請選擇兩個選項的其中一個。For a script that cannot detect the columns, choose one from the two options. 如果未選擇,則只會產生一個指令碼。If not, only one script will be generated.

建立擷取指令碼的結果

從總管建立擷取指令碼To create an extraction script from the explorer

有另一個可建立擷取指令碼的方式,就是在 Azure Data Lake Store 或 Azure Blob 儲存體中透過 .csv、.tsv 或 .txt 檔案的滑鼠右鍵 (捷徑) 功能表來進行。Another way to create the extraction script is through the right-click (shortcut) menu on the .csv, .tsv, or .txt file in Azure Data Lake Store or Azure Blob storage.

捷徑功能表中的 [建立 EXTRACT 指令碼] 命令

透過命令與 Azure Data Lake Analytics 整合Integrate with Azure Data Lake Analytics through a command

您可以存取 Azure Data Lake Analytics 資源來列出帳戶、存取中繼資料,以及檢視分析作業。You can access Azure Data Lake Analytics resources to list accounts, access metadata, and view analytics jobs.

列出 Azure 訂用帳戶下的 Azure Data Lake Analytics 帳戶To list the Azure Data Lake Analytics accounts under your Azure subscription

  1. 選取 Ctrl+Shift+P 以開啟命令選擇區。Select Ctrl+Shift+P to open the command palette.
  2. 輸入 ADL: List AccountsEnter ADL: List Accounts. 帳戶會出現在 [輸出] 窗格中。The accounts appear in the Output pane.

存取 Azure Data Lake Analytics 中繼資料To access Azure Data Lake Analytics metadata

  1. 選取 Ctrl+Shift+P,然後輸入 ADL: List TablesSelect Ctrl+Shift+P, and then enter ADL: List Tables.
  2. 選取其中一個 Data Lake Analytics 帳戶。Select one of the Data Lake Analytics accounts.
  3. 選取其中一個 Data Lake Analytics 資料庫。Select one of the Data Lake Analytics databases.
  4. 選取其中一個結構描述。Select one of the schemas. 您就會看到資料表清單。You can see the list of tables.

檢視 Azure Data Lake Analytics 作業To view Azure Data Lake Analytics jobs

  1. 開啟命令選擇區 (Ctrl+Shift+P),然後選取 [ADL: Show Job] 。Open the command palette (Ctrl+Shift+P) and select ADL: Show Jobs.

  2. 選取 Data Lake Analytics 帳戶或本機帳戶。Select a Data Lake Analytics or local account.

  3. 等候帳戶的作業清單出現。Wait for the job list to appear for the account.

  4. 從作業清單中選取作業。Select a job from the job list. Data Lake Tools 會在右窗格開啟作業檢視,並在 VS Code 輸出中顯示一些資訊。Data Lake Tools opens the job view in the right pane and displays some information in the VS Code output.

    作業清單

透過命令與 Azure Data Lake Store 整合Integrate with Azure Data Lake Store through a command

您可以使用 Azure Data Lake Store 相關命令來進行下列作業:You can use Azure Data Lake Store-related commands to:

列出儲存體路徑List the storage path

透過命令選擇區來列出儲存體路徑To list the storage path through the command palette

  1. 以滑鼠右鍵按一下指令碼編輯器,然後選取 [ADL: List Path] 。Right-click the script editor and select ADL: List Path.
  2. 選擇清單中的資料夾,或是選取 [輸入路徑] 或 [從根路徑瀏覽] 。Choose the folder in the list, or select Enter a path or Browse from root path. (我們使用 [輸入路徑] 作為範例)。(We're using Enter a path as an example.)
  3. 選取您的 Data Lake Analytics 帳戶。Select your Data Lake Analytics account.
  4. 瀏覽或輸入儲存體資料夾路徑 (例如 /output/)。Browse to or enter the storage folder path (for example, /output/).

命令選擇區會根據您的輸入列出路徑資訊。The command palette lists the path information based on your entries.

儲存體路徑結果

有一個可列出相對路徑的更便利方式,就是透過捷徑功能表。A more convenient way to list the relative path is through the shortcut menu.

透過捷徑功能表來列出儲存體路徑To list the storage path through the shortcut menu

在路徑字串上按一下滑鼠右鍵,然後選取 [列出路徑] 。Right-click the path string and select List Path.

捷徑功能表上的 [列出路徑]

預覽儲存體檔案Preview the storage file

  1. 以滑鼠右鍵按一下指令碼編輯器,然後選取 [ADL: Preview File] 。Right-click the script editor and select ADL: Preview File.
  2. 選取您的 Data Lake Analytics 帳戶。Select your Data Lake Analytics account.
  3. 輸入 Azure 儲存體檔案路徑 (例如 /output/SearchLog.txt)。Enter an Azure Storage file path (for example, /output/SearchLog.txt).

檔案會在 VS Code 中開啟。The file opens in VS Code.

儲存體檔案的預覽步驟和結果

有另一個可預覽檔案的方式,就是在指令碼編輯器中,透過檔案完整路徑或檔案相對路徑上的捷徑功能表來進行。Another way to preview the file is through the shortcut menu on the file's full path or the file's relative path in the script editor.

上傳檔案或資料夾Upload a file or folder

  1. 以滑鼠右鍵按一下指令碼編輯器,然後選取 [上傳檔案] 或 [上傳資料夾] 。Right-click the script editor and select Upload File or Upload Folder.
  2. 如果您已選取 [上傳檔案] ,請選擇一或多個檔案。或者,如果您已選取 [上傳資料夾] ,則請選擇整個資料夾。Choose one file or multiple files if you selected Upload File, or choose the whole folder if you selected Upload Folder. 然後選取 [上傳] 。Then select Upload.
  3. 選擇清單中的儲存體資料夾,或是選取 [輸入路徑] 或 [從根路徑瀏覽] 。Choose the storage folder in the list, or select Enter a path or Browse from root path. (我們使用 [輸入路徑] 作為範例)。(We're using Enter a path as an example.)
  4. 選取您的 Data Lake Analytics 帳戶。Select your Data Lake Analytics account.
  5. 瀏覽或輸入儲存體資料夾路徑 (例如 /output/)。Browse to or enter the storage folder path (for example, /output/).
  6. 選取 [選擇目前資料夾] 來指定您的上傳目的地。Select Choose Current Folder to specify your upload destination.

檔案或資料夾的上傳步驟和結果

有另一個可將檔案上傳到儲存體的方式,就是在指令碼編輯器中,透過檔案完整路徑或檔案相對路徑上的捷徑功能表來進行。Another way to upload files to storage is through the shortcut menu on the file's full path or the file's relative path in the script editor.

您可以監視上傳狀態You can monitor the upload status.

下載檔案Download a file

您可以使用 ADL:Download FileADL: Download File (Advanced) 命令來下載檔案。You can download a file by using the command ADL: Download File or ADL: Download File (Advanced).

透過 ADL: Download File (Advanced) 命令來下載檔案To download a file through the ADL: Download File (Advanced) command

  1. 以滑鼠右鍵按一下指令碼編輯器,然後選取 [Download File (Advanced)] 。Right-click the script editor, and then select Download File (Advanced).

  2. VS Code 會顯示一個 JSON 檔案。VS Code displays a JSON file. 您可以輸入檔案路徑,然後同時下載多個檔案。You can enter file paths and download multiple files at the same time. 指示會顯示在 [輸出] 視窗中。Instructions are displayed in the Output window. 若要繼續下載一或多個檔案,請儲存 (Ctrl+S) JSON 檔案。To proceed to download the file or files, save (Ctrl+S) the JSON file.

    含有檔案下載路徑的 JSON 檔案

[輸出] 視窗會顯示檔案下載狀態。The Output window displays the file download status.

含有下載狀態的 [輸出] 視窗

您可以監視下載狀態You can monitor the download status.

透過 ADL: Download File 命令來下載檔案To download a file through the ADL: Download File command

  1. 在指令碼編輯器上按一下滑鼠右鍵,選取 [下載檔案] ,然後從 [選取資料夾] 對話方塊中選取目的地資料夾。Right-click the script editor, select Download File, and then select the destination folder from the Select Folder dialog box.
  2. 選擇清單中的資料夾,或是選取 [輸入路徑] 或 [從根路徑瀏覽] 。Choose the folder in the list, or select Enter a path or Browse from root path. (我們使用 [輸入路徑] 作為範例)。(We're using Enter a path as an example.)
  3. 選取您的 Data Lake Analytics 帳戶。Select your Data Lake Analytics account.
  4. 瀏覽或輸入儲存體資料夾路徑 (例如:/output/),然後選擇要下載的檔案。Browse to or enter the storage folder path (for example, /output/), and then choose a file to download.

檔案的下載步驟和結果

有另一個可下載儲存體檔案的方式,就是在指令碼編輯器中,透過檔案完整路徑或檔案相對路徑上的捷徑功能表來進行。Another way to download storage files is through the shortcut menu on the file's full path or the file's relative path in the script editor.

您可以監視下載狀態You can monitor the download status.

檢查儲存體工作的狀態Check storage tasks' status

上傳和下載狀態會顯示在狀態列上。The upload and download status appears on the status bar. 請選取狀態列,然後狀態就會顯示在 [輸出] 索引標籤上。Select the status bar, and then the status appears on the OUTPUT tab.

狀態列和輸出詳細資料

從總管與 Azure Data Lake Analytics 整合Integrate with Azure Data Lake Analytics from the explorer

登入之後,您 Azure 帳戶的所有訂用帳戶都會列在左窗格中 [AZURE DATALAKE] 底下。After you log in, all the subscriptions for your Azure account are listed in the left pane, under AZURE DATALAKE.

Data Lake 總管

Data Lake Analytics 中繼資料瀏覽Data Lake Analytics metadata navigation

展開您的 Azure 訂用帳戶。Expand your Azure subscription. 在 [U-SQL 資料庫] 節點底下,您可以瀏覽 U-SQL 資料庫並檢視資料夾,例如 [結構描述] 、[認證] 、[組件] 、[資料表] 及 [索引] 。Under the U-SQL Databases node, you can browse through your U-SQL database and view folders like Schemas, Credentials, Assemblies, Tables, and Index.

Data Lake Analytics 中繼資料實體管理Data Lake Analytics metadata entity management

展開 [U-SQL 資料庫] 。Expand U-SQL Databases. 您可以建立資料庫、結構描述、資料表、資料表類型、索引或統計資料,方法是在對應的節點上按一下滑鼠右鍵,然後從捷徑功能表上選取 [要建立的指令碼] 。You can create a database, schema, table, table type, index, or statistic by right-clicking the corresponding node, and then selecting Script to Create on the shortcut menu. 在已開啟的指令碼頁面上,根據您的需求編輯指令碼。On the opened script page, edit the script according to your needs. 接著,在指令碼上按一下滑鼠右鍵並選取 [ADL: Submit Job] 。Then submit the job by right-clicking it and selecting ADL: Submit Job.

建立完項目之後,在節點上按一下滑鼠右鍵,然後選取 [重新整理] 來顯示項目。After you finish creating the item, right-click the node and then select Refresh to show the item. 您也可以刪除項目,方法是在項目上按一下滑鼠右鍵,然後選取 [刪除] 。You can also delete the item by right-clicking it and then selecting Delete.

Data Lake 總管中捷徑功能表上的 [要建立的指令碼] 命令

新項目的指令碼頁面

Data Lake Analytics 組件註冊Data Lake Analytics assembly registration

您可以在對應的資料庫中註冊組件,方法是在 [組件] 節點上按一下滑鼠右鍵,然後選取 [註冊組件] 。You can register an assembly in the corresponding database by right-clicking the Assemblies node, and then selecting Register assembly.

[組件] 節點捷徑功能表上的 [註冊組件] 命令

從總管與 Azure Data Lake Store 整合Integrate with Azure Data Lake Store from the explorer

瀏覽至 [Data Lake Store] :Browse to Data Lake Store:

  • 您可以在資料夾節點上按一下滑鼠右鍵,然後使用捷徑功能表上的 [重新整理] 、[刪除] 、[上傳] 、[上傳資料夾] 、[複製相對路徑] 及 [複製完整路徑] 命令。You can right-click the folder node and then use the Refresh, Delete, Upload, Upload Folder, Copy Relative Path, and Copy Full Path commands on the shortcut menu.

    Data Lake 總管中資料夾節點上的捷徑功能表命令

  • 您可以在檔案節點上按一下滑鼠右鍵,然後使用捷徑功能表上的 [預覽] 、[下載] 、[刪除] 、[建立 EXTRACT 指令碼] (只適用於 CSV、TSV 和 TXT 檔案),以及 [複製相對路徑] 和 [複製完整路徑] 命令。You can right-click the file node and then use the Preview, Download, Delete, Create EXTRACT Script (available only for CSV, TSV, and TXT files), Copy Relative Path, and Copy Full Path commands on the shortcut menu.

    Data Lake 總管中檔案節點上的捷徑功能表命令

從總管與 Azure Blob 儲存體整合Integrate with Azure Blob storage from the explorer

瀏覽至 Blob 儲存體:Browse to Blob storage:

  • 您可以在 Blob 容器節點上按一下滑鼠右鍵,然後使用捷徑功能表上的 [重新整理] 、[刪除 Blob 容器] 及 [上傳 Blob] 命令。You can right-click the blob container node and then use the Refresh, Delete Blob Container, and Upload Blob commands on the shortcut menu.

    Blob 儲存體底下 Blob 容器節點的捷徑功能表命令

  • 您可以在資料夾節點上按一下滑鼠右鍵,然後使用捷徑功能表上的 [重新整理] 和 [上傳 Blob] 命令。You can right-click the folder node and then use the Refresh and Upload Blob commands on the shortcut menu.

    Blob 儲存體底下資料夾節點的捷徑功能表命令

  • 您可以在檔案節點上按一下滑鼠右鍵,然後使用捷徑功能表上的 [預覽/編輯] 、[下載] 、[刪除] 、[建立 EXTRACT 指令碼] (只適用於 CSV、TSV 和 TXT 檔案),以及 [複製相對路徑] 和 [複製完整路徑] 命令。You can right-click the file node and then use the Preview/Edit, Download, Delete, Create EXTRACT Script (available only for CSV, TSV, and TXT files), Copy Relative Path, and Copy Full Path commands on the shortcut menu.

    Blob 儲存體底下檔案節點的捷徑功能表命令

在入口網站中開啟 Data Lake 總管Open the Data Lake explorer in the portal

  1. 選取 Ctrl+Shift+P 以開啟命令選擇區。Select Ctrl+Shift+P to open the command palette.
  2. 輸入 Open Web Azure Storage Explorer,或在指令碼編輯器中的相對路徑或完整路徑上按一下滑鼠右鍵,然後選取 [Open Web Azure Storage Explorer] 。Enter Open Web Azure Storage Explorer or right-click a relative path or the full path in the script editor, and then select Open Web Azure Storage Explorer.
  3. 選取 Data Lake Analytics 帳戶。Select a Data Lake Analytics account.

Data Lake Tools 會在 Azure 入口網站中開啟 Azure 儲存體路徑。Data Lake Tools opens the Azure Storage path in the Azure portal. 您可以找到該路徑,並從網路預覽檔案。You can find the path and preview the file from the web.

其他功能Additional features

Data Lake Tools for VSCode 支援下列功能︰Data Lake Tools for VS Code supports the following features:

  • IntelliSense 自動完成:在關鍵字、方法和變數等項目周圍的快顯視窗中會顯示建議。IntelliSense autocomplete: Suggestions appear in pop-up windows around items like keywords, methods, and variables. 不同圖示代表不同類型的物件:Different icons represent different types of objects:

    • Scala 資料類型Scala data type
    • 複雜資料類型Complex data type
    • 內建 UDTBuilt-in UDTs
    • .NET 集合和類別.NET collection and classes
    • C# 運算式C# expressions
    • 內建 C# UDF、UDO 和 UDAAGBuilt-in C# UDFs, UDOs, and UDAAGs
    • U-SQL 函式U-SQL functions
    • U-SQL 時間範圍函式U-SQL windowing functions

    IntelliSense 物件類型

  • Data Lake Analytics 中繼資料上的 IntelliSense 自動完成:Data Lake Tools 會在本機下載 Data Lake Analytics 中繼資料資訊。IntelliSense autocomplete on Data Lake Analytics metadata: Data Lake Tools downloads the Data Lake Analytics metadata information locally. IntelliSense 功能會從 Data Lake Analytics 中繼資料自動填入物件。The IntelliSense feature automatically populates objects from the Data Lake Analytics metadata. 這些物件包括資料庫、結構描述、資料表、檢視、資料表值函式、程序及 C# 組件。These objects include the database, schema, table, view, table-valued function, procedures, and C# assemblies.

    IntelliSense 中繼資料

  • IntelliSense 錯誤標記:Data Lake Tools 會為 U-SQL 和 C# 的編輯錯誤加上底線。IntelliSense error marker: Data Lake Tools underlines editing errors for U-SQL and C#.

  • 語法醒目顯示:Data Lake Tools 會使用顏色來區分項目,例如變數、關鍵字、資料類型及函式。Syntax highlights: Data Lake Tools uses colors to differentiate items like variables, keywords, data types, and functions.

    帶有各種顏色的語法

注意

建議您升級至 Azure Data Lake Tools for Visual Studio 2.3.3000.4 版或更新版本。We recommend that you upgrade to Azure Data Lake Tools for Visual Studio version 2.3.3000.4 or later. 舊版目前已淘汰,不再提供下載。The previous versions are no longer available for download and are now deprecated.

後續步驟Next steps