azure-pipelines - In ADF V2 - how to append date ("yyyyMMdd")) to filename dynamically for S3 dataset
问题描述
I'm currently working to automate a pipeline in ADFv2 where the source data sits in S3. A new file is created daily and is structured "data_20180829.csv"
I have tried to instrument dynamic content to accomplish this in the fileName field of Copy Data Activity. However even when I try something as simple as @{concat('data_','20180829.csv')} (that should resolve to the correct value) the source fails.
Is there any way to see what the dynamic content will resolve to?
解决方案
This should just be a matter of setting the filename expression in the dataset, eg
Note, the setting is done on the dataset not at the Copy activity level. Also note you can make your expression more dynamic by combining the utcnow
function with formatDateTime, eg something like this:
@concat('data_',formatDateTime(utcnow(),'yyyMMdd_HHmmss'),'.csv')
Note carefully the case of the formatting strings. Capital MM
is for month in a two-digit format. HH
is for the hour in 24-hour format. The full list of formatting strings is here.
The json for the dataset looks like this:
{
"name": "DelimitedText3",
"properties": {
"linkedServiceName": {
"referenceName": "linkedService2",
"type": "LinkedServiceReference"
},
"annotations": [],
"type": "DelimitedText",
"typeProperties": {
"location": {
"type": "AzureBlobStorageLocation",
"fileName": {
"value": "@concat('data_',formatDateTime(utcnow(),'yyyMMdd_HHmmss'),'.csv')",
"type": "Expression"
},
"container": "ang"
},
"columnDelimiter": ",",
"escapeChar": "\\",
"quoteChar": "\""
},
"schema": [
{
"type": "String"
},
{
"type": "String"
},
{
"type": "String"
},
{
"type": "String"
}
]
}
}
推荐阅读
- docker - 如何修改docker Image中的文件
- mysql - 会话变量不同于 MariaDB 中的全局变量
- c# - 如何通过机器人真正向 Teams 中的用户发送消息
- ms-access - 我可以创建“链接”访问对象(查询、宏等)(类似于“链接表”)吗?
- asp.net-core - .Net Core WebApp 需要清除站点数据才能运行
- advanced-custom-fields - 高级自定义字段 (ACF) 中继器 + 联系表 7
- mysql - mysql:与子查询连接时重复的列名
- angular - 将 'as' 与 *ngIf 一起使用
- python - 计算字符串中出现的字符数
- reactjs - 如何将以下内容映射为预期结果的反应状态