From 0bfd7237afc01dffeac2c8162038b965372e14dd Mon Sep 17 00:00:00 2001 From: Nazar Kovtun <88377450+WilhelmWesser@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:18:49 +0200 Subject: [PATCH] HCK-8808: removed memory-optimized tables data retrievment (#96) --- .../databaseService/databaseService.js | 25 ------------------- .../reverseEngineeringService.js | 22 +--------------- 2 files changed, 1 insertion(+), 46 deletions(-) diff --git a/reverse_engineering/databaseService/databaseService.js b/reverse_engineering/databaseService/databaseService.js index 89c3bd4..efa838f 100644 --- a/reverse_engineering/databaseService/databaseService.js +++ b/reverse_engineering/databaseService/databaseService.js @@ -300,30 +300,6 @@ const getTableColumnsDescription = async (connectionClient, dbName, tableName, s `); }; -const getDatabaseMemoryOptimizedTables = async (connectionClient, dbName, logger) => { - try { - const currentDbConnectionClient = await getNewConnectionClientByDb(connectionClient, dbName); - - logger.log('info', { message: `Get '${dbName}' database memory optimized indexes.` }, 'Reverse Engineering'); - - return mapResponse(currentDbConnectionClient.query` - SELECT - T.name, - T.durability, - T.durability_desc, - OBJECT_NAME(T.history_table_id) AS history_table, - SCHEMA_NAME(O.schema_id) AS history_schema, - T.temporal_type_desc - FROM sys.tables T LEFT JOIN sys.objects O ON T.history_table_id = O.object_id - WHERE T.is_memory_optimized=1 - `); - } catch (error) { - logger.log('error', { message: error.message, stack: error.stack, error }, 'Retrieve memory optimized tables'); - - return []; - } -}; - const getViewColumns = async (connectionClient, dbName, viewName, schemaName) => { const currentDbConnectionClient = await getNewConnectionClientByDb(connectionClient, dbName); const objectId = `${schemaName}.${viewName}`; @@ -480,7 +456,6 @@ module.exports = { getTableForeignKeys, getDatabaseIndexes, getTableColumnsDescription, - getDatabaseMemoryOptimizedTables, getViewTableInfo, getTableKeyConstraints, getTableMaskedColumns, diff --git a/reverse_engineering/reverseEngineeringService/reverseEngineeringService.js b/reverse_engineering/reverseEngineeringService/reverseEngineeringService.js index 32218ea..e34f153 100644 --- a/reverse_engineering/reverseEngineeringService/reverseEngineeringService.js +++ b/reverse_engineering/reverseEngineeringService/reverseEngineeringService.js @@ -5,7 +5,6 @@ const { getTableForeignKeys, getDatabaseIndexes, getTableColumnsDescription, - getDatabaseMemoryOptimizedTables, getViewTableInfo, getViewColumns, getTableKeyConstraints, @@ -312,21 +311,6 @@ const cleanDocuments = documents => { return documents.map(cleanNull); }; -const getMemoryOptimizedOptions = options => { - if (!options) { - return {}; - } - - return { - memory_optimized: true, - durability: ['SCHEMA_ONLY', 'SCHEMA_AND_DATA'].includes(String(options.durability_desc).toUpperCase()) - ? String(options.durability_desc).toUpperCase() - : '', - systemVersioning: options.temporal_type_desc === 'SYSTEM_VERSIONED_TEMPORAL_TABLE', - historyTable: options.history_table ? `${options.history_schema}.${options.history_table}` : '', - }; -}; - const getDistribution = distributionData => { if (!Array.isArray(distributionData) || !distributionData.length) { return ''; @@ -386,11 +370,8 @@ const getPersistence = tableName => { const reverseCollectionsToJSON = logger => async (dbConnectionClient, tablesInfo, reverseEngineeringOptions) => { const dbName = dbConnectionClient.config.database; progress(logger, `RE data from database "${dbName}"`, dbName); - const [databaseIndexes, databaseMemoryOptimizedTables, databaseUDT, dataBasePartitions] = await Promise.all([ + const [databaseIndexes, databaseUDT, dataBasePartitions] = await Promise.all([ getDatabaseIndexes(dbConnectionClient, dbName, logger).catch(logError(logger, 'Getting indexes')), - getDatabaseMemoryOptimizedTables(dbConnectionClient, dbName, logger).catch( - logError(logger, 'Getting memory optimized tables'), - ), getDatabaseUserDefinedTypes(dbConnectionClient, dbName, logger).catch( logError(logger, 'Getting user defined types'), ), @@ -498,7 +479,6 @@ const reverseCollectionsToJSON = logger => async (dbConnectionClient, tablesInfo dbName: schemaName, entityLevel: { Indxs: reverseTableIndexes(tableIndexes), - ...getMemoryOptimizedOptions(databaseMemoryOptimizedTables.find(item => item.name === tableName)), ...defineFieldsCompositeKeyConstraints(fieldsKeyConstraints), indexingOrderColumn: order.map(column => ({ name: column })), tableRole: getTableRole(distribution, indexing),