Veri kümeleri oluşturma

Tamamlandı

Veri kümesi, etkinliklerinizde kullanmak istediğiniz verileri giriş ve çıkış olarak işaret eden veya bunlara başvuran adlandırılmış bir veri görünümüdür. Veri kümeleri tablolar, dosyalar, klasörler ve belgeler gibi farklı veri depolarındaki verileri tanımlar. Örneğin Azure Blob veri kümesi, etkinliğin verileri okuması için gereken blob kapsayıcısını ve Blob depolama klasörünü belirtir.

Data Factory'deki bir veri kümesi, Veri Kopyalama Etkinliği içindeki bir nesne olarak, ayrı bir nesne olarak veya programlı oluşturma için JSON biçiminde aşağıdaki gibi tanımlanabilir:

{
    "name": "<name of dataset>",
    "properties": {
        "type": "<type of dataset: AzureBlob, AzureSql etc...>",
        "linkedServiceName": {
                "referenceName": "<name of linked service>",
                "type": "LinkedServiceReference",
        },
        "schema": [
            {
                "name": "<Name of the column>",
                "type": "<Name of the type>"
            }
        ],
        "typeProperties": {
            "<type specific property>": "<value>",
            "<type specific property 2>": "<value 2>",
        }
    }
}

Aşağıdaki tabloda yukarıdaki JSON'daki özellikler açıklanmaktadır:

Özellik Açıklama Gerekli
name Veri kümesinin adı. Evet
type Veri kümesinin türü. Data Factory tarafından desteklenen türlerden birini belirtin (örneğin: AzureBlob, AzureSqlTable). Evet
Şema Veri kümesinin şeması. No
typeProperties Tür özellikleri her tür için farklıdır (örneğin: Azure Blob, Azure SQL tablosu). Evet

Veri kümesi örneği

Azure Blob

Bu yordamda iki veri kümesi oluşturursunuz: InputDataset ve OutputDataset. Bu veri kümeleri İkili türündedir. Azure Depolama LinkedService adlı Azure Depolama bağlı hizmetine başvurur. Giriş veri kümesi, giriş klasöründeki kaynak verileri temsil eder. Giriş veri kümesi tanımında, kaynak verileri içeren blob kapsayıcısını (adftutorial), klasörü (input) ve dosyayı (emp.txt) belirtirsiniz. Çıkış veri kümesi hedefe kopyalanan verileri temsil eder. Çıkış veri kümesi tanımında, verilerin kopyalandığı blob kapsayıcısını (adftutorial), klasörü (output) ve dosyayı belirtirsiniz.

  1. Masaüstünüzde, C sürücünüzde ADFv2QuickStartPSH adlı bir klasör oluşturun.

  2. C:\ADFv2QuickStartPSH klasöründe aşağıdaki içeriğe sahip InputDataset.json adlı bir JSON dosyası oluşturun:

      {
          "name": "InputDataset",
          "properties": {
              "linkedServiceName": {
                  "referenceName": "AzureStorageLinkedService",
                  "type": "LinkedServiceReference"
              },
              "annotations": [],
              "type": "Binary",
              "typeProperties": {
                  "location": {
                      "type": "AzureBlobStorageLocation",
                      "fileName": "emp.txt",
                      "folderPath": "input",
                      "container": "adftutorial"
                  }
              }
          }
      }
    
      ```
    
    
  3. InputDataset veri kümesini oluşturmak için Set-AzDataFactoryV2Dataset cmdlet'ini çalıştırın.

    Set-AzDataFactoryV2Dataset -DataFactoryName $DataFactory.DataFactoryName `
        -ResourceGroupName $ResGrp.ResourceGroupName -Name "InputDataset" `
        -DefinitionFile ".\InputDataset.json"
    

    Örnek çıktı aşağıdaki gibidir:

    DatasetName       : InputDataset
    ResourceGroupName : <resourceGroupname>
    DataFactoryName   : <dataFactoryName>
    Structure         :
    Properties        : Microsoft.Azure.Management.DataFactory.Models.BinaryDataset
    
  4. Çıkış veri kümesini oluşturmak için adımları yineleyin. C:\ADFv2QuickStartPSH klasöründe aşağıdaki içeriğe sahip OutputDataset.json adlı bir JSON dosyası oluşturun:

    {
        "name": "OutputDataset",
        "properties": {
            "linkedServiceName": {
                "referenceName": "AzureStorageLinkedService",
                "type": "LinkedServiceReference"
            },
            "annotations": [],
            "type": "Binary",
            "typeProperties": {
                "location": {
                    "type": "AzureBlobStorageLocation",
                    "folderPath": "output",
                    "container": "adftutorial"
                }
            }
        }
    }
    
  5. OutDataset'i oluşturmak için Set-AzDataFactoryV2Dataset cmdlet'ini çalıştırın.

    Set-AzDataFactoryV2Dataset -DataFactoryName $DataFactory.DataFactoryName `
        -ResourceGroupName $ResGrp.ResourceGroupName -Name "OutputDataset" `
        -DefinitionFile ".\OutputDataset.json"
    

    Örnek çıktı aşağıdaki gibidir:

    DatasetName       : OutputDataset
    ResourceGroupName : <resourceGroupname>
    DataFactoryName   : <dataFactoryName>
    Structure         :
    Properties        : Microsoft.Azure.Management.DataFactory.Models.BinaryDataset