feat: extract DevEtl to JdeScoping.DataSync.Dev project
- Create JdeScoping.DataSync.Dev for sandbox testing ETL code - Create JdeScoping.DataSync.Dev.Tests for associated tests - Move 22 source files and 8 test files - Update namespaces from DevEtl to Dev - Add both projects to solution
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using JdeScoping.DataAccess.Interfaces;
|
||||
using JdeScoping.DataSync.Etl.Destinations;
|
||||
using JdeScoping.DataSync.Etl.Models;
|
||||
using JdeScoping.DataSync.Etl.Pipeline;
|
||||
using JdeScoping.DataSync.Etl.Sources;
|
||||
|
||||
namespace JdeScoping.DataSync.Dev;
|
||||
|
||||
/// <summary>
|
||||
/// Development ETL pipeline for the WorkOrder_Hist table.
|
||||
/// Schema from: Scripts/016_CreateWorkOrderHistTable.sql
|
||||
/// </summary>
|
||||
public static class WorkOrderHistDevEtl
|
||||
{
|
||||
public static readonly string TableName = "WorkOrder_Hist";
|
||||
public static readonly string CacheFileName = "workorder_hist.json.zstd";
|
||||
|
||||
private static readonly JsonColumnSchema[] Schema =
|
||||
[
|
||||
new("WorkOrderNumber", typeof(long), IsNullable: false),
|
||||
new("BranchCode", typeof(string), IsNullable: true),
|
||||
new("LotNumber", typeof(string), IsNullable: true),
|
||||
new("ItemNumber", typeof(string), IsNullable: true),
|
||||
new("ShortItemNumber", typeof(long), IsNullable: false),
|
||||
new("ParentWorkOrderNumber", typeof(string), IsNullable: true),
|
||||
new("OrderQuantity", typeof(decimal), IsNullable: false),
|
||||
new("HeldQuantity", typeof(decimal), IsNullable: false),
|
||||
new("ShippedQuantity", typeof(decimal), IsNullable: false),
|
||||
new("StatusCode", typeof(string), IsNullable: true),
|
||||
new("StatusCodeUpdateDT", typeof(DateTime), IsNullable: true),
|
||||
new("IssueDate", typeof(DateTime), IsNullable: false),
|
||||
new("StartDate", typeof(DateTime), IsNullable: false),
|
||||
new("RoutingType", typeof(string), IsNullable: true),
|
||||
new("LastUpdateDT", typeof(DateTime), IsNullable: false),
|
||||
];
|
||||
|
||||
public static EtlPipeline Create(IDbConnectionFactory connectionFactory, string cacheFilePath)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(connectionFactory);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(cacheFilePath))
|
||||
throw new ArgumentException("Cache file path is required.", nameof(cacheFilePath));
|
||||
|
||||
return new EtlPipelineBuilder()
|
||||
.WithName($"{TableName}_Dev")
|
||||
.WithSource(new JsonZstdFileSource(cacheFilePath, Schema))
|
||||
.WithDestination(new DbBulkImportDestination(connectionFactory, TableName))
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user