1400 v1
This commit is contained in:
parent
6bc5fd3262
commit
9304105c69
245
- Copy.gitignore
Normal file
245
- Copy.gitignore
Normal file
@ -0,0 +1,245 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
[Xx]64/
|
||||
[Xx]86/
|
||||
[Bb]uild/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
artifacts/
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
|
||||
# TODO: Un-comment the next line if you do not want to checkin
|
||||
# your web deploy settings because they may include unencrypted
|
||||
# passwords
|
||||
#*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignoreable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Microsoft Azure ApplicationInsights config file
|
||||
ApplicationInsights.config
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# LightSwitch generated files
|
||||
GeneratedArtifacts/
|
||||
ModelManifest.xml
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -184,6 +184,7 @@ ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.jfm
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
|
@ -22,7 +22,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Development' ">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DeploymentServerName>localhost</DeploymentServerName>
|
||||
<DeploymentServerName>localhost:63192</DeploymentServerName>
|
||||
<DeploymentServerEdition>Developer</DeploymentServerEdition>
|
||||
<DeploymentServerVersion>Version_11_0</DeploymentServerVersion>
|
||||
<DeploymentServerDatabase>AdventureWorks</DeploymentServerDatabase>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<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>
|
||||
<Name>AsPartitionProcessing.ConfigurationLogging</Name>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>4.1</ProjectVersion>
|
||||
<ProjectGuid>{d99fde4b-3174-440b-b867-a09c294086d0}</ProjectGuid>
|
||||
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql130DatabaseSchemaProvider</DSP>
|
||||
<OutputType>Database</OutputType>
|
||||
<RootPath>
|
||||
</RootPath>
|
||||
<RootNamespace>AsPartitionProcessing.ConfigurationLogging</RootNamespace>
|
||||
<AssemblyName>AsPartitionProcessing.ConfigurationLogging</AssemblyName>
|
||||
<ModelCollation>1033,CI</ModelCollation>
|
||||
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
||||
<DeployToDatabase>True</DeployToDatabase>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<TargetLanguage>CS</TargetLanguage>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<SqlServerVerification>False</SqlServerVerification>
|
||||
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
||||
<TargetDatabaseSet>True</TargetDatabaseSet>
|
||||
<DefaultCollation>SQL_Latin1_General_CP1_CI_AS</DefaultCollation>
|
||||
<DefaultFilegroup>PRIMARY</DefaultFilegroup>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
|
||||
<!-- Default to the v11.0 targets path if the targets file for the current VS version is not found -->
|
||||
<SSDTExists Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets')">True</SSDTExists>
|
||||
<VisualStudioVersion Condition="'$(SSDTExists)' == ''">11.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Condition="'$(SQLDBExtensionsRefPath)' != ''" Project="$(SQLDBExtensionsRefPath)\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<Import Condition="'$(SQLDBExtensionsRefPath)' == ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties" />
|
||||
<Folder Include="dbo\" />
|
||||
<Folder Include="dbo\Tables\" />
|
||||
<Folder Include="dbo\Views\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Build Include="dbo\Tables\ModelConfiguration.sql" />
|
||||
<Build Include="dbo\Tables\PartitioningConfiguration.sql" />
|
||||
<Build Include="dbo\Tables\ProcessingLog.sql" />
|
||||
<Build Include="dbo\Tables\TableConfiguration.sql" />
|
||||
<Build Include="dbo\Views\vPartitioningConfiguration.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PostDeploy Include="Script.PostDeployment1.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SampleConfiguration.sql">
|
||||
<CopyToOutputDirectory>DoNotCopy</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -0,0 +1,49 @@
|
||||
INSERT INTO [dbo].[ModelConfiguration]
|
||||
VALUES(
|
||||
1 --[ModelConfigurationID]
|
||||
,'localhost' --[AnalysisServicesServer]
|
||||
,'AdventureWorks' --[AnalysisServicesDatabase]
|
||||
,1 --[InitialSetUp]
|
||||
,1 --[IncrementalOnline]
|
||||
,1 --[IntegratedAuth]
|
||||
,-1 --[MaxParallelism]
|
||||
,-1 --[CommitTimeout]
|
||||
);
|
||||
|
||||
INSERT INTO [dbo].[TableConfiguration]
|
||||
VALUES(
|
||||
1 --[TableConfigurationID]
|
||||
,1 --[ModelConfigurationID]
|
||||
,'Internet Sales' --[AnalysisServicesTable]
|
||||
,0 --[DoNotProcess]
|
||||
),
|
||||
(
|
||||
2 --[TableConfigurationID]
|
||||
,1 --[ModelConfigurationID]
|
||||
,'Reseller Sales' --[AnalysisServicesTable]
|
||||
,0 --[DoNotProcess]
|
||||
);
|
||||
|
||||
INSERT INTO [dbo].[PartitioningConfiguration]
|
||||
VALUES(
|
||||
1 --[PartitioningConfigurationID]
|
||||
,1 --[TableConfigurationID]
|
||||
,1 --[Granularity] 1=Monthly
|
||||
,12 --[NumberOfPartitionsFull]
|
||||
,3 --[NumberOfPartitionsForIncrementalProcess]
|
||||
,0 --[MaxDateIsNow]
|
||||
,'2012-12-01' --[MaxDate]
|
||||
,1 --[IntegerDateKey]
|
||||
,'SELECT * FROM [dbo].[FactInternetSales] WHERE OrderDateKey >= {0} AND OrderDateKey < {1} ORDER BY OrderDateKey' --[TemplateSourceQuery]
|
||||
),
|
||||
(
|
||||
2 --[PartitioningConfigurationID]
|
||||
,2 --[TableConfigurationID]
|
||||
,2 --[Granularity] 2=Yearly
|
||||
,3 --[NumberOfPartitionsFull]
|
||||
,1 --[NumberOfPartitionsForIncrementalProcess]
|
||||
,0 --[MaxDateIsNow]
|
||||
,'2012-12-01' --[MaxDate]
|
||||
,1 --[IntegerDateKey]
|
||||
,'SELECT * FROM [dbo].[FactResellerSales] WHERE OrderDateKey >= {0} AND OrderDateKey < {1} ORDER BY OrderDateKey' --[TemplateSourceQuery]
|
||||
);
|
@ -0,0 +1,13 @@
|
||||
/*
|
||||
Post-Deployment Script Template
|
||||
--------------------------------------------------------------------------------------
|
||||
This file contains SQL statements that will be appended to the build script.
|
||||
Use SQLCMD syntax to include a file in the post-deployment script.
|
||||
Example: :r .\myfile.sql
|
||||
Use SQLCMD syntax to reference a variable in the post-deployment script.
|
||||
Example: :setvar TableName MyTable
|
||||
SELECT * FROM [$(TableName)]
|
||||
--------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
:r .\SampleConfiguration.sql
|
@ -0,0 +1,12 @@
|
||||
CREATE TABLE [dbo].[ModelConfiguration] (
|
||||
[ModelConfigurationID] INT NOT NULL,
|
||||
[AnalysisServicesServer] VARCHAR (255) NOT NULL,
|
||||
[AnalysisServicesDatabase] VARCHAR (255) NOT NULL,
|
||||
[InitialSetUp] BIT NOT NULL,
|
||||
[IncrementalOnline] BIT NOT NULL,
|
||||
[IntegratedAuth] BIT NOT NULL,
|
||||
[MaxParallelism] INT NOT NULL,
|
||||
[CommitTimeout] INT NOT NULL,
|
||||
CONSTRAINT [PK_ModelConfiguration] PRIMARY KEY CLUSTERED ([ModelConfigurationID] ASC)
|
||||
);
|
||||
|
@ -0,0 +1,16 @@
|
||||
CREATE TABLE [dbo].[PartitioningConfiguration] (
|
||||
[PartitioningConfigurationID] INT NOT NULL,
|
||||
[TableConfigurationID] INT NOT NULL,
|
||||
[Granularity] TINYINT NOT NULL,
|
||||
[NumberOfPartitionsFull] INT NOT NULL,
|
||||
[NumberOfPartitionsForIncrementalProcess] INT NOT NULL,
|
||||
[MaxDateIsNow] BIT NOT NULL,
|
||||
[MaxDate] DATE NULL,
|
||||
[IntegerDateKey] BIT NOT NULL,
|
||||
[TemplateSourceQuery] VARCHAR (MAX) NOT NULL,
|
||||
CONSTRAINT [PK_PartitioningConfiguration] PRIMARY KEY CLUSTERED ([PartitioningConfigurationID] ASC),
|
||||
CONSTRAINT [CK_PartitioningConfiguration_Granularity] CHECK ([Granularity]=(2) OR [Granularity]=(1) OR [Granularity]=(0)),
|
||||
CONSTRAINT [CK_PartitioningConfiguration_NumberOfPartitionsForIncrementalProcess] CHECK ([NumberOfPartitionsForIncrementalProcess]<=[NumberOfPartitionsFull]),
|
||||
CONSTRAINT [FK_PartitioningConfiguration_TableConfiguration] FOREIGN KEY ([TableConfigurationID]) REFERENCES [dbo].[TableConfiguration] ([TableConfigurationID])
|
||||
);
|
||||
|
@ -0,0 +1,10 @@
|
||||
CREATE TABLE [dbo].[ProcessingLog] (
|
||||
[PartitioningLogID] INT IDENTITY (1, 1) NOT NULL,
|
||||
[ModelConfigurationID] INT NOT NULL,
|
||||
[ExecutionID] CHAR (36) NOT NULL,
|
||||
[LogDateTime] DATETIME NOT NULL,
|
||||
[Message] VARCHAR (8000) NOT NULL,
|
||||
CONSTRAINT [PK_ProcessingLog] PRIMARY KEY CLUSTERED ([PartitioningLogID] ASC),
|
||||
CONSTRAINT [FK_ProcessingLog_ModelConfiguration] FOREIGN KEY ([ModelConfigurationID]) REFERENCES [dbo].[ModelConfiguration] ([ModelConfigurationID])
|
||||
);
|
||||
|
@ -0,0 +1,9 @@
|
||||
CREATE TABLE [dbo].[TableConfiguration] (
|
||||
[TableConfigurationID] INT NOT NULL,
|
||||
[ModelConfigurationID] INT NOT NULL,
|
||||
[AnalysisServicesTable] VARCHAR (255) NOT NULL,
|
||||
[DoNotProcess] BIT CONSTRAINT [DF_TableConfiguration_DoNotProcess] DEFAULT ((0)) NOT NULL,
|
||||
CONSTRAINT [PK_TableConfiguration] PRIMARY KEY CLUSTERED ([TableConfigurationID] ASC),
|
||||
CONSTRAINT [FK_TableConfiguration_ModelConfiguration] FOREIGN KEY ([ModelConfigurationID]) REFERENCES [dbo].[ModelConfiguration] ([ModelConfigurationID])
|
||||
);
|
||||
|
@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
|
||||
CREATE VIEW [dbo].[vPartitioningConfiguration]
|
||||
AS
|
||||
SELECT m.[ModelConfigurationID]
|
||||
,m.[AnalysisServicesServer]
|
||||
,m.[AnalysisServicesDatabase]
|
||||
,m.[InitialSetUp]
|
||||
,m.[IncrementalOnline]
|
||||
,m.[IntegratedAuth]
|
||||
,m.[MaxParallelism]
|
||||
,m.[CommitTimeout]
|
||||
,t.[TableConfigurationID]
|
||||
,t.[AnalysisServicesTable]
|
||||
,t.[DoNotProcess]
|
||||
,CASE
|
||||
WHEN p.[TableConfigurationID] IS NULL THEN 0
|
||||
ELSE 1
|
||||
END [Partitioned]
|
||||
,p.[PartitioningConfigurationID]
|
||||
,p.[Granularity]
|
||||
,p.[NumberOfPartitionsFull]
|
||||
,p.[NumberOfPartitionsForIncrementalProcess]
|
||||
,p.[MaxDateIsNow]
|
||||
,p.[MaxDate]
|
||||
,p.[IntegerDateKey]
|
||||
,p.[TemplateSourceQuery]
|
||||
FROM [dbo].[ModelConfiguration] m
|
||||
INNER JOIN [dbo].[TableConfiguration] t ON m.[ModelConfigurationID] = t.[ModelConfigurationID]
|
||||
LEFT JOIN [dbo].[PartitioningConfiguration] p ON t.[TableConfigurationID] = p.[TableConfigurationID]
|
@ -11,13 +11,13 @@
|
||||
<userSettings>
|
||||
<AsPartitionProcessing.SampleClient.Settings>
|
||||
<setting name="ConfigServer" serializeAs="String">
|
||||
<value>localhost</value>
|
||||
<value>nyctaxi.database.windows.net</value>
|
||||
</setting>
|
||||
<setting name="ConfigDatabase" serializeAs="String">
|
||||
<value>AsPartitionProcessing</value>
|
||||
<value>NYCTaxiPartitioning1400</value>
|
||||
</setting>
|
||||
<setting name="ConfigDatabaseIntegratedAuth" serializeAs="String">
|
||||
<value>True</value>
|
||||
<value>false</value>
|
||||
</setting>
|
||||
</AsPartitionProcessing.SampleClient.Settings>
|
||||
</userSettings>
|
||||
|
@ -38,7 +38,7 @@ namespace AsPartitionProcessing.SampleClient
|
||||
class Program
|
||||
{
|
||||
//Set sample execution mode here:
|
||||
private static ExecutionMode _executionMode = ExecutionMode.InitializeFromDatabase;
|
||||
private static ExecutionMode _executionMode = ExecutionMode.InitializeInline;
|
||||
private static string _modelConfigurationIDs;
|
||||
|
||||
static int Main(string[] args)
|
||||
@ -155,9 +155,16 @@ namespace AsPartitionProcessing.SampleClient
|
||||
maxDateIsNow: false,
|
||||
maxDate: Convert.ToDateTime("2012-12-01"),
|
||||
integerDateKey: true,
|
||||
templateSourceQuery: "SELECT * FROM [dbo].[FactInternetSales] " +
|
||||
"WHERE OrderDateKey >= {0} AND OrderDateKey < {1} " +
|
||||
"ORDER BY OrderDateKey"
|
||||
templateSourceQuery:
|
||||
"let\n" +
|
||||
" Source = #\"AdventureWorks\",\n" +
|
||||
" dbo_FactInternetSales = Source{[Schema=\"dbo\",Item=\"FactInternetSales\"]}[Data],\n" +
|
||||
" #\"Filtered Rows\" = Table.SelectRows(" +
|
||||
"dbo_FactInternetSales, each [OrderDateKey] >= {0} and [OrderDateKey] < {1}),\n" +
|
||||
" #\"Sorted Rows\" = Table.Sort(" +
|
||||
"#\"Filtered Rows\",{{\"OrderDateKey\", Order.Ascending}})\n" +
|
||||
"in\n" +
|
||||
" #\"Sorted Rows\"\n"
|
||||
)
|
||||
}
|
||||
),
|
||||
@ -174,28 +181,23 @@ namespace AsPartitionProcessing.SampleClient
|
||||
numberOfPartitionsForIncrementalProcess: 1,
|
||||
maxDateIsNow: false,
|
||||
maxDate: Convert.ToDateTime("2012-12-01"),
|
||||
integerDateKey: true,
|
||||
templateSourceQuery: "SELECT * FROM [dbo].[FactResellerSales] " +
|
||||
"WHERE OrderDateKey >= {0} AND OrderDateKey < {1} " +
|
||||
"ORDER BY OrderDateKey"
|
||||
integerDateKey: false,
|
||||
templateSourceQuery:
|
||||
"let\n" +
|
||||
" Source = #\"AdventureWorks\",\n" +
|
||||
" dbo_FactResellerSales = Source{[Schema=\"dbo\",Item=\"FactResellerSales\"]}[Data],\n" +
|
||||
" #\"Filtered Rows\" = Table.SelectRows(" +
|
||||
"dbo_FactResellerSales, each [OrderDate] >= {0} and [OrderDate] < {1}),\n" +
|
||||
" #\"Sorted Rows\" = Table.Sort(" +
|
||||
"#\"Filtered Rows\",{{\"OrderDate\", Order.Ascending}})\n" +
|
||||
"in\n" +
|
||||
" #\"Sorted Rows\"\n"
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
|
||||
#region Not needed as sample includes pre-prepared version of AdventureWorks
|
||||
|
||||
////This section not to be used normally - just to get started with AdventureWorks. It removes existing partitions that come in AdventureWorks and creates a template one to align with assumptions listed at top of PartitionProcessor.cs file.
|
||||
//if (partitionedModel.InitialSetUp)
|
||||
//{
|
||||
// Console.WriteLine("Initialize AdventureWorks template partitions? [y/n]");
|
||||
// if (Console.ReadLine().ToLower() == "y")
|
||||
// InitializeAdventureWorksDatabase(partitionedModel);
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
return partitionedModel;
|
||||
}
|
||||
|
||||
@ -353,61 +355,6 @@ namespace AsPartitionProcessing.SampleClient
|
||||
return password;
|
||||
}
|
||||
|
||||
#region Not needed as sample includes pre-prepared version of AdventureWorks
|
||||
|
||||
private static void InitializeAdventureWorksDatabase(ModelConfiguration parameters)
|
||||
{
|
||||
//In order to align with assumptions listed in PartitionProcessor.cs, need to:
|
||||
//1. Delete existing partitions in InternetSales and ResellerSales
|
||||
//2. Create template partition (again, see comments at top of PartitionProcessor.cs)
|
||||
|
||||
Console.WriteLine("Initializing AdventureWorks ...");
|
||||
|
||||
using (Server server = new Server())
|
||||
{
|
||||
//Connect and get main objects
|
||||
string serverConnectionString;
|
||||
if (parameters.IntegratedAuth)
|
||||
serverConnectionString = $"Provider=MSOLAP;Data Source={parameters.AnalysisServicesServer};";
|
||||
else
|
||||
{
|
||||
serverConnectionString = $"Provider=MSOLAP;Data Source={parameters.AnalysisServicesServer};User ID={parameters.UserName};Password={parameters.Password};Persist Security Info=True;Impersonation Level=Impersonate;";
|
||||
}
|
||||
server.Connect(serverConnectionString);
|
||||
|
||||
Database database = server.Databases.FindByName(parameters.AnalysisServicesDatabase);
|
||||
if (database == null)
|
||||
{
|
||||
throw new Microsoft.AnalysisServices.ConnectionException($"Could not connect to database {parameters.AnalysisServicesDatabase}.");
|
||||
}
|
||||
|
||||
InitializeAdventureWorksTable(database, "Internet Sales", "[dbo].[FactInternetSales]");
|
||||
InitializeAdventureWorksTable(database, "Reseller Sales", "[dbo].[FactResellerSales]");
|
||||
|
||||
database.Update(Microsoft.AnalysisServices.UpdateOptions.ExpandFull);
|
||||
server.Disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private static void InitializeAdventureWorksTable(Database database, string analysisServicesTableName, string sourceFactTableName)
|
||||
{
|
||||
Table table = database.Model.Tables.Find(analysisServicesTableName);
|
||||
if (table == null)
|
||||
{
|
||||
throw new Microsoft.AnalysisServices.ConnectionException($"Could not connect to table {analysisServicesTableName}.");
|
||||
}
|
||||
table.Partitions.Clear();
|
||||
Partition templatePartition = new Partition();
|
||||
templatePartition.Name = analysisServicesTableName;
|
||||
table.Partitions.Add(templatePartition);
|
||||
templatePartition.Source = new QueryPartitionSource()
|
||||
{
|
||||
DataSource = database.Model.DataSources[0], //Assuming this is only data source (SqlServer localhost)
|
||||
Query = $"SELECT * FROM {sourceFactTableName}"
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26403.3
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsPartitionProcessing", "AsPartitionProcessing\AsPartitionProcessing.csproj", "{FB937281-B06D-47FB-9846-E97B0287AFCE}"
|
||||
EndProject
|
||||
@ -10,12 +10,12 @@ EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0B23151E-8A6B-44AA-B670-797D1EB8B3C0}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
AdventureWorksDW.bak = AdventureWorksDW.bak
|
||||
CreateDatabaseObjects.sql = CreateDatabaseObjects.sql
|
||||
SampleConfiguration.sql = SampleConfiguration.sql
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{6870E480-7721-4708-BFB8-9AE898AA21B3}") = "AsPartitionProcessing.AdventureWorks", "AsPartitionProcessing.AdventureWorks\AsPartitionProcessing.AdventureWorks.smproj", "{7274EFCC-E7DF-40AD-83DF-1DFD5B954E67}"
|
||||
EndProject
|
||||
Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "AsPartitionProcessing.ConfigurationLogging", "AsPartitionProcessing.ConfigurationLogging\AsPartitionProcessing.ConfigurationLogging.sqlproj", "{D99FDE4B-3174-440B-B867-A09C294086D0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -66,6 +66,24 @@ Global
|
||||
{7274EFCC-E7DF-40AD-83DF-1DFD5B954E67}.Release|x86.ActiveCfg = Development|x86
|
||||
{7274EFCC-E7DF-40AD-83DF-1DFD5B954E67}.Release|x86.Build.0 = Development|x86
|
||||
{7274EFCC-E7DF-40AD-83DF-1DFD5B954E67}.Release|x86.Deploy.0 = Development|x86
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Debug|x86.Deploy.0 = Debug|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Development|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Development|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Development|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Development|x86.ActiveCfg = Debug|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Development|x86.Build.0 = Debug|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Development|x86.Deploy.0 = Debug|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Release|x86.Build.0 = Release|Any CPU
|
||||
{D99FDE4B-3174-440B-B867-A09C294086D0}.Release|x86.Deploy.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -164,7 +164,20 @@ namespace AsPartitionProcessing
|
||||
//Ensure template partition doesn't contain any data
|
||||
if (_modelConfiguration.InitialSetUp)
|
||||
{
|
||||
((QueryPartitionSource)templatePartition.Source).Query = String.Format(tableConfiguration.PartitioningConfigurations[0].TemplateSourceQuery, GetDateKey("19010102", Granularity.Daily, tableConfiguration.PartitioningConfigurations[0].IntegerDateKey, false), GetDateKey("19010101", Granularity.Daily, tableConfiguration.PartitioningConfigurations[0].IntegerDateKey, false)); //Query generated will always return nothing
|
||||
string beginParam = GetDateKey("19010102", Granularity.Daily, tableConfiguration.PartitioningConfigurations[0].IntegerDateKey, false, templatePartition.Source is MPartitionSource);
|
||||
string endParam = GetDateKey("19010101", Granularity.Daily, tableConfiguration.PartitioningConfigurations[0].IntegerDateKey, false, templatePartition.Source is MPartitionSource);
|
||||
//Query generated will always return nothing
|
||||
string query = tableConfiguration.PartitioningConfigurations[0].TemplateSourceQuery.Replace("{0}", beginParam).Replace("{1}", endParam);
|
||||
|
||||
switch (templatePartition.Source)
|
||||
{
|
||||
case MPartitionSource mSource:
|
||||
mSource.Expression = query;
|
||||
break;
|
||||
case QueryPartitionSource querySource:
|
||||
querySource.Query = query;
|
||||
break;
|
||||
}
|
||||
templatePartition.RequestRefresh(RefreshType.DataOnly);
|
||||
}
|
||||
}
|
||||
@ -579,19 +592,29 @@ namespace AsPartitionProcessing
|
||||
|
||||
private static Partition CreateNewPartition(Table table, Partition templatePartition, PartitioningConfiguration partitioningConfiguration, string partitionKey, Granularity granularity)
|
||||
{
|
||||
string beginParam = GetDateKey(partitionKey, granularity, partitioningConfiguration.IntegerDateKey, false);
|
||||
string endParam = GetDateKey(partitionKey, granularity, partitioningConfiguration.IntegerDateKey, true);
|
||||
string beginParam = GetDateKey(partitionKey, granularity, partitioningConfiguration.IntegerDateKey, false, templatePartition.Source is MPartitionSource);
|
||||
string endParam = GetDateKey(partitionKey, granularity, partitioningConfiguration.IntegerDateKey, true, templatePartition.Source is MPartitionSource);
|
||||
|
||||
Partition newPartition;
|
||||
newPartition = new Partition();
|
||||
templatePartition.CopyTo(newPartition);
|
||||
newPartition.Name = partitionKey;
|
||||
((QueryPartitionSource)newPartition.Source).Query = String.Format(partitioningConfiguration.TemplateSourceQuery, beginParam, endParam);
|
||||
//string query = String.Format(partitioningConfiguration.TemplateSourceQuery, beginParam, endParam);
|
||||
string query = partitioningConfiguration.TemplateSourceQuery.Replace("{0}", beginParam).Replace("{1}", endParam);
|
||||
switch (newPartition.Source)
|
||||
{
|
||||
case MPartitionSource mSource:
|
||||
mSource.Expression = query;
|
||||
break;
|
||||
case QueryPartitionSource querySource:
|
||||
querySource.Query = query;
|
||||
break;
|
||||
}
|
||||
table.Partitions.Add(newPartition);
|
||||
return newPartition;
|
||||
}
|
||||
|
||||
private static string GetDateKey(string partitionKey, Granularity granularity, bool integerDateKey, bool addPeriod)
|
||||
private static string GetDateKey(string partitionKey, Granularity granularity, bool integerDateKey, bool addPeriod, bool mExpression)
|
||||
{
|
||||
DateTime dateVal = new DateTime();
|
||||
|
||||
@ -627,10 +650,17 @@ namespace AsPartitionProcessing
|
||||
return dateVal.ToString("yyyyMMdd");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mExpression)
|
||||
{
|
||||
return $"#datetime({dateVal.ToString("yyyy, MM, dd")}, 0, 0, 0)";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"'{dateVal.ToString("yyyy-MM-dd")}'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IncludePartition(Granularity granularity, string filter, Partition partition, ref int partitionKey)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user