Azure Data Lake Analytics 任务

Applies to:SQL Server SSIS Integration Runtime in Azure Data Factory

使用 Data Lake Analytics 任务,可以将 U-SQL 作业提交到 Azure Data Lake Analytics 服务。 此任务是适用于 Azure 的 SQL Server Integration Services (SSIS) 功能包的组成部分。

有关一般背景信息,请参阅 Azure Data Lake Analytics

Important

Azure Data Lake Analytics 将于 2024 年 2 月 29 日停用。 通过此公告了解更多信息。

配置任务

若要向包添加 Data Lake Analytics 任务,请将任务从 SSIS 工具箱拖到设计器画布中。 Then double-click the task, or right-click the task and select Edit. 此时,“Azure Data Lake Analytics 任务编辑器” 对话框打开。 可以通过 SSIS 设计器或以编程方式来设置属性。

“常规”页配置

Use the General page to configure the task and provide the U-SQL script that the task submits.

Basic configuration

可以指定任务的名称和说明。

U-SQL configuration

U-SQL configuration has two settings: SourceType, and dynamic options based on the SourceType value.

SourceType specifies the source of the U-SQL script. 脚本在 SSIS 包执行期间提交到 Data Lake Analytics 帐户。 下面列出了此属性的选项:

Value Description
DirectInput 通过内联编辑器指定 U-SQL 脚本。 Selecting this value displays the dynamic option, USQLStatement.
FileConnection 指定包含 U-SQL 脚本的本地 .usql 文件。 Selecting this option displays the dynamic option, FileConnection.
Variable 指定包含 U-SQL 脚本的 SSIS 变量。 Selecting this value displays the dynamic option, SourceVariable.

基于 SourceType 的动态选项 指定的是,U-SQL 查询的脚本内容。

SourceType Dynamic Options
SourceType = DirectInput 直接在选项框中键入要提交的 U-SQL 查询,或选择浏览按钮 (...) 以在“输入 U-SQL 查询” 对话框中键入 U-SQL 查询。
SourceType = FileConnection Select an existing file connection manager, or select <New connection...> to create a new file connection. 若要了解相关信息,请参阅文件连接管理器文件连接管理器编辑器
SourceType = 变量 Select an existing variable, or select <New variable...> to create a new variable. 若要了解相关信息,请参阅 Integration Services (SSIS) 变量添加变量

Job configuration

作业配置指定 U-SQL 作业提交属性。

  • AzureDataLakeAnalyticsConnection: Specifies the Data Lake Analytics account where the U-SQL script is submitted. 从已定义的连接管理器的列表中选择连接。 To create a new connection, select <New connection>. 若要了解相关信息,请参阅 Azure Data Lake Analytics 连接管理器.

  • JobName: Specifies the name of the U-SQL job.

  • AnalyticsUnits: Specifies the analytics unit count of the U-SQL job.

  • Priority: Specifies the priority of the U-SQL job. 可以将此属性设置为介于 0 和 1000 之间的值。 数字越小,优先级越高。

  • RuntimeVersion: Specifies the Data Lake Analytics runtime version of the U-SQL job. 默认情况下,此选项设置为“默认”。 通常无需更改此属性。

  • Synchronous: A Boolean value specifies if the task waits for the job execution to complete or not. If the value is set to true, the task is marked as succeed after the job completes. If the value is set to false, the task is marked as succeed after the job passes the preparation phase.

    Value Description
    True 任务结果基于 U-SQL 作业执行结果。 作业成功先于任务成功。 作业失败先于任务失败。 任务成功或失败先于任务完成。
    False 任务结果基于 U-SQL 作业提交和准备结果。 作业提交成功并通过准备阶段先于任务成功。 作业提交失败或未通过准备阶段先于任务失败。 任务成功或失败先于任务完成。
  • TimeOut: Specifies a time-out time, in seconds, for job execution. 如果作业超时,就会被取消并标记为“失败”。 This property is not available if Synchronous is set to false.

“参数映射”页配置

Use the Parameter Mapping page of the Azure Data Lake Analytics Task Editor dialog box to map variables to parameters (U-SQL variables) in U-SQL script.

  • Variable Name: After you have added a parameter mapping by selecting Add, select a system or user-defined variable from the list. Alternatively, you can select <New variable...> to add a new variable by using the Add Variable dialog box. 若要了解相关信息,请参阅 Integration Services (SSIS) 变量

  • Parameter Name: Provide a parameter/variable name in U-SQL script. 请确保参数名以 @ 符号开头(如 @Param1)。

以下是如何将参数传递到 U-SQL 脚本的示例。

示例 U-SQL 脚本

@searchlog =
    EXTRACT UserId          int,
            Start           DateTime,
            Region          string,
            Query           string,
            Duration        int,
            Urls            string,
            ClickedUrls     string
    FROM @in
    USING Extractors.Tsv(nullEscape:"#NULL#");

@rs1 =
    SELECT Start, Region, Duration
    FROM @searchlog
WHERE Region == "en-gb";

@rs1 =
    SELECT Start, Region, Duration
    FROM @rs1
    WHERE Start <= DateTime.Parse("2012/02/19");

OUTPUT @rs1   
    TO @out
      USING Outputters.Tsv(quoting:false, dateTimeFormat:null);

Note that the input and output paths are defined in @in and @out parameters. The values for @in and @out parameters in the U-SQL script are passed dynamically by the parameter mapping configuration.

Variable name Parameter name
User: Variable1 @in
User: Variable2 @out

“表达式”页配置

可以将“常规”页配置中的所有属性都分配为属性表达式,从而启用在运行时动态更新属性。 若要了解相关信息,请参阅在包中使用属性表达式

See also