2017-12-27 254 views
0

我们试图从ADFv2运行U-SQL脚本,但存在阻止执行的错误。考虑到关于这个问题的MS文档没有什么帮助,我再次要求SO帮助解决这个问题。无法从ADF执行U-SQL脚本:ScriptPath不应为空

  1. 最初的问题是如何部署在U-SQL脚本ADLA。我们找不到任何有用的东西,最终只是将脚本复制粘贴到ADLA和Azure Blob存储上,格式为.usql和.txt。 (这也可能是其中一个问题)。

  2. 我们根据MS documentation创建的ARM,但它与错误而失败:ScriptPath should not be null因为这个值甚至链接业务,并在活动中已指定其为奇数。

以下是我们所创建的LS和活动:

LinkedService:

{ 
    "type": "linkedservices", 
    "name": "LinkedServiceofAzureBlobStorageforscriptPath", 
    "dependsOn": ["[parameters('dataFactoryName')]"], 
    "apiVersion": "[variables('apiVersion')]", 
    "properties": { 
     "type": "AzureStorage", 
     "typeProperties": { 
      "connectionString": { 
       "type": "SecureString", 
       "value": "DefaultEndpointsProtocol=https;AccountName=<account>;AccountKey=<key>;EndpointSuffix=core.windows.net" 
      } 
      "scriptPath": "container\\script.txt" 
      //"scriptPath": "https://storage.blob.core.windows.net/container/script.txt"//"wasb://[email protected]/script.txt", 
     } 
    } 
} 

活动:

{ 
      "type": "DataLakeAnalyticsU-SQL", 
      "typeProperties": { 
       //"script": "master.dbo.sp_test()", 
       "scriptPath": "container\\script.txt"//"scriptPath": "https://storage.blob.core.windows.net/container/script.txt"//"wasb://[email protected]/script.txt", 
       "scriptLinkedService": { 
        "referenceName": "LinkedServiceofAzureBlobStorageforscriptPath", 
        "type": "LinkedServiceReference" 
       }, 
       "degreeOfParallelism": 3, 
       "priority": 100 
      }, 
      "name": "CopyFromAzureBlobToAzureSQL", 
      "description": "Copy data frm Azure blob to Azure SQL", 
      "linkedServiceName": { 
       "referenceName": "AzureDataLakeAnalyticsLinkedService", 
       "type": "LinkedServiceReference" 
      } 
     } 

也试过this approach,但仍然没有成功。

这是我们测试的虚拟脚本:

@a = 
    SELECT * 
    FROM(
     VALUES 
     (
      "Contoso", 
      1500.0 
     ), 
     (
      "Woodgrove", 
      2700.0 
     ), 
     (
      "Contoso", 
      1500.0 
     ), 
     (
      "Woodgrove", 
      2700.0 
     ), 
     (
      "Contoso", 
      1500.0 
     ), 
     (
      "Woodgrove", 
      2700.0 
     ), 
     (
      "Contoso", 
      1500.0 
     ), 
     (
      "Woodgrove", 
      2700.0 
     ), 
     (
      "Contoso", 
      1500.0 
     ), 
     (
      "Woodgrove", 
      2700.0 
     ), 
     (
      "Contoso", 
      1500.0 
     ), 
     (
      "Woodgrove", 
      2700.0 
     ) 
     ) AS 
       D(customer, amount); 
OUTPUT @a 
TO "/data"+DateTime.Now.ToString("yyyyMMddHHmmss")+".csv" 
USING Outputters.Csv(); 

但是这将是巨大的,如果你能指出一些更复杂的例子,在脚本后面的一些代码。

谢谢!

更新2018年1月26日

与MS有关usql部署协商后,我们来到了使用PowerShell命令的组合:

  • 我们执行一个脚本,上传是该.dll位于Datalake文件夹上的u-sql程序集的bin中;
  • 然后遍历该目录并分别创建每个程序集;
  • 对于我们在Datalake Analytics上创建它们作为存储过程的u-sql脚本,并上传一个简单的u-sql脚本来执行那些具有所需参数的过程;

回答

1

您不需要链接服务中的脚本路径。

团块链接服务应该仅仅是:

{ 
    "name": "Blob Name", 
    "properties": { 
     "type": "AzureStorage", 
     "typeProperties": { 
      "connectionString": { 
       "type": "SecureString", 
       "value": "DefaultEndpointsProtocol=https;AccountName=etc" 
      } 
     }, 
     "connectVia": { 
      "referenceName": "Your IR Ref", 
      "type": "IntegrationRuntimeReference" 
     } 
    } 
} 

然后在活动中参考使用的容器和文件名的脚本像下面的链接业务的引用名称。

"activities": [ 
     { 
      "name": "U-SQL1", 
      "type": "DataLakeAnalyticsU-SQL", 
      "policy": { 
       "timeout": "7.00:00:00", 
       "retry": 0, 
       "retryIntervalInSeconds": 20 
      }, 
      "typeProperties": { 
       "scriptPath": "u-sql1/Test", 
       "degreeOfParallelism": { 
        "value": "5", 
        "type": "Expression" 
       }, 
       "priority": 1, 
       "compilationMode": "Full", 
       "scriptLinkedService": { 
        "referenceName": "Your Blob Ref", 
        "type": "LinkedServiceReference" 
       } 
      }, 
      "linkedServiceName": { 
       "referenceName": "Your ADLa Ref", 
       "type": "LinkedServiceReference" 
      } 
     }, 

有关信息,我忽略了MS文档创建和使用新开发的用户界面,因为我有私人预览上网本JSON。上述内容已经过测试,工程,我这里斑点后使用它:

https://mrpaulandrew.com/2017/12/20/controlling-u-sql-job-aus-with-azure-data-factory-v2-pipeline-parameters/

希望这有助于。

+0

我从“container \\ script.txt” - >“container/script.usql”更改了脚本路径,现在它正在工作。此外,我对Blob LS的定义有问题(将以更明确的答案发布)。你能指点我一些关于如何使用依赖.dll(问题的第一部分)部署u-sql脚本并运行u-sql过程的教程,因为它需要scriptPath吗?我发现的每个样本都没有。 –