加入收藏 | 设为首页 | 会员中心 | 我要投稿 衡阳站长网 (https://www.0734zz.cn/)- 数据集成、设备管理、备份、数据加密、智能搜索!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

在Azure数据工厂中的管道中运行U-SQL活动时出错

发布时间:2021-01-17 13:47:52 所属栏目:MsSql教程 来源:网络整理
导读:我在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'

我在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 3rnnear the ###:rn**************rnDECLARE @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脚本的代码,我试图在管道中执行.

OutputDataset:

{
"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的容器,脚本在那里:

正如Alexandre所说,确保scriptPath完整.管道的开始:

{
    "name": "ComputeEventsByRegionPipeline","typeProperties": {
                    "scriptPath": "adlascriptsSearchLogProcessing.txt","scriptLinkedService": "StorageLinkedService","parameters": {
                        "in": "/input/SearchLog.tsv","out": "/output/Result.tsv"
                    }
                },...

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

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

(编辑:衡阳站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读