Skip to content

Commit a5f8c03

Browse files
HCK-15099: bump JDBC driver (#73)
* feat: bump driver version to the latest * feat: include "No Primary Index" tables in RE * fix: extra filtering by system creator while querying UDT's
1 parent e790b67 commit a5f8c03

7 files changed

Lines changed: 26 additions & 5 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
node_modules
77
.DS_Store
88
release
9+
TeradataClient/target

TeradataClient/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<dependency>
3939
<groupId>com.teradata.jdbc</groupId>
4040
<artifactId>terajdbc</artifactId>
41-
<version>17.20.00.12</version>
41+
<version>20.00.00.46</version>
4242
</dependency>
4343
<dependency>
4444
<groupId>org.json</groupId>

constants/constants.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ const ERROR_MESSAGE = {
22
aborted: 'Query execution was aborted',
33
};
44

5+
const TABLE_KIND = {
6+
regularTable: 'T',
7+
noPiTable: 'O',
8+
view: 'V',
9+
};
10+
511
module.exports = {
612
ERROR_MESSAGE,
13+
TABLE_KIND,
714
};
76.7 KB
Binary file not shown.

reverse_engineering/api.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const connectionHelper = require('./helpers/connectionHelper');
44
const indexHelper = require('./helpers/indexHelper');
55
const udtHelper = require('./helpers/udtHelper');
66
const { prepareError } = require('./helpers/prepareError');
7+
const { TABLE_KIND } = require('../constants/constants');
78

89
const connect = async (connectionInfo, sshService, logger) => {
910
return await connectionHelper.connect(connectionInfo, sshService, logger);
@@ -62,10 +63,10 @@ const getDbCollectionsNames = async (connectionInfo, logger, callback, app) => {
6263
const instance = connectionHelper.createInstance(connection, _);
6364

6465
log.info('Get table and database names');
65-
const tableNames = await instance.getDatabasesWithTableNames('T');
66+
const tableNames = await instance.getDatabasesWithTableNames([TABLE_KIND.regularTable, TABLE_KIND.noPiTable]);
6667

6768
log.info('Get views and database names');
68-
const viewNames = getViewNames(await instance.getDatabasesWithTableNames('V'));
69+
const viewNames = getViewNames(await instance.getDatabasesWithTableNames(TABLE_KIND.view));
6970

7071
const allDatabaseNames = [...Object.keys(tableNames), ...Object.keys(viewNames)];
7172

reverse_engineering/helpers/connectionHelper.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,10 @@ const getIndexType = index => {
506506

507507
const filterUdt = object => object.Kind === 'U';
508508

509-
const excludeSystemUdt = type => !SYSTEM_UDT.has(type['Table/View/Macro Dictionary Name']);
509+
const excludeSystemUdt = type => {
510+
const creator = type['Creator SQL Name'].trim();
511+
return !SYSTEM_UDT.has(type['Table/View/Macro Dictionary Name']) && creator !== 'DBC' && creator !== 'SYSUDTLIB';
512+
};
510513

511514
module.exports = {
512515
connect,

reverse_engineering/helpers/queryHelper.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
const cleanUpCommand = (command = '') => command.replaceAll(/\s+/g, ' ');
22

3+
const getTableKindClause = ({ tableType }) => {
4+
if (Array.isArray(tableType)) {
5+
const types = tableType.map(type => `'${type}'`).join(',');
6+
return `IN (${types})`;
7+
}
8+
9+
return `= '${tableType}'`;
10+
};
11+
312
const getDatabaseAndTableNames = ({ tableType, systemDatabases }) => {
413
const command = `SELECT DatabaseName, TableName
514
FROM DBC.TablesV
6-
WHERE TableKind = '${tableType}'
15+
WHERE TableKind ${getTableKindClause({ tableType })}
716
AND DatabaseName NOT IN (${systemDatabases.map(name => `'${name}'`).join(', ')})
817
ORDER BY DatabaseName, TableName;`;
918

0 commit comments

Comments
 (0)