尝试运行增量负载管道但失败

时间:2019-07-22 12:17:45

标签: azure-data-factory-2 azure-sqldw

嗨,我已经建立了一个简单的管道,该管道基本上每天运行,并在前一天和当天之间复制数据,我的管道出现故障,并且不确定为什么,下面是我一直在使用的所附代码,任何人都可以帮助我为什么每次尝试运行此命令时都会出错?我的来源是oracle,目的地是Azure数据仓库。

代码:

{
    "name": "Copy_sgd",
    "type": "Copy",
    "dependsOn": [],
    "policy": {
        "timeout": "7.00:00:00",
        "retry": 0,
        "retryIntervalInSeconds": 30,
        "secureOutput": false,
        "secureInput": false
    },
    "userProperties": [
        {
            "name": "Source",
            "value": "\"COMPANY_1_RPT\".\"V7261_0059_GL_DETAIL_VIEW\""
        },
        {
            "name": "Destination",
            "value": "[COMPANY_1_RPT].[V7261_0059_GL_DETAIL_VIEW]"
        }
    ],
    "typeProperties": {
        "source": {
            "type": "OracleSource",
            "oracleReaderQuery": {
                "value": "select * from \"COMPANY_1_RPT\".\"V7261_0059_GL_DETAIL_VIEW\" \nwhere \"GLPOSTINGDATE\" >= TO_DATE('@{formatDateTime(pipeline().parameters.windowStart, 'yyyy-MM-dd HH:mm' )}', 'YYYY-MM-DD HH24:MI') \nAND \"GLPOSTINGDATE\" < TO_DATE('@{formatDateTime(pipeline().parameters.windowEnd, 'yyyy-MM-dd HH:mm' )}', 'YYYY-MM-DD HH24:MI')",
                "type": "Expression"
            },
            "partitionOption": "None"
        },
        "sink": {
            "type": "SqlDWSink",
            "allowPolyBase": false,
            "preCopyScript": {
                "value": "delete * from \"COMPANY_1_RPT\".\"V7261_0059_GL_DETAIL_VIEW\" \nwhere \"GLPOSTINGDATE\" >= TO_DATE('@{formatDateTime(pipeline().parameters.windowStart, 'yyyy-MM-dd HH:mm' )}', 'YYYY-MM-DD HH24:MI') \nAND \"GLPOSTINGDATE\" < TO_DATE('@{formatDateTime(pipeline().parameters.windowEnd, 'yyyy-MM-dd HH:mm' )}', 'YYYY-MM-DD HH24:MI')",
                "type": "Expression"
            }
        },
        "enableStaging": true,
        "stagingSettings": {
            "linkedServiceName": {
                "referenceName": "adfv2logs",
                "type": "LinkedServiceReference"
            },
            "path": "adf-v2-logs"
        },
        "enableSkipIncompatibleRow": true,
        "redirectIncompatibleRowSettings": {
            "linkedServiceName": {
                "referenceName": "adfv2logs",
                "type": "LinkedServiceReference"
            },
            "path": "adf-v2-logs"
        },
        "translator": {
            "type": "TabularTranslator",
            "mappings": [
                {
                    "source": {
                        "name": "SOURCENAME",
                        "type": "String"
                    },
                    "sink": {
                        "name": "SOURCENAME",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "VENDNAMEIDX",
                        "type": "Decimal"
                    },
                    "sink": {
                        "name": "VENDNAMEIDX",
                        "type": "Decimal"
                    }
                },
                {
                    "source": {
                        "name": "VENDORID",
                        "type": "String"
                    },
                    "sink": {
                        "name": "VENDORID",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "VENDORNAME",
                        "type": "String"
                    },
                    "sink": {
                        "name": "VENDORNAME",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "NAME_DESCR",
                        "type": "String"
                    },
                    "sink": {
                        "name": "NAME_DESCR",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "NUM",
                        "type": "String"
                    },
                    "sink": {
                        "name": "NUM",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "DESCRIPTION",
                        "type": "String"
                    },
                    "sink": {
                        "name": "DESCRIPTION",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "DEBITAMT",
                        "type": "Double"
                    },
                    "sink": {
                        "name": "DEBITAMT",
                        "type": "Single"
                    }
                },
                {
                    "source": {
                        "name": "CREDITAMT",
                        "type": "Double"
                    },
                    "sink": {
                        "name": "CREDITAMT",
                        "type": "Single"
                    }
                },
                {
                    "source": {
                        "name": "AMT",
                        "type": "Double"
                    },
                    "sink": {
                        "name": "AMT",
                        "type": "Single"
                    }
                },
                {
                    "source": {
                        "name": "ACRUCASHTYPE",
                        "type": "String"
                    },
                    "sink": {
                        "name": "ACRUCASHTYPE",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "DEPTIDX",
                        "type": "Decimal"
                    },
                    "sink": {
                        "name": "DEPTIDX",
                        "type": "Decimal"
                    }
                },
                {
                    "source": {
                        "name": "DEPARTMENTID",
                        "type": "String"
                    },
                    "sink": {
                        "name": "DEPARTMENTID",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "DEPARTMENTNAME",
                        "type": "String"
                    },
                    "sink": {
                        "name": "DEPARTMENTNAME",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "ACCTIDX",
                        "type": "Decimal"
                    },
                    "sink": {
                        "name": "ACCTIDX",
                        "type": "Decimal"
                    }
                },
                {
                    "source": {
                        "name": "GLACCOUNTID",
                        "type": "String"
                    },
                    "sink": {
                        "name": "GLACCOUNTID",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "GLACCOUNTNAME",
                        "type": "String"
                    },
                    "sink": {
                        "name": "GLACCOUNTNAME",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "GLACCOUNTTYPE",
                        "type": "String"
                    },
                    "sink": {
                        "name": "GLACCOUNTTYPE",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "COSTCENTERIDX",
                        "type": "Decimal"
                    },
                    "sink": {
                        "name": "COSTCENTERIDX",
                        "type": "Decimal"
                    }
                },
                {
                    "source": {
                        "name": "COSTCENTERID",
                        "type": "String"
                    },
                    "sink": {
                        "name": "COSTCENTERID",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "COSTCENTERNAME",
                        "type": "String"
                    },
                    "sink": {
                        "name": "COSTCENTERNAME",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "CACMTY",
                        "type": "String"
                    },
                    "sink": {
                        "name": "CACMTY",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "CACROPRANCH",
                        "type": "String"
                    },
                    "sink": {
                        "name": "CACROPRANCH",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "PHASEIDX",
                        "type": "Decimal"
                    },
                    "sink": {
                        "name": "PHASEIDX",
                        "type": "Decimal"
                    }
                },
                {
                    "source": {
                        "name": "PHASEID",
                        "type": "String"
                    },
                    "sink": {
                        "name": "PHASEID",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "PHASENAME",
                        "type": "String"
                    },
                    "sink": {
                        "name": "PHASENAME",
                        "type": "String"
                    }
                },
                {
                    "source": {
                        "name": "GLPOSTINGDATE",
                        "type": "DateTime"
                    },
                    "sink": {
                        "name": "GLPOSTINGDATE",
                        "type": "DateTime"
                    }
                },
                {
                    "source": {
                        "name": "SOURCEIDX",
                        "type": "Decimal"
                    },
                    "sink": {
                        "name": "SOURCEIDX",
                        "type": "Decimal"
                    }
                },
                {
                    "source": {
                        "name": "SOURCEID",
                        "type": "String"
                    },
                    "sink": {
                        "name": "SOURCEID",
                        "type": "String"
                    }
                }
            ]
        }
    },
    "inputs": [
        {
            "referenceName": "SourceDataset_sgd",
            "type": "DatasetReference"
        }
    ],
    "outputs": [
        {
            "referenceName": "DestinationDataset_sgd",
            "type": "DatasetReference"
        }
    ]
}

错误

{
    "errorCode": "2200",
    "message": "ErrorCode=FailedDbOperation,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed with the following error: &apos;Parse error at line: 1&#44; column: 8: Incorrect syntax near &apos;*&apos;.&apos;,Source=,''Type=System.Data.SqlClient.SqlException,Message=Parse error at line: 1&#44; column: 8: Incorrect syntax near &apos;*&apos;.,Source=.Net SqlClient Data Provider,SqlErrorNumber=103010,Class=16,ErrorCode=-2146232060,State=1,Errors=[{Class=16,Number=103010,State=1,Message=Parse error at line: 1&#44; column: 8: Incorrect syntax near &apos;*&apos;.,},],'",
    "failureType": "UserError",
    "target": "Copy_sgd"
}

2 个答案:

答案 0 :(得分:0)

这显然是查询中的语法错误。我几乎总是通过以下步骤解决此类问题:

1-运行管道 2-如果失败,请检查复制活动的输入,其值之一将是管道正在构建的确切查询。收到。 3-尝试在数据库上手动运行该查询,它可能会出现语法错误。 4-修正查询中的语法,然后尝试在管道中复制该修正。

您应该很好!如果您需要进一步的帮助,请在此处发布,我会尽力为您提供帮助。

希望这对您有帮助!

答案 1 :(得分:0)

由于您提到这里的接收器是SQL,所以我确定下面的语法是错误的

“值”:“从XXXXX中删除*

应该是

“ value”:“从XXXXX中删除。