gpt4 book ai didi

azure - 在 Azure 数据工厂的管道中运行 U-SQL 事件时出错

转载 作者:行者123 更新时间:2023-12-01 08:51:14 26 4
gpt4 key购买 nike

在 ADF 的管道中运行 USQL 事件时出现以下错误:

事件错误:

{"errorId":"E_CSC_USER_SYNTAXERROR","severity":"Error","component":"CSC",
"source":"USER","message":"syntax error.
Final statement did not end with a semicolon","details":"at token 'txt', line 3\r\nnear the ###:\r\n**************\r\nDECLARE @in string = \"/demo/SearchLog.txt\";\nDECLARE @out string = \"/scripts/Result.txt\";\nSearchLogProcessing.txt ### \n",
"description":"Invalid syntax found in the script.",
"resolution":"Correct the script syntax, using expected token(s) as a guide.","helpLink":"","filePath":"","lineNumber":3,
"startOffset":109,"endOffset":112}].

这是我尝试在管道中执行的输出数据集、管道和 USQL 脚本的代码。

输出数据集:

{
"name": "OutputDataLakeTable",
"properties": {
"published": false,
"type": "AzureDataLakeStore",
"linkedServiceName": "LinkedServiceDestination",
"typeProperties": {
"folderPath": "scripts/"
},
"availability": {
"frequency": "Hour",
"interval": 1
}
}

管道:

{
"name": "ComputeEventsByRegionPipeline",
"properties": {
"description": "This is a pipeline to compute events for en-gb locale and date less than 2012/02/19.",
"activities": [
{
"type": "DataLakeAnalyticsU-SQL",
"typeProperties": {
"script": "SearchLogProcessing.txt",
"scriptPath": "scripts\\",
"degreeOfParallelism": 3,
"priority": 100,
"parameters": {
"in": "/demo/SearchLog.txt",
"out": "/scripts/Result.txt"
}
},
"inputs": [
{
"name": "InputDataLakeTable"
}
],
"outputs": [
{
"name": "OutputDataLakeTable"
}
],
"policy": {
"timeout": "06:00:00",
"concurrency": 1,
"executionPriorityOrder": "NewestFirst",
"retry": 1
},
"scheduler": {
"frequency": "Minute",
"interval": 15
},
"name": "CopybyU-SQL",
"linkedServiceName": "AzureDataLakeAnalyticsLinkedService"
}
],
"start": "2017-01-03T12:01:05.53Z",
"end": "2017-01-03T13:01:05.53Z",
"isPaused": false,
"hubName": "denojaidbfactory_hub",
"pipelineMode": "Scheduled"
}
}

这是我的 USQL 脚本,我尝试使用“DataLakeAnalyticsU-SQL”事件类型执行它。

@searchlog =
EXTRACT UserId int,
Start DateTime,
Region string,
Query string,
Duration int?,
Urls string,
ClickedUrls string
FROM @in
USING Extractors.Text(delimiter:'|');

@rs1 =
SELECT Start, Region, Duration
FROM @searchlog
WHERE Region == "kota";


OUTPUT @rs1
TO @out
USING Outputters.Text(delimiter:'|');

请建议我如何解决此问题。

最佳答案

您的脚本缺少 scriptLinkedService 属性。您(当前)还需要将 U-SQL 脚本放置在 Azure Blob 存储中才能成功运行。因此,您还需要一个AzureStorage链接服务,例如:

{
"name": "StorageLinkedService",
"properties": {
"description": "",
"type": "AzureStorage",
"typeProperties": {
"connectionString": "DefaultEndpointsProtocol=https;AccountName=myAzureBlobStorageAccount;AccountKey=**********"
}
}
}

创建此链接服务,将 Blob 存储名称 myAzureBlobStorageAccount 替换为相关的 Blob 存储帐户,然后将 U-SQL 脚本 (SearchLogProcessing.txt) 放入容器中并重试。在下面的示例管道中,我的 Blob 存储中有一个名为 adlascripts 的容器,脚本位于其中:

确保 scriptPath 完整,正如 Alexandre 提到的。管道开始:

{
"name": "ComputeEventsByRegionPipeline",
"properties": {
"description": "This is a pipeline to compute events for en-gb locale and date less than 2012/02/19.",
"activities": [
{
"type": "DataLakeAnalyticsU-SQL",
"typeProperties": {
"scriptPath": "adlascripts\\SearchLogProcessing.txt",
"scriptLinkedService": "StorageLinkedService",
"degreeOfParallelism": 3,
"priority": 100,
"parameters": {
"in": "/input/SearchLog.tsv",
"out": "/output/Result.tsv"
}
},
...

输入输出 .tsv 文件可以位于数据湖中并使用AzureDataLakeStoreLinkedService 链接服务。

我可以看到您正在尝试关注以下演示:https://learn.microsoft.com/en-us/azure/data-factory/data-factory-usql-activity#script-definition 。这不是最直观的演示,似乎存在一些问题,例如StorageLinkedService的定义在哪里?,SearchLogProcessing.txt在哪里?好的,我通过谷歌搜索找到了它,但网页中应该有一个链接。我让它工作了,但感觉有点像《混血王子》中的哈利·波特。

关于azure - 在 Azure 数据工厂的管道中运行 U-SQL 事件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41443467/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com