How to code an Azure Data Factory dataset?
TypeScriptCreating an Azure Data Factory dataset using Pulumi involves the use of the
azure-native:datafactory:Dataset
resource. This resource allows you to define a dataset and its properties within Azure Data Factory.Here is an example program that defines an Azure Data Factory dataset:
import * as pulumi from "@pulumi/pulumi"; import * as azure_native from "@pulumi/azure-native"; const resourceGroup = new azure_native.resources.ResourceGroup("resourceGroup", { resourceGroupName: "example-resources", }); const factory = new azure_native.datafactory.Factory("factory", { factoryName: "examplefactory", location: resourceGroup.location, resourceGroupName: resourceGroup.name, }); const dataset = new azure_native.datafactory.Dataset("dataset", { datasetName: "exampledataset", factoryName: factory.name, resourceGroupName: resourceGroup.name, properties: { type: "DelimitedText", typeProperties: { location: { type: "AzureBlobStorageLocation", folderPath: "example/folder", container: "examplecontainer", linkedServiceName: { referenceName: "exampleLinkedService", type: "LinkedServiceReference", }, }, }, }, });
Let's break down this program:
- First, we create a resource group using the
azure_native.resources.ResourceGroup
resource. This gives us a logical container where we can deploy our resources. - In the next step, we create an Azure Data Factory using the
azure_native.datafactory.Factory
resource. - Finally, we create the dataset using the
azure_native.datafactory.Dataset
resource. In the properties object, we specify that the dataset type isDelimitedText
. We also specify the location of the dataset, including thefolderPath
andcontainer
. ThelinkedServiceName
object refers to the linked service that this dataset should use. For example, Azure Blob Storage or Azure Data Lake Storage.
This creates a dataset in the specified Azure Data Factory.
Please, replace
"example/folder"
,"examplecontainer"
and"exampleLinkedService"
with actual values specific for your use-case.This is a basic example, and additional properties can be specified based on your requirements.
Check out the Dataset resource documentation for more information.
- First, we create a resource group using the