Remove duplicate sample for EventHubsCaptureEventGridDemo

This commit is contained in:
Ramya Achutha Rao 2021-04-08 17:54:25 -07:00 коммит произвёл Serkant Karaca
Родитель 3173df7751
Коммит 034530b4b7
21 изменённых файлов: 0 добавлений и 955 удалений

Просмотреть файл

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Просмотреть файл

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C9E1D3C8-0C0D-45EB-A3B5-15F95EFC01E3}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>DWDumper</RootNamespace>
<AssemblyName>DWDumper</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Avro, Version=0.9.0.0, Culture=neutral, PublicKeyToken=b1248d7eeb9d0814, processorArchitecture=MSIL">
<HintPath>..\packages\Apache.Avro.1.7.7.2\lib\Avro.dll</HintPath>
</Reference>
<Reference Include="Azure.Core, Version=1.0.1.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<HintPath>..\packages\Azure.Core.1.0.1\lib\netstandard2.0\Azure.Core.dll</HintPath>
</Reference>
<Reference Include="Azure.Storage.Blobs, Version=12.1.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<HintPath>..\packages\Azure.Storage.Blobs.12.1.0\lib\netstandard2.0\Azure.Storage.Blobs.dll</HintPath>
</Reference>
<Reference Include="Azure.Storage.Common, Version=12.1.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<HintPath>..\packages\Azure.Storage.Common.12.1.0\lib\netstandard2.0\Azure.Storage.Common.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.1.2.10\lib\2.0\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.KeyVault.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Data.Edm, Version=5.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.Edm.5.8.2\lib\net40\Microsoft.Data.Edm.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Data.OData, Version=5.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.OData.5.8.2\lib\net40\Microsoft.Data.OData.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Data.Services.Client, Version=5.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.Services.Client.5.8.2\lib\net40\Microsoft.Data.Services.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=9.3.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\WindowsAzure.Storage.9.3.3\lib\net45\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.6.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Spatial, Version=5.8.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\System.Spatial.5.8.2\lib\net40\System.Spatial.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WindTurbineMeasure.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Просмотреть файл

@ -1,121 +0,0 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace DWDumper
{
using System;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using Avro.File;
using Avro.Generic;
using Newtonsoft.Json;
using Azure.Storage.Blobs;
using System.IO;
/// <summary>
/// A simple test program to dump a single Avro blob file created by EventHubs Capture into a SQL data warehouse (DW).
/// This is useful for testing connections with your SQL DW before integrating this DW dumping code with Azure Functions
/// </summary>
class Program
{
private const string StorageConnectionString = "[provide your storage connection string]";
private const string EventHubsCaptureAvroBlobContainer = "<< Blobs container>>";
private const string EventHubsCaptureAvroBlobName = "<<Blob name>>";
private const string SqlDwConnection = "[provide the SQL DW connection string]";
private static int Main(string[] args)
{
var p = new Program();
p.Dump();
return 0;
}
public void Dump()
{
// Get the blob reference
BlobContainerClient blobContainer = new BlobContainerClient(StorageConnectionString, EventHubsCaptureAvroBlobContainer);
BlobClient blob = blobContainer.GetBlobClient(EventHubsCaptureAvroBlobName);
// Download the content to a memory stream
using (Stream blobStream = new MemoryStream())
{
blob.DownloadToAsync(blobStream);
using (var dataTable = GetWindTurbineMetricsTable())
{
// Parse the Avro File
using (var avroReader = DataFileReader<GenericRecord>.OpenReader(blobStream))
{
while (avroReader.HasNext())
{
GenericRecord r = avroReader.Next();
byte[] body = (byte[])r["Body"];
var windTurbineMeasure = DeserializeToWindTurbineMeasure(body);
// Add the row to in memory table
AddWindTurbineMetricToTable(dataTable, windTurbineMeasure);
}
}
if (dataTable.Rows.Count > 0)
{
BatchInsert(dataTable);
}
}
}
}
private void BatchInsert(DataTable table)
{
// Write the data to SQL DW using SqlBulkCopy
using (var sqlDwConnection = new SqlConnection(SqlDwConnection))
{
sqlDwConnection.Open();
using (var bulkCopy = new SqlBulkCopy(sqlDwConnection))
{
bulkCopy.BulkCopyTimeout = 30;
bulkCopy.DestinationTableName = "dbo.Fact_WindTurbineMetrics";
bulkCopy.WriteToServer(table);
}
}
}
private WindTurbineMeasure DeserializeToWindTurbineMeasure(byte[] body)
{
string payload = Encoding.ASCII.GetString(body);
return JsonConvert.DeserializeObject<WindTurbineMeasure>(payload);
}
private DataTable GetWindTurbineMetricsTable()
{
var dt = new DataTable();
dt.Columns.AddRange
(
new DataColumn[5]
{
new DataColumn("DeviceId", typeof(string)),
new DataColumn("MeasureTime", typeof(DateTime)),
new DataColumn("GeneratedPower", typeof(float)),
new DataColumn("WindSpeed", typeof(float)),
new DataColumn("TurbineSpeed", typeof(float))
}
);
return dt;
}
private void AddWindTurbineMetricToTable(DataTable table, WindTurbineMeasure wtm)
{
table.Rows.Add(wtm.DeviceId, wtm.MeasureTime, wtm.GeneratedPower, wtm.WindSpeed, wtm.TurbineSpeed);
Console.WriteLine(
"DeviceId: {0}, MeasureTime: {1}, GeneratedPower: {2}, WindSpeed: {3}, TurbineSpeed: {4}",
wtm.DeviceId, wtm.MeasureTime, wtm.GeneratedPower, wtm.WindSpeed, wtm.TurbineSpeed);
}
}
}

Просмотреть файл

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DWDumper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DWDumper")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c9e1d3c8-0c0d-45eb-a3b5-15f95efc01e3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -1,16 +0,0 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace DWDumper
{
using System;
// TODO, move this class to a Contracts assembly that is shared across different projects
class WindTurbineMeasure
{
public string DeviceId { get; set; }
public DateTime MeasureTime { get; set; }
public float GeneratedPower { get; set; }
public float WindSpeed { get; set; }
public float TurbineSpeed { get; set; }
}
}

Просмотреть файл

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Apache.Avro" version="1.7.7.2" targetFramework="net461" />
<package id="Azure.Core" version="1.0.1" targetFramework="net461" />
<package id="Azure.Storage.Blobs" version="12.1.0" targetFramework="net461" />
<package id="Azure.Storage.Common" version="12.1.0" targetFramework="net461" />
<package id="log4net" version="1.2.10" targetFramework="net461" />
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net461" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.0.0" targetFramework="net461" />
<package id="Microsoft.Data.Edm" version="5.8.2" targetFramework="net461" />
<package id="Microsoft.Data.OData" version="5.8.2" targetFramework="net461" />
<package id="Microsoft.Data.Services.Client" version="5.8.2" targetFramework="net461" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net461" />
<package id="System.Buffers" version="4.5.0" targetFramework="net461" />
<package id="System.ComponentModel.EventBasedAsync" version="4.0.11" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.6.0" targetFramework="net461" />
<package id="System.Dynamic.Runtime" version="4.0.0" targetFramework="net461" />
<package id="System.Linq.Queryable" version="4.0.0" targetFramework="net461" />
<package id="System.Memory" version="4.5.3" targetFramework="net461" />
<package id="System.Net.Requests" version="4.0.11" targetFramework="net461" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
<package id="System.Spatial" version="5.8.2" targetFramework="net461" />
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net461" />
<package id="WindowsAzure.Storage" version="9.3.3" targetFramework="net461" />
</packages>

Просмотреть файл

@ -1,37 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindTurbineDataGenerator", "WindTurbineDataGenerator\WindTurbineDataGenerator.csproj", "{0C87A54A-AD21-46D5-8B75-4247DA32237E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DWDumper", "DWDumper\DWDumper.csproj", "{C9E1D3C8-0C0D-45EB-A3B5-15F95EFC01E3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionEGDWDumper", "FunctionEGDWDumper\FunctionEGDWDumper.csproj", "{27D28A3D-4157-4ED2-A1C4-5525507CCA04}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0C87A54A-AD21-46D5-8B75-4247DA32237E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C87A54A-AD21-46D5-8B75-4247DA32237E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C87A54A-AD21-46D5-8B75-4247DA32237E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C87A54A-AD21-46D5-8B75-4247DA32237E}.Release|Any CPU.Build.0 = Release|Any CPU
{C9E1D3C8-0C0D-45EB-A3B5-15F95EFC01E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9E1D3C8-0C0D-45EB-A3B5-15F95EFC01E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9E1D3C8-0C0D-45EB-A3B5-15F95EFC01E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9E1D3C8-0C0D-45EB-A3B5-15F95EFC01E3}.Release|Any CPU.Build.0 = Release|Any CPU
{27D28A3D-4157-4ED2-A1C4-5525507CCA04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27D28A3D-4157-4ED2-A1C4-5525507CCA04}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27D28A3D-4157-4ED2-A1C4-5525507CCA04}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27D28A3D-4157-4ED2-A1C4-5525507CCA04}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0BDB7260-AF54-438B-B99E-95E7136C1486}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -1,32 +0,0 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace FunctionEGDWDumper
{
/// <summary>
/// These classes were generated from the EventGrid event schema.
/// <see cref="DWDumperFunction1"/> comments for understanding how the EventGrid schema was obtained.
/// </summary>
public class EventGridEHEvent
{
public string topic { get; set; }
public string subject { get; set; }
public string eventType { get; set; }
public string eventTime { get; set; }
public string id { get; set; }
public Data data { get; set; }
}
public class Data
{
public string fileUrl { get; set; }
public string fileType { get; set; }
public string partitionId { get; set; }
public int sizeInBytes { get; set; }
public int eventCount { get; set; }
public int firstSequenceNumber { get; set; }
public int lastSequenceNumber { get; set; }
public string firstEnqueueTime { get; set; }
public string lastEnqueueTime { get; set; }
}
}

Просмотреть файл

@ -1,155 +0,0 @@
// This is the default URL for triggering event grid function in the local environment.
// http://localhost:7071/admin/extensions/EventGridExtensionConfig?functionName={functionname}
using System;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace FunctionEGDWDumper
{
using System.Text;
using Avro.File;
using Avro.Generic;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.EventGrid;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.WindowsAzure.Storage;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
public static class Function1
{
private static readonly string StorageConnectionString = Environment.GetEnvironmentVariable("StorageConnectionString");
private static readonly string SqlDwConnection = Environment.GetEnvironmentVariable("SqlDwConnection");
/// <summary>
/// Use the accompanying .sql script to create this table in the data warehouse
/// </summary>
private const string TableName = "dbo.Fact_WindTurbineMetrics";
[FunctionName("EventGridTriggerMigrateData")]
public static void Run([EventGridTrigger]JObject eventGridEvent, TraceWriter log)
{
log.Info("C# EventGrid trigger function processed a request.");
log.Info(eventGridEvent.ToString(Formatting.Indented));
try
{
// Copy to a static Album instance
EventGridEHEvent ehEvent = eventGridEvent.ToObject<EventGridEHEvent>();
// Get the URL from the event that points to the Capture file
var uri = new Uri(ehEvent.data.fileUrl);
// Get data from the file and migrate to data warehouse
Dump(uri);
}
catch (Exception e)
{
string s = string.Format(CultureInfo.InvariantCulture,
"Error processing request. Exception: {0}, Request: {1}", e, eventGridEvent.ToString());
log.Error(s);
}
}
/// <summary>
/// Dumps the data from the Avro blob to the data warehouse (DW).
/// Before running this, ensure that the DW has the required <see cref="TableName"/> table created.
/// </summary>
private static void Dump(Uri fileUri)
{
// Get the blob reference
var storageAccount = CloudStorageAccount.Parse(StorageConnectionString);
var blobClient = storageAccount.CreateCloudBlobClient();
var blob = blobClient.GetBlobReferenceFromServer(fileUri);
using (var dataTable = GetWindTurbineMetricsTable())
{
// Parse the Avro File
using (var avroReader = DataFileReader<GenericRecord>.OpenReader(blob.OpenRead()))
{
while (avroReader.HasNext())
{
GenericRecord r = avroReader.Next();
byte[] body = (byte[])r["Body"];
var windTurbineMeasure = DeserializeToWindTurbineMeasure(body);
// Add the row to in memory table
AddWindTurbineMetricToTable(dataTable, windTurbineMeasure);
}
}
if (dataTable.Rows.Count > 0)
{
BatchInsert(dataTable);
}
}
}
/// <summary>
/// Open connection to data warehouse. Write the parsed data to the table.
/// </summary>
private static void BatchInsert(DataTable table)
{
// Write the data to SQL DW using SqlBulkCopy
using (var sqlDwConnection = new SqlConnection(SqlDwConnection))
{
sqlDwConnection.Open();
using (var bulkCopy = new SqlBulkCopy(sqlDwConnection))
{
bulkCopy.BulkCopyTimeout = 30;
bulkCopy.DestinationTableName = TableName;
bulkCopy.WriteToServer(table);
}
}
}
/// <summary>
/// Deserialize data and return object with expected properties.
/// </summary>
private static WindTurbineMeasure DeserializeToWindTurbineMeasure(byte[] body)
{
string payload = Encoding.ASCII.GetString(body);
return JsonConvert.DeserializeObject<WindTurbineMeasure>(payload);
}
/// <summary>
/// Define the in-memory table to store the data. The columns match the columns in the .sql script.
/// </summary>
private static DataTable GetWindTurbineMetricsTable()
{
var dt = new DataTable();
dt.Columns.AddRange
(
new DataColumn[5]
{
new DataColumn("DeviceId", typeof(string)),
new DataColumn("MeasureTime", typeof(DateTime)),
new DataColumn("GeneratedPower", typeof(float)),
new DataColumn("WindSpeed", typeof(float)),
new DataColumn("TurbineSpeed", typeof(float))
}
);
return dt;
}
/// <summary>
/// For each parsed record, add a row to the in-memory table.
/// </summary>
private static void AddWindTurbineMetricToTable(DataTable table, WindTurbineMeasure wtm)
{
table.Rows.Add(wtm.DeviceId, wtm.MeasureTime, wtm.GeneratedPower, wtm.WindSpeed, wtm.TurbineSpeed);
}
}
}

Просмотреть файл

@ -1,23 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Apache.Avro" Version="1.7.7.2" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventGrid" Version="1.0.0-beta4" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.13" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,18 +0,0 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace FunctionEGDWDumper
{
using System;
// TODO, move this class to a Contracts assembly that is shared across different projects
class WindTurbineMeasure
{
public string DeviceId { get; set; }
public DateTime MeasureTime { get; set; }
public float GeneratedPower { get; set; }
public float WindSpeed { get; set; }
public float TurbineSpeed { get; set; }
}
}

Просмотреть файл

@ -1,2 +0,0 @@
{
}

Просмотреть файл

@ -1,7 +0,0 @@
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"AzureWebJobsDashboard": ""
}
}

Просмотреть файл

@ -1,3 +0,0 @@
# Migrate captured Event Hubs data to a SQL Data Warehouse using Event Grid and Azure Function
See this [tutorial article](https://docs.microsoft.com/azure/event-hubs/store-captured-data-data-warehouse) for details on using this sample. It shows you how to capture data from your event hub into a SQL data warehouse by using an Azure function triggered by an event grid.

Просмотреть файл

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Azure.Amqp" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Просмотреть файл

@ -1,97 +0,0 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace WindTurbineDataGenerator
{
using System;
using System.Diagnostics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Azure.Messaging.EventHubs;
using Azure.Messaging.EventHubs.Producer;
internal class Program
{
private const string EventHubNamespaceConnectionString = "<EVENT HUBS NAMESPACE CONNECTION STRING>";
private const string EventHubName = "<EVENT HUB NAME>";
private static int Main()
{
Console.WriteLine("Starting wind turbine generator. Press <ENTER> to exit");
// Start generation of events
var cts = new CancellationTokenSource();
var t0 = StartEventGenerationAsync(cts.Token);
Console.ReadLine();
cts.Cancel();
var t1 = Task.Delay(TimeSpan.FromSeconds(3));
Task.WhenAny(t0, t1).GetAwaiter().GetResult();
return 0;
}
private static async Task StartEventGenerationAsync(CancellationToken cancellationToken)
{
var random = new Random((int)DateTimeOffset.UtcNow.Ticks);
// create an Event Hubs Producer client using the namespace connection string and the event hub name
EventHubProducerClient producerClient = new EventHubProducerClient(EventHubNamespaceConnectionString, EventHubName);
while (!cancellationToken.IsCancellationRequested)
{
try
{
// Simulate sending data from 100 weather sensors
// prepare a batch of events to send to the event hub.
EventDataBatch eventBatch = await producerClient.CreateBatchAsync();
for (int i = 0; i < 100; i++)
{
int scaleFactor = random.Next(0, 25);
var windTurbineMeasure = GenerateTurbineMeasure("Turbine_" + i, scaleFactor);
EventData evData = SerializeWindTurbineToEventData(windTurbineMeasure);
// add the event to the batch
if (eventBatch.TryAdd(evData) == false)
break;
}
Console.Write(".");
// send the batch of events to the event hub
await producerClient.SendAsync(eventBatch);
}
catch (Exception ex)
{
Debug.WriteLine("Error generating turbine data. Exception: {0}", ex);
Console.Write("E");
}
await Task.Delay(1000, cancellationToken);
}
}
private static WindTurbineMeasure GenerateTurbineMeasure(string turbineId, int scaleFactor)
{
return new WindTurbineMeasure
{
DeviceId = turbineId,
MeasureTime = DateTime.UtcNow,
GeneratedPower = 2.5F * scaleFactor, // in MegaWatts/hour
WindSpeed = 15 * scaleFactor, // miles per hour
TurbineSpeed = 0.3F * scaleFactor // RPMs
};
}
private static EventData SerializeWindTurbineToEventData(WindTurbineMeasure wtm)
{
var messageString = JsonConvert.SerializeObject(wtm);
var bytes = Encoding.ASCII.GetBytes(messageString);
return new EventData(bytes);
}
}
}

Просмотреть файл

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WindTurbineDataGenerator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WindTurbineDataGenerator")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0c87a54a-ad21-46d5-8b75-4247da32237e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -1,133 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0C87A54A-AD21-46D5-8B75-4247DA32237E}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>WindTurbineDataGenerator</RootNamespace>
<AssemblyName>WindTurbineDataGenerator</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Azure.Core, Version=1.0.1.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<HintPath>..\packages\Azure.Core.1.0.1\lib\netstandard2.0\Azure.Core.dll</HintPath>
</Reference>
<Reference Include="Azure.Messaging.EventHubs, Version=5.0.1.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<HintPath>..\packages\Azure.Messaging.EventHubs.5.0.1\lib\netstandard2.0\Azure.Messaging.EventHubs.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Amqp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Azure.Amqp.2.4.2\lib\net45\Microsoft.Azure.Amqp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.EventHubs, Version=1.0.2.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Azure.EventHubs.1.0.2\lib\net451\Microsoft.Azure.EventHubs.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.6.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.WebSockets, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.WebSockets.4.0.0\lib\net46\System.Net.WebSockets.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.WebSockets.Client, Version=4.0.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.WebSockets.Client.4.0.2\lib\net46\System.Net.WebSockets.Client.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Reflection.TypeExtensions, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.TypeExtensions.4.5.1\lib\net461\System.Reflection.TypeExtensions.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Runtime.Serialization.Primitives, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.2.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.0.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.0.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.1.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Threading.Channels, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Channels.4.6.0\lib\netstandard2.0\System.Threading.Channels.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WindTurbineMeasure.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Просмотреть файл

@ -1,17 +0,0 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace WindTurbineDataGenerator
{
using System;
// TODO, move this class to a Contracts assembly that is shared across different projects
class WindTurbineMeasure
{
public string DeviceId { get; set; }
public DateTime MeasureTime { get; set; }
public float GeneratedPower { get; set; }
public float WindSpeed { get; set; }
public float TurbineSpeed { get; set; }
}
}

Просмотреть файл

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Azure.Core" version="1.0.1" targetFramework="net461" />
<package id="Azure.Messaging.EventHubs" version="5.0.1" targetFramework="net461" />
<package id="Microsoft.Azure.Amqp" version="2.4.2" targetFramework="net461" />
<package id="Microsoft.Azure.EventHubs" version="1.0.2" targetFramework="net461" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.0.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
<package id="System.Buffers" version="4.5.0" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.6.0" targetFramework="net461" />
<package id="System.Memory" version="4.5.3" targetFramework="net461" />
<package id="System.Net.WebSockets" version="4.0.0" targetFramework="net461" />
<package id="System.Net.WebSockets.Client" version="4.0.2" targetFramework="net461" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
<package id="System.Reflection.TypeExtensions" version="4.5.1" targetFramework="net461" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Algorithms" version="4.2.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Encoding" version="4.0.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Primitives" version="4.0.0" targetFramework="net461" />
<package id="System.Security.Cryptography.X509Certificates" version="4.1.0" targetFramework="net461" />
<package id="System.Threading.Channels" version="4.6.0" targetFramework="net461" />
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net461" />
</packages>

Просмотреть файл

@ -1,8 +0,0 @@
CREATE TABLE [dbo].[Fact_WindTurbineMetrics] (
[DeviceId] nvarchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[MeasureTime] datetime NULL,
[GeneratedPower] float NULL,
[WindSpeed] float NULL,
[TurbineSpeed] float NULL
)
WITH (CLUSTERED COLUMNSTORE INDEX, DISTRIBUTION = ROUND_ROBIN);