From f973e77150b8936899096c717a0ee31eb74a30a8 Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Thu, 8 Aug 2024 15:58:34 +0300 Subject: [PATCH 1/2] Update DbSource.cs --- .../Desktop/DbLayer/DbSource.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sources/Framework/org.ohdsi.cdm.framework/Desktop/DbLayer/DbSource.cs b/sources/Framework/org.ohdsi.cdm.framework/Desktop/DbLayer/DbSource.cs index 8de8b170..30cc64a2 100644 --- a/sources/Framework/org.ohdsi.cdm.framework/Desktop/DbLayer/DbSource.cs +++ b/sources/Framework/org.ohdsi.cdm.framework/Desktop/DbLayer/DbSource.cs @@ -30,7 +30,7 @@ private void CreateChunkSchema(string name) } } - private string GetQuery(string name) + private string GetQuery(string name, string schema) { string[] resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames(); var resource = resourceNames.First(a => a.EndsWith(name) && a.Contains(_dbType, StringComparison.OrdinalIgnoreCase)); @@ -39,7 +39,7 @@ private string GetQuery(string name) using var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource); using var reader = new StreamReader(stream, Encoding.Default); var query = reader.ReadToEnd(); - query = query.Replace("{sc}", schemaName); + query = query.Replace("{sc}", schema); return query; } @@ -49,7 +49,10 @@ public void CreateChunkTable(string schemaName) CreateChunkSchema(schemaName); DropChunkTable(schemaName); - var query = GetQuery("CreateChunkTable.sql"); + var query = GetQuery("CreateChunkTable.sql", schemaName); + + Console.WriteLine("CreateChunkTable:" + query); + using var connection = SqlConnectionHelper.OpenOdbcConnection(_connectionString); using var cmd = new OdbcCommand(query, connection); cmd.ExecuteNonQuery(); @@ -59,8 +62,9 @@ public void DropChunkTable(string schemaName) { CreateChunkSchema(schemaName); - var query = GetQuery("DropChunkTable.sql"); + var query = GetQuery("DropChunkTable.sql", schemaName); + Console.WriteLine("DropChunkTable:" + query); using var connection = SqlConnectionHelper.OpenOdbcConnection(_connectionString); using var cmd = new OdbcCommand(query, connection); cmd.ExecuteNonQuery(); @@ -80,7 +84,7 @@ public IEnumerable GetPersonIds(int chunkId, string schemaName) public void CreateIndexesChunkTable(string schemaName) { - var query = GetQuery("CreateIndexesChunkTable.sql"); + var query = GetQuery("CreateIndexesChunkTable.sql", schemaName); if (string.IsNullOrEmpty(query.Trim())) return; From 6a6c4b929459a907484a03939f80f72bacb61994 Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Thu, 8 Aug 2024 16:15:57 +0300 Subject: [PATCH 2/2] Update Program.cs --- .../Presentation/org.ohdsi.cdm.presentation.etl2/Program.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/Presentation/org.ohdsi.cdm.presentation.etl2/Program.cs b/sources/Presentation/org.ohdsi.cdm.presentation.etl2/Program.cs index 0129b206..8160bc75 100644 --- a/sources/Presentation/org.ohdsi.cdm.presentation.etl2/Program.cs +++ b/sources/Presentation/org.ohdsi.cdm.presentation.etl2/Program.cs @@ -233,6 +233,9 @@ static int Main(string[] arguments) var sourceReleaseDate = dbSource.GetSourceReleaseDate(); var vocabularyVersion = DbBuildingSettings.GetVocabularyVersion(vocabularyConnectionString, vocabularySchema); + Console.WriteLine("SourceReleaseDate:" + sourceReleaseDate); + Console.WriteLine("VocabularyVersion:" + vocabularyVersion); + if (Settings.Current.Building.Cdm == CdmVersions.V54) { var reader = new CdmSourceDataReader54(DateTime.Parse(sourceReleaseDate), vocabularyVersion);