From e4706cbd20bc20de7c6b30f941e7c2ac870337b0 Mon Sep 17 00:00:00 2001 From: Christian Wade Date: Mon, 17 Apr 2017 21:15:07 -0700 Subject: [PATCH] 1400 v2 --- ...sPartitionProcessing.AdventureWorks.smproj | 2 +- ...ionProcessing.ConfigurationLogging.sqlproj | 2 ++ .../SampleConfiguration.sql | 20 ++++++++++++++++--- .../usp_LastProcessingLogs.sql | 8 ++++++++ .../Program.cs | 12 ++++------- 5 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 AsPartitionProcessing/AsPartitionProcessing.ConfigurationLogging/dbo/Stored Procedures/usp_LastProcessingLogs.sql diff --git a/AsPartitionProcessing/AsPartitionProcessing.AdventureWorks/AsPartitionProcessing.AdventureWorks.smproj b/AsPartitionProcessing/AsPartitionProcessing.AdventureWorks/AsPartitionProcessing.AdventureWorks.smproj index e84e27d..d26bf54 100644 --- a/AsPartitionProcessing/AsPartitionProcessing.AdventureWorks/AsPartitionProcessing.AdventureWorks.smproj +++ b/AsPartitionProcessing/AsPartitionProcessing.AdventureWorks/AsPartitionProcessing.AdventureWorks.smproj @@ -22,7 +22,7 @@ bin\ - localhost:63192 + localhost Developer Version_11_0 AdventureWorks diff --git a/AsPartitionProcessing/AsPartitionProcessing.ConfigurationLogging/AsPartitionProcessing.ConfigurationLogging.sqlproj b/AsPartitionProcessing/AsPartitionProcessing.ConfigurationLogging/AsPartitionProcessing.ConfigurationLogging.sqlproj index 799f594..e4c2565 100644 --- a/AsPartitionProcessing/AsPartitionProcessing.ConfigurationLogging/AsPartitionProcessing.ConfigurationLogging.sqlproj +++ b/AsPartitionProcessing/AsPartitionProcessing.ConfigurationLogging/AsPartitionProcessing.ConfigurationLogging.sqlproj @@ -62,6 +62,7 @@ + @@ -69,6 +70,7 @@ + diff --git a/AsPartitionProcessing/AsPartitionProcessing.ConfigurationLogging/SampleConfiguration.sql b/AsPartitionProcessing/AsPartitionProcessing.ConfigurationLogging/SampleConfiguration.sql index b83a1c3..036f20c 100644 --- a/AsPartitionProcessing/AsPartitionProcessing.ConfigurationLogging/SampleConfiguration.sql +++ b/AsPartitionProcessing/AsPartitionProcessing.ConfigurationLogging/SampleConfiguration.sql @@ -34,7 +34,14 @@ VALUES( ,0 --[MaxDateIsNow] ,'2012-12-01' --[MaxDate] ,1 --[IntegerDateKey] - ,'SELECT * FROM [dbo].[FactInternetSales] WHERE OrderDateKey >= {0} AND OrderDateKey < {1} ORDER BY OrderDateKey' --[TemplateSourceQuery] + , +'let + Source = #"AdventureWorks", + dbo_FactInternetSales = Source{[Schema="dbo",Item="FactInternetSales"]}[Data], + #"Filtered Rows" = Table.SelectRows(dbo_FactInternetSales, each [OrderDateKey] >= {0} and [OrderDateKey] < {1}), + #"Sorted Rows" = Table.Sort(#"Filtered Rows",{{"OrderDateKey", Order.Ascending}}) +in + #"Sorted Rows"' --[TemplateSourceQuery] ), ( 2 --[PartitioningConfigurationID] @@ -44,6 +51,13 @@ VALUES( ,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 --[IntegerDateKey] + , +'let + Source = #"AdventureWorks", + dbo_FactResellerSales = Source{[Schema="dbo",Item="FactResellerSales"]}[Data], + #"Filtered Rows" = Table.SelectRows(dbo_FactResellerSales, each [OrderDate] >= {0} and [OrderDate] < {1}), + #"Sorted Rows" = Table.Sort(#"Filtered Rows",{{"OrderDate", Order.Ascending}}) +in + #"Sorted Rows"' --[TemplateSourceQuery] ); diff --git a/AsPartitionProcessing/AsPartitionProcessing.ConfigurationLogging/dbo/Stored Procedures/usp_LastProcessingLogs.sql b/AsPartitionProcessing/AsPartitionProcessing.ConfigurationLogging/dbo/Stored Procedures/usp_LastProcessingLogs.sql new file mode 100644 index 0000000..21163ae --- /dev/null +++ b/AsPartitionProcessing/AsPartitionProcessing.ConfigurationLogging/dbo/Stored Procedures/usp_LastProcessingLogs.sql @@ -0,0 +1,8 @@ +CREATE PROC [dbo].[usp_LastProcessingLogs] AS + SELECT [Message] + FROM [dbo].[ProcessingLog] + WHERE ExecutionID = + ( SELECT MAX([ExecutionID]) FROM [dbo].[ProcessingLog] + WHERE [LogDateTime] = (SELECT MAX([LogDateTime]) FROM [dbo].[ProcessingLog]) + ) + ORDER BY [LogDateTime] \ No newline at end of file diff --git a/AsPartitionProcessing/AsPartitionProcessing.SampleClient/Program.cs b/AsPartitionProcessing/AsPartitionProcessing.SampleClient/Program.cs index a065ec8..ecb880f 100644 --- a/AsPartitionProcessing/AsPartitionProcessing.SampleClient/Program.cs +++ b/AsPartitionProcessing/AsPartitionProcessing.SampleClient/Program.cs @@ -159,10 +159,8 @@ namespace AsPartitionProcessing.SampleClient "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" + + " #\"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" ) @@ -186,10 +184,8 @@ namespace AsPartitionProcessing.SampleClient "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" + + " #\"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" )