ModelConfigurationIDs command-line parameter
This commit is contained in:
parent
54ab47536f
commit
d124cb9b8e
@ -18,6 +18,9 @@ namespace AsPartitionProcessing.SampleClient
|
|||||||
[Option('k', "MergePartitionKey", HelpText = "When ExecutionMode=MergePartitions, target partition key. If year, follow yyyy; if month follow yyyymm.")]
|
[Option('k', "MergePartitionKey", HelpText = "When ExecutionMode=MergePartitions, target partition key. If year, follow yyyy; if month follow yyyymm.")]
|
||||||
public string MergePartitionKey { get; set; }
|
public string MergePartitionKey { get; set; }
|
||||||
|
|
||||||
|
[Option('i', "ModelConfigurationIDs", HelpText = "When connect to config database, only process models with ModelConfigurationID in a comma-delimited list.")]
|
||||||
|
public string ModelConfigurationIDs { get; set; }
|
||||||
|
|
||||||
[ParserState]
|
[ParserState]
|
||||||
public IParserState LastParserState { get; set; }
|
public IParserState LastParserState { get; set; }
|
||||||
|
|
||||||
|
@ -38,7 +38,8 @@ namespace AsPartitionProcessing.SampleClient
|
|||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
//Set sample execution mode here:
|
//Set sample execution mode here:
|
||||||
private static ExecutionMode _executionMode = ExecutionMode.InitializeInline;
|
private static ExecutionMode _executionMode = ExecutionMode.InitializeFromDatabase;
|
||||||
|
private static string _modelConfigurationIDs;
|
||||||
|
|
||||||
static int Main(string[] args)
|
static int Main(string[] args)
|
||||||
{
|
{
|
||||||
@ -214,7 +215,7 @@ namespace AsPartitionProcessing.SampleClient
|
|||||||
connectionInfo.Password = ReadPassword();
|
connectionInfo.Password = ReadPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConfigDatabaseHelper.ReadConfig(connectionInfo);
|
return ConfigDatabaseHelper.ReadConfig(connectionInfo, _modelConfigurationIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ParseArgs(string[] args, ref string mergeTable, ref Granularity mergeTargetGranuarity, ref string mergePartitionKey, out bool help)
|
private static void ParseArgs(string[] args, ref string mergeTable, ref Granularity mergeTargetGranuarity, ref string mergePartitionKey, out bool help)
|
||||||
@ -225,6 +226,12 @@ namespace AsPartitionProcessing.SampleClient
|
|||||||
ArgumentOptions options = new ArgumentOptions();
|
ArgumentOptions options = new ArgumentOptions();
|
||||||
if (CommandLine.Parser.Default.ParseArguments(args, options))
|
if (CommandLine.Parser.Default.ParseArguments(args, options))
|
||||||
{
|
{
|
||||||
|
if (!String.IsNullOrEmpty(options.ModelConfigurationIDs))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"ModelConfigurationIDs: {options.ModelConfigurationIDs}");
|
||||||
|
_modelConfigurationIDs = options.ModelConfigurationIDs;
|
||||||
|
}
|
||||||
|
|
||||||
Console.WriteLine($"Argument ExecutionMode: {options.ExecutionMode}");
|
Console.WriteLine($"Argument ExecutionMode: {options.ExecutionMode}");
|
||||||
switch (options.ExecutionMode)
|
switch (options.ExecutionMode)
|
||||||
{
|
{
|
||||||
|
@ -14,17 +14,11 @@ namespace AsPartitionProcessing
|
|||||||
/// Read configuration information from the database.
|
/// Read configuration information from the database.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="connectionInfo">Information required to connect to the configuration and logging database.</param>
|
/// <param name="connectionInfo">Information required to connect to the configuration and logging database.</param>
|
||||||
|
/// <param name="modelConfigurationIDs">Comma delimited list of ModelConfigurationIDs to filter on when getting worklist from workspace database.</param>
|
||||||
/// <returns>Collection of partitioned models with configuration information.</returns>
|
/// <returns>Collection of partitioned models with configuration information.</returns>
|
||||||
public static List<ModelConfiguration> ReadConfig(ConfigDatabaseConnectionInfo connectionInfo)
|
public static List<ModelConfiguration> ReadConfig(ConfigDatabaseConnectionInfo connectionInfo, string modelConfigurationIDs)
|
||||||
{
|
{
|
||||||
using (SqlConnection connection = new SqlConnection(GetConnectionString(connectionInfo)))
|
string commandText = String.Format(@"
|
||||||
{
|
|
||||||
connection.Open();
|
|
||||||
using (SqlCommand command = new SqlCommand())
|
|
||||||
{
|
|
||||||
command.Connection = connection;
|
|
||||||
command.CommandType = CommandType.Text;
|
|
||||||
command.CommandText = @"
|
|
||||||
SELECT [ModelConfigurationID]
|
SELECT [ModelConfigurationID]
|
||||||
,[AnalysisServicesServer]
|
,[AnalysisServicesServer]
|
||||||
,[AnalysisServicesDatabase]
|
,[AnalysisServicesDatabase]
|
||||||
@ -43,13 +37,24 @@ namespace AsPartitionProcessing
|
|||||||
,[MaxDateIsNow]
|
,[MaxDateIsNow]
|
||||||
,[MaxDate]
|
,[MaxDate]
|
||||||
,[IntegerDateKey]
|
,[IntegerDateKey]
|
||||||
|
|
||||||
,[TemplateSourceQuery]
|
,[TemplateSourceQuery]
|
||||||
FROM [dbo].[vPartitioningConfiguration]
|
FROM [dbo].[vPartitioningConfiguration]
|
||||||
WHERE [DoNotProcess] = 0
|
WHERE [DoNotProcess] = 0 {0}
|
||||||
ORDER BY
|
ORDER BY
|
||||||
[ModelConfigurationID],
|
[ModelConfigurationID],
|
||||||
[TableConfigurationID],
|
[TableConfigurationID],
|
||||||
[PartitioningConfigurationID];";
|
[PartitioningConfigurationID];",
|
||||||
|
(String.IsNullOrEmpty(modelConfigurationIDs) ? "" : $" AND [ModelConfigurationID] IN ({modelConfigurationIDs}) "));
|
||||||
|
|
||||||
|
using (SqlConnection connection = new SqlConnection(GetConnectionString(connectionInfo)))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
using (SqlCommand command = new SqlCommand())
|
||||||
|
{
|
||||||
|
command.Connection = connection;
|
||||||
|
command.CommandType = CommandType.Text;
|
||||||
|
command.CommandText = commandText;
|
||||||
|
|
||||||
List<ModelConfiguration> modelConfigs = new List<ModelConfiguration>();
|
List<ModelConfiguration> modelConfigs = new List<ModelConfiguration>();
|
||||||
ModelConfiguration modelConfig = null;
|
ModelConfiguration modelConfig = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user