Azure ADF v2-如何向部署到 Azure Data Lake 的文件名添加/附加时间戳

标签 azure azure-data-lake azure-data-factory

我正在将文件部署到 azure datalake,但想要将日期时间戳附加到 filename 。我创建了一个数据集并创建了一个值为 utcnow() 的参数。 但文件未部署并附加时间戳。

{

"name": "tst",

"properties": {

    "linkedServiceName": {

        "referenceName": "LS_ADLS_AzureDataLakeStoreLinkedService",

        "type": "LinkedServiceReference"

    },

    "parameters": {

        "customVariable": {

            "type": "String",

            "defaultValue": "utcnow()"

        }

    },

    "type": "AzureDataLakeStoreFile",

    "typeProperties": {

        "format": {

            "type": "TextFormat",

            "columnDelimiter": "|",

            "rowDelimiter": "",

            "nullValue": "",

            "treatEmptyAsNull": true,

            "skipLineCount": 0,

            "firstRowAsHeader": true

        },

        "fileName": "abc-{customVariable}",

        "folderPath": "clusters/diageo-eun-analytics-nonprod-hdi-hd-nampolaris-dev01/hive/warehouse/Spirit_Deal/tst",

        "partitionedBy": [

            {

                "name": "customVariable",

                "value": {

                    "type": "DateTime",

                    "date": "SliceStart",

                    "format": "yyyyMMddHH"

                }

            }

        ]

    }

},

"type": "Microsoft.DataFactory/factories/datasets"

}

但是文件名现在附加了时间戳,即 abc-{customVariable}。请说明如何在 ADV v2 中添加

最佳答案

您绝对可以参数化文件名和路径。菲律宾比索。你试试@CONCAT。以下示例有效,展示了如何动态构建文件夹路径和文件名:

{
    "name": "TgtADLSSQL",
    "properties": {
        "linkedServiceName": {
            "referenceName": "Destination-DataLakeStore-gqf",
            "type": "LinkedServiceReference"
        },
        "folder": {
            "name": "Target"
        },
        "type": "AzureDataLakeStoreFile",
        "typeProperties": {
            "format": {
                "type": "ParquetFormat"
            },
            "fileName": {
                "value": "@CONCAT('Ingest_Date=', formatDateTime(trigger().startTime, 'yyyy-MM-dd/'),'Incremental-', pipeline().RunId, '.snappy.parquet')",
                "type": "Expression"
            },
            "folderPath": {
                "value": "/data/raw/corporate/sql/@{item().TABLE_NAME}",
                "type": "Expression"
             }
        }
    },
    "type": "Microsoft.DataFactory/factories/datasets"
}

另请参阅Dynamic folders in ADF V2 .

关于Azure ADF v2-如何向部署到 Azure Data Lake 的文件名添加/附加时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51430990/

相关文章:

Azure ADF 报价全部禁用

Azure Data Lake Store 作为 Databricks 中的外部表

hadoop - 将数据从 Hadoop(本地)加载到 Azure Data Lake 的不同方法

azure - 在 Azure 数据工厂中按缩写拆分行

azure - 无法更改代理虚拟机数量

azure - ADF 动态表达式 - 连接/如果缺少句点

javascript - Azure 移动服务 - 从两个表读取并返回自定义响应对象

Azure Synapse Pipeline如何将每个文件作为sql脚本执行?

azure - 使用 azure 数据工厂获取 azure blob 元数据键值

Azure 数据工厂 v2 无法将数据发送到 Azure 搜索