Files
jdescopingtool/NEW/src/JdeScoping.DataSync.Dev/WorkOrderComponentCurrDevEtl.cs
T
Joseph Doherty 81b07ce027 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
2026-01-06 10:18:09 -05:00

43 lines
1.7 KiB
C#

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 WorkOrderComponent_Curr table.
/// Schema from: Scripts/021_CreateWorkOrderComponentCurrTable.sql
/// </summary>
public static class WorkOrderComponentCurrDevEtl
{
public static readonly string TableName = "WorkOrderComponent_Curr";
public static readonly string CacheFileName = "workordercomponent_curr.json.zstd";
private static readonly JsonColumnSchema[] Schema =
[
new("UniqueID", typeof(long), IsNullable: false),
new("WorkOrderNumber", typeof(long), IsNullable: false),
new("LotNumber", typeof(string), IsNullable: false),
new("BranchCode", typeof(string), IsNullable: true),
new("ShortItemNumber", typeof(long), IsNullable: false),
new("Quantity", typeof(decimal), IsNullable: false),
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();
}
}