如何在ADF Sink中为动态内容附加列设置BigInt数据类型
在Azure Data Factory中为附加列设置BigInt数据类型的方法
你的问题核心是附加列默认被识别为nvarchar(max),且用@int()转换大数值时触发警告——这是因为目标数值3604509277250831000远超出了Int类型的范围(Int最大值为2147483647),需要用BigInt类型处理,具体解决方法如下:
使用BigInt类型转换函数
替换@int()为@bigint()函数转换动态参数,ADF会将该列识别为BigInt类型,避免范围溢出警告。修改后的附加列配置片段:"additionalColumns": [ { "name": "ApplicationId", "value": "@bigint(pipeline().parameters.application.applicationId)" } ]确保类型转换配置生效
保留Translator部分的typeConversion: true设置,ADF会根据转换后的类型自动映射到Sink列类型。如果是自动创建目标表,Azure SQL Sink会生成BigInt类型的ApplicationId列;如果是已有表,需保证目标表对应列也是BigInt类型,避免写入时类型不匹配。完整配置示例
修改后的完整JSON配置:{ "source": { "type": "SqlServerSource", "additionalColumns": [ { "name": "ApplicationId", "value": "@bigint(pipeline().parameters.application.applicationId)" } ], "sqlReaderQuery": "SELECT * from Table A", "queryTimeout": "02:00:00", "isolationLevel": "ReadUncommitted", "partitionOption": "None" }, "sink": { "type": "AzureSqlSink", "writeBehavior": "insert", "sqlWriterUseTableLock": false, "tableOption": "autoCreate", "disableMetricsCollection": false }, "enableStaging": false, "translator": { "type": "TabularTranslator", "typeConversion": true, "typeConversionSettings": { "allowDataTruncation": true, "treatBooleanAsNumber": false } } }
内容的提问来源于stack exchange,提问作者Mit Jacob
相关产品推荐
相关产品推荐

