Files
jdescopingtool/NEW/src/JdeScoping.DataSync.Dev/LotDevEtl.cs
T
Joseph Doherty 6054412a77 refactor: move JSON ETL classes to DataSync.Dev
Move dev-only JSON reading infrastructure from DataSync to DataSync.Dev:
- JsonColumnSchema (Models/)
- JsonZstdFileSource (Sources/)
- JsonStreamingDataReader (Sources/)
- Utf8JsonStreamingDataReader (Sources/)

Update namespaces and using statements in all DevEtl files.
2026-01-06 10:25:45 -05:00

46 lines
1.8 KiB
C#

using JdeScoping.DataAccess.Interfaces;
using JdeScoping.DataSync.Etl.Destinations;
using JdeScoping.DataSync.Dev.Models;
using JdeScoping.DataSync.Etl.Pipeline;
using JdeScoping.DataSync.Dev.Sources;
namespace JdeScoping.DataSync.Dev;
/// <summary>
/// Development ETL pipeline for the Lot table.
/// Schema from: Scripts/013_CreateLotTable.sql
/// </summary>
public static class LotDevEtl
{
public static readonly string TableName = "Lot";
public static readonly string CacheFileName = "lot.json.zstd";
private static readonly JsonColumnSchema[] Schema =
[
new("LotNumber", typeof(string), IsNullable: false),
new("BranchCode", typeof(string), IsNullable: false),
new("ShortItemNumber", typeof(long), IsNullable: false),
new("ItemNumber", typeof(string), IsNullable: true),
new("SupplierCode", typeof(long), IsNullable: false),
new("StatusCode", typeof(string), IsNullable: true),
new("Memo1", typeof(string), IsNullable: true),
new("Memo2", typeof(string), IsNullable: true),
new("Memo3", 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();
}
}