Skip to content

Commit

Permalink
Add advanced export options
Browse files Browse the repository at this point in the history
Adds `--direct-query-mode`, `--direct-lake-mode` and `--column-batch-size`
  • Loading branch information
albertospelta committed Aug 5, 2024
1 parent 69a2f79 commit 4fcf6ae
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/Dax.Vpax.CLI/Commands/ExportCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ internal static Command GetCommand()
PathArgument,
ConnectionStringArgument,
OverwriteOption,
// advanced options
ExcludeTomOption,
ExcludeVpaOption
ExcludeVpaOption,
DirectQueryModeOption,
DirectLakeModeOption,
ColumnBatchSizeOption,
};
command.Handler = s_handler;
return command;
Expand Down
13 changes: 9 additions & 4 deletions src/Dax.Vpax.CLI/Commands/ExportCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.CommandLine.Invocation;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.CommandLine.IO;
using Dax.Metadata;
using Dax.Model.Extractor;
Expand All @@ -23,6 +24,9 @@ public async Task<int> InvokeAsync(InvocationContext context)
var overwrite = context.ParseResult.GetValueForOption(OverwriteOption);
var excludeTom = context.ParseResult.GetValueForOption(ExcludeTomOption);
var excludeVpa = context.ParseResult.GetValueForOption(ExcludeVpaOption);
var directQueryMode = context.ParseResult.GetValueForOption(DirectQueryModeOption);
var directLakeMode = context.ParseResult.GetValueForOption(DirectLakeModeOption);
var columnBatchSize = context.ParseResult.GetValueForOption(ColumnBatchSizeOption);

using var vpaxStream = new MemoryStream();

Expand All @@ -34,9 +38,10 @@ public async Task<int> InvokeAsync(InvocationContext context)
applicationName: extractorAppName,
applicationVersion: extractorAppVersion,
readStatisticsFromData: true,
sampleRows: 0, // RI violation sampling is not applicable to VPAX files
analyzeDirectQuery: true,
analyzeDirectLake: DirectLakeExtractionMode.Full
sampleRows: 0, // not applicable for VPAX export
analyzeDirectQuery: directQueryMode != DirectQueryExtractionMode.None,
analyzeDirectLake: directLakeMode,
statsColumnBatchSize: columnBatchSize
);

var vpaModel = excludeVpa ? null : new ViewVpaExport.Model(daxModel);
Expand Down
27 changes: 26 additions & 1 deletion src/Dax.Vpax.CLI/Commands/ExportCommandOptions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.CommandLine;
using Dax.Metadata;
using Dax.Model.Extractor;
using System.CommandLine;
using System.Data.Common;

namespace Dax.Vpax.CLI.Commands;
Expand Down Expand Up @@ -43,4 +45,27 @@ internal static class ExportCommandOptions
getDefaultValue: () => false,
description: "Exclude the VPA model (DaxVpaView.json) from the export"
);

public static readonly Option<DirectQueryExtractionMode> DirectQueryModeOption = new(
name: "--direct-query-mode",
getDefaultValue: () => DirectQueryExtractionMode.Full,
description: "Direct Query extraction mode"
);

public static readonly Option<DirectLakeExtractionMode> DirectLakeModeOption = new(
name: "--direct-lake-mode",
getDefaultValue: () => DirectLakeExtractionMode.Full,
description: "Direct Lake extraction mode"
);

public static readonly Option<int> ColumnBatchSizeOption = new(
name: "--column-batch-size",
getDefaultValue: () => StatExtractor.DefaultColumnBatchSize,
description: "Number of rows processed at a time during column statistics analysis"
);

//static ExportCommandOptions()
//{
// //ExtractorDirectLakeMode.FromAmong();
//}
}

0 comments on commit 4fcf6ae

Please sign in to comment.