Skip to content

Commit d04d13f

Browse files
authored
Enable writing PKs per extraction batch (#2329)
* enable pk ordering * add to mssql * add space * fix test
1 parent e0f3c2c commit d04d13f

File tree

6 files changed

+21
-8
lines changed

6 files changed

+21
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [9.2.2] - Unreleased
8+
- Add ability to force primary keys at each batch of data when extracting to a database
9+
710
## [9.2.1] - 2026-04-07
811
- Update Sql Merge component to force destination column types
912
- Update Sql merge to correctly match updates

Rdmp.Core.Tests/DataLoad/Engine/Integration/DataTableUploadDestinationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,6 @@ public void TwoBatch_MiscellaneousTest(DatabaseType dbType, string v1, string v2
13101310
var destination = new DataTableUploadDestination();
13111311
destination.PreInitialize(null,db, toConsole);
13121312
destination.AllowResizingColumnsAtUploadTime = true;
1313-
13141313
var dt1 = new DataTable();
13151314
dt1.Columns.Add("TestedCol", typeof(string));
13161315
dt1.Rows.Add(new[] { v1 });
@@ -1329,6 +1328,7 @@ public void TwoBatch_MiscellaneousTest(DatabaseType dbType, string v1, string v2
13291328
var tt = db.Server.GetQuerySyntaxHelper().TypeTranslater;
13301329
var tbl = db.ExpectTable("DataTableUploadDestinationTests");
13311330

1331+
13321332
try
13331333
{
13341334
destination.ProcessPipelineData(dt1, toConsole, token);

Rdmp.Core/DataExport/DataExtraction/Pipeline/Destinations/ExecuteFullExtractionToDatabaseMSSql.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ You must have either $a or $d
7373
[DemandsInitialization(DataTableUploadDestination.AlterTimeout_Description, DefaultValue = 300)]
7474
public int AlterTimeout { get; set; }
7575

76+
[DemandsInitialization("By applying the primary keys after writing the data, it ensures all data is extracted. Disabling this configuration may improve performance but will quickly raise issues with poorly keyed data.",DefaultValue =true)]
77+
public bool WriteDataBeforeApplyingPrimaryKeys { get; set; }
78+
7679
[DemandsInitialization(
7780
"True to copy the column collations from the source database when creating the destination database. Only works if both the source and destination have the same DatabaseType. Excludes columns which feature a transform as part of extraction.",
7881
DefaultValue = false)]
@@ -281,6 +284,7 @@ private DataTableUploadDestination PrepareDestination(IDataLoadEventListener lis
281284

282285
_destination.AllowResizingColumnsAtUploadTime = true;
283286
_destination.AlterTimeout = AlterTimeout;
287+
_destination.WriteDataBeforeApplyingPrimaryKeys = WriteDataBeforeApplyingPrimaryKeys;
284288
_destination.AppendDataIfTableExists = AppendDataIfTableExists;
285289
_destination.IncludeTimeStamp = IncludeTimeStamp;
286290
_destination.UseTrigger = AppendDataIfTableExists;

Rdmp.Core/DataLoad/Engine/Pipeline/Destinations/DataTableUploadDestination.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ public CultureInfo Culture
8484
set => _culture = value;
8585
}
8686

87+
[DemandsInitialization("By applying the primary keys after writing the data, it ensures all data is extracted. Disabling this configuration may improve performance but will quickly raise issues with poorly keyed data.")]
88+
public bool WriteDataBeforeApplyingPrimaryKeys { get; set; } = true;
89+
8790
public string TargetTableName { get; private set; }
8891

8992
/// <summary>
@@ -181,7 +184,10 @@ public DataTable ProcessPipelineData(DataTable toProcess, IDataLoadEventListener
181184
}
182185
}
183186

184-
ClearPrimaryKeyFromDataTableAndExplicitWriteTypes(toProcess);
187+
if (WriteDataBeforeApplyingPrimaryKeys)
188+
{
189+
ClearPrimaryKeyFromDataTableAndExplicitWriteTypes(toProcess);
190+
}
185191

186192
StartAuditIfExists(TargetTableName);
187193

SharedAssemblyInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
[assembly: AssemblyCompany("Health Informatics Centre, University of Dundee")]
88
[assembly: AssemblyProduct("Research Data Management Platform (RDMP)")]
9-
[assembly: AssemblyCopyright("Copyright (c) 2018 - 2025")]
9+
[assembly: AssemblyCopyright("Copyright (c) 2018 - 2026")]
1010
[assembly: AssemblyTrademark("")]
1111
[assembly: AssemblyCulture("")]
1212

13-
[assembly: AssemblyVersion("9.2.1")]
14-
[assembly: AssemblyFileVersion("9.2.1")]
15-
[assembly: AssemblyInformationalVersion("9.2.1")]
13+
[assembly: AssemblyVersion("9.2.2")]
14+
[assembly: AssemblyFileVersion("9.2.2")]
15+
[assembly: AssemblyInformationalVersion("9.2.2")]

rdmp-client.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<item>
3-
<version>9.2.0.0</version>
4-
<url>https://github.com/HicServices/RDMP/releases/download/v9.2.1/rdmp-9.2.1-client.zip</url>
3+
<version>9.2.2.0</version>
4+
<url>https://github.com/HicServices/RDMP/releases/download/v9.2.2/rdmp-9.2.2-client.zip</url>
55
<changelog>https://github.com/HicServices/RDMP/blob/main/CHANGELOG.md#7</changelog>
66
<mandatory>true</mandatory>
77
</item>

0 commit comments

Comments
 (0)