Skip to content

Commit 3394bdc

Browse files
committed
Refactor analysis tools documentation:
- Updated `dataProfile` command to reflect new category and status, added detailed descriptions on data profiling importance, use cases, and command diagram. - Enhanced `duplicateDetection` command with explanations on duplicate records, their impact, and added command diagram for better clarity. - Revised `erdDiagram` command to change category and status, included comprehensive descriptions of ER diagrams, their uses, and added command diagram. - Improved `fragmentationCheck` command documentation with detailed explanations on table fragmentation, its impacts, and added command diagram. - Expanded `referentialCheck` command to include definitions of referential integrity, its importance, and added command diagram for better understanding. - Updated `tableHotspots` command to clarify its purpose, added explanations on why identifying hotspots is crucial, and included command diagram.
1 parent 5aaf065 commit 3394bdc

24 files changed

+2092
-162
lines changed

bin/auditLog.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const command = 'auditLog'
55
export const aliases = ['audit', 'auditlog']
66
export const describe = baseLite.bundle.getText("auditLog")
77

8-
export const builder = (yargs) => yargs.options(baseLite.getBuilder({
8+
const auditLogOptions = {
99
limit: {
1010
alias: ['l'],
1111
type: 'number',
@@ -40,7 +40,11 @@ export const builder = (yargs) => yargs.options(baseLite.getBuilder({
4040
default: 7,
4141
desc: baseLite.bundle.getText("auditDays")
4242
}
43-
})).example('hana-cli auditLog --table AUDIT_TABLE --limit 1000', baseLite.bundle.getText("auditLogExample"))
43+
}
44+
45+
export const builder = (yargs) => yargs.options(baseLite.getBuilder(auditLogOptions)).example('hana-cli auditLog --table AUDIT_TABLE --limit 1000', baseLite.bundle.getText("auditLogExample"))
46+
47+
export const auditLogBuilderOptions = baseLite.getBuilder(auditLogOptions)
4448

4549
export let inputPrompts = {
4650
limit: {
@@ -62,7 +66,7 @@ export let inputPrompts = {
6266
*/
6367
export async function handler(argv) {
6468
const base = await import('../utils/base.js')
65-
base.promptHandler(argv, viewAuditLog, inputPrompts, true, true, builder)
69+
base.promptHandler(argv, viewAuditLog, inputPrompts, true, true, auditLogBuilderOptions)
6670
}
6771

6872
/**

bin/codeTemplate.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const command = 'codeTemplate'
66
export const aliases = ['template', 'codegen', 'scaffold', 'boilerplate']
77
export const describe = baseLite.bundle.getText("codeTemplate")
88

9-
export const builder = (yargs) => yargs.options(baseLite.getBuilder({
9+
const codeTemplateOptions = {
1010
pattern: {
1111
alias: ['p'],
1212
type: 'string',
@@ -53,7 +53,11 @@ export const builder = (yargs) => yargs.options(baseLite.getBuilder({
5353
type: 'string',
5454
desc: baseLite.bundle.getText("profile")
5555
}
56-
})).example('hana-cli codeTemplate --pattern crud --object myTable', baseLite.bundle.getText("codeTemplateExample"))
56+
}
57+
58+
export const builder = (yargs) => yargs.options(baseLite.getBuilder(codeTemplateOptions)).example('hana-cli codeTemplate --pattern crud --object myTable', baseLite.bundle.getText("codeTemplateExample"))
59+
60+
export const codeTemplateBuilderOptions = baseLite.getBuilder(codeTemplateOptions)
5761

5862
export const inputPrompts = {
5963
pattern: {
@@ -105,7 +109,7 @@ export const inputPrompts = {
105109
*/
106110
export async function handler(argv) {
107111
const base = await import('../utils/base.js')
108-
base.promptHandler(argv, codeTemplateMain, inputPrompts, true, true, builder)
112+
base.promptHandler(argv, codeTemplateMain, inputPrompts, true, true, codeTemplateBuilderOptions)
109113
}
110114

111115
/**

bin/dataMask.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const command = 'dataMask'
66
export const aliases = ['mask', 'dataprivacy', 'anonymize', 'pii']
77
export const describe = baseLite.bundle.getText("dataMask")
88

9-
export const builder = (yargs) => yargs.options(baseLite.getBuilder({
9+
const dataMaskOptions = {
1010
schema: {
1111
alias: ['s'],
1212
type: 'string',
@@ -60,7 +60,11 @@ export const builder = (yargs) => yargs.options(baseLite.getBuilder({
6060
type: 'string',
6161
desc: baseLite.bundle.getText("profile")
6262
}
63-
})).example('hana-cli dataMask --table CUSTOMERS --maskType hash --columns EMAIL', baseLite.bundle.getText('dataMaskExample'))
63+
}
64+
65+
export const builder = (yargs) => yargs.options(baseLite.getBuilder(dataMaskOptions)).example('hana-cli dataMask --table CUSTOMERS --maskType hash --columns EMAIL', baseLite.bundle.getText('dataMaskExample'))
66+
67+
export const dataMaskBuilderOptions = baseLite.getBuilder(dataMaskOptions)
6468

6569
export const inputPrompts = {
6670
schema: {
@@ -119,7 +123,7 @@ export const inputPrompts = {
119123
*/
120124
export async function handler(argv) {
121125
const base = await import('../utils/base.js')
122-
base.promptHandler(argv, dataMaskMain, inputPrompts, true, true, builder)
126+
base.promptHandler(argv, dataMaskMain, inputPrompts, true, true, dataMaskBuilderOptions)
123127
}
124128

125129
/**

bin/dependencies.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const command = 'dependencies'
66
export const aliases = ['deps', 'depend', 'dependency-graph', 'relationships']
77
export const describe = baseLite.bundle.getText("dependencies")
88

9-
export const builder = (yargs) => yargs.options(baseLite.getBuilder({
9+
const dependenciesOptions = {
1010
schema: {
1111
alias: ['s'],
1212
type: 'string',
@@ -59,11 +59,15 @@ export const builder = (yargs) => yargs.options(baseLite.getBuilder({
5959
type: 'string',
6060
desc: baseLite.bundle.getText("profile")
6161
}
62-
})).example(
62+
}
63+
64+
export const builder = (yargs) => yargs.options(baseLite.getBuilder(dependenciesOptions)).example(
6365
'hana-cli dependencies --object myTable --direction incoming --depth 3',
6466
baseLite.bundle.getText("dependenciesExample")
6567
)
6668

69+
export const dependenciesBuilderOptions = baseLite.getBuilder(dependenciesOptions)
70+
6771
export const inputPrompts = {
6872
schema: {
6973
description: baseLite.bundle.getText("dependenciesSchema"),
@@ -122,7 +126,7 @@ export const inputPrompts = {
122126
*/
123127
export async function handler(argv) {
124128
const base = await import('../utils/base.js')
125-
base.promptHandler(argv, dependenciesMain, inputPrompts, true, true, builder)
129+
base.promptHandler(argv, dependenciesMain, inputPrompts, true, true, dependenciesBuilderOptions)
126130
}
127131

128132
/**

bin/encryptionStatus.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const command = 'encryptionStatus'
55
export const aliases = ['encryption', 'encrypt']
66
export const describe = baseLite.bundle.getText("encryptionStatus")
77

8-
export const builder = (yargs) => yargs.options(baseLite.getBuilder({
8+
const encryptionStatusOptions = {
99
scope: {
1010
alias: ['s'],
1111
type: 'string',
@@ -19,7 +19,11 @@ export const builder = (yargs) => yargs.options(baseLite.getBuilder({
1919
default: false,
2020
desc: baseLite.bundle.getText("showDetails")
2121
}
22-
})).example('hana-cli encryptionStatus --table myTable', baseLite.bundle.getText("encryptionStatusExample"))
22+
}
23+
24+
export const builder = (yargs) => yargs.options(baseLite.getBuilder(encryptionStatusOptions)).example('hana-cli encryptionStatus --table myTable', baseLite.bundle.getText("encryptionStatusExample"))
25+
26+
export const encryptionStatusBuilderOptions = baseLite.getBuilder(encryptionStatusOptions)
2327

2428
export let inputPrompts = {
2529
scope: {
@@ -36,7 +40,7 @@ export let inputPrompts = {
3640
*/
3741
export async function handler(argv) {
3842
const base = await import('../utils/base.js')
39-
base.promptHandler(argv, checkEncryptionStatus, inputPrompts, true, true, builder)
43+
base.promptHandler(argv, checkEncryptionStatus, inputPrompts, true, true, encryptionStatusBuilderOptions)
4044
}
4145

4246
/**

bin/erdDiagram.js

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const command = 'erdDiagram'
66
export const aliases = ['erd', 'er', 'schema-diagram', 'entityrelation']
77
export const describe = baseLite.bundle.getText("erdDiagram")
88

9-
export const builder = (yargs) => yargs.options(baseLite.getBuilder({
9+
const erdDiagramOptions = {
1010
schema: {
1111
alias: ['s'],
1212
type: 'string',
@@ -52,7 +52,11 @@ export const builder = (yargs) => yargs.options(baseLite.getBuilder({
5252
type: 'string',
5353
desc: baseLite.bundle.getText("profile")
5454
}
55-
})).example('hana-cli erdDiagram --schema MYSCHEMA --format mermaid --output erd.md', baseLite.bundle.getText('erdDiagramExample'))
55+
}
56+
57+
export const builder = (yargs) => yargs.options(baseLite.getBuilder(erdDiagramOptions)).example('hana-cli erdDiagram --schema MYSCHEMA --format mermaid --output erd.md', baseLite.bundle.getText('erdDiagramExample'))
58+
59+
export const erdDiagramBuilderOptions = baseLite.getBuilder(erdDiagramOptions)
5660

5761
export const inputPrompts = {
5862
schema: {
@@ -79,6 +83,24 @@ export const inputPrompts = {
7983
required: false,
8084
ask: () => false
8185
},
86+
showCardinality: {
87+
description: baseLite.bundle.getText("erdDiagramShowCardinality"),
88+
type: 'boolean',
89+
required: false,
90+
ask: () => false
91+
},
92+
showColumns: {
93+
description: baseLite.bundle.getText("erdDiagramShowColumns"),
94+
type: 'boolean',
95+
required: false,
96+
ask: () => false
97+
},
98+
excludeColumns: {
99+
description: baseLite.bundle.getText("erdDiagramExcludeColumns"),
100+
type: 'string',
101+
required: false,
102+
ask: () => false
103+
},
82104
profile: {
83105
description: baseLite.bundle.getText("profile"),
84106
type: 'string',
@@ -94,7 +116,7 @@ export const inputPrompts = {
94116
*/
95117
export async function handler(argv) {
96118
const base = await import('../utils/base.js')
97-
base.promptHandler(argv, erdDiagramMain, inputPrompts, true, true, builder)
119+
base.promptHandler(argv, erdDiagramMain, inputPrompts, true, true, erdDiagramBuilderOptions)
98120
}
99121

100122
/**
@@ -117,7 +139,7 @@ export async function erdDiagramMain(prompts) {
117139

118140
// Get schema if not provided
119141
let schema = prompts.schema
120-
if (!schema && dbKind !== 'sqlite') {
142+
if ((!schema || schema === '**CURRENT_SCHEMA**') && dbKind !== 'sqlite') {
121143
schema = await getCurrentSchema(dbClient, dbKind)
122144
}
123145

bin/fragmentationCheck.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const builder = (yargs) => yargs.options(baseLite.getBuilder({
99
schema: {
1010
alias: ['s'],
1111
type: 'string',
12-
default: null,
12+
default: '**CURRENT_SCHEMA**',
1313
desc: baseLite.bundle.getText("schema")
1414
},
1515
table: {
@@ -79,7 +79,7 @@ export async function checkFragmentation(prompts) {
7979

8080
try {
8181
const limit = base.validateLimit(prompts.limit)
82-
const schema = prompts.schema || null
82+
const schema = await base.dbClass.schemaCalc(prompts, db)
8383
const table = prompts.table || null
8484
const threshold = prompts.threshold || 10
8585

@@ -145,7 +145,7 @@ export async function checkFragmentation(prompts) {
145145

146146
results.forEach(row => {
147147
const fragPercent = row['Fragmentation %']
148-
totalDeltaSize += row['Delta Size (MB)'] || 0
148+
totalDeltaSize += parseFloat(row['Delta Size (MB)']) || 0
149149

150150
if (fragPercent >= 50) {
151151
criticalCount++

bin/generateDocs.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const command = 'generateDocs'
66
export const aliases = ['docs', 'gendocs', 'generateDocumentation']
77
export const describe = baseLite.bundle.getText("generateDocs")
88

9-
export const builder = (yargs) => yargs.options(baseLite.getBuilder({
9+
const generateDocsOptions = {
1010
schema: {
1111
alias: ['s'],
1212
type: 'string',
@@ -66,7 +66,11 @@ export const builder = (yargs) => yargs.options(baseLite.getBuilder({
6666
type: 'string',
6767
desc: baseLite.bundle.getText("profile")
6868
}
69-
})).example('hana-cli generateDocs --schema MYSCHEMA --format markdown --output docs/', baseLite.bundle.getText('generateDocsExample'))
69+
}
70+
71+
export const builder = (yargs) => yargs.options(baseLite.getBuilder(generateDocsOptions)).example('hana-cli generateDocs --schema MYSCHEMA --format markdown --output docs/', baseLite.bundle.getText('generateDocsExample'))
72+
73+
export const generateDocsBuilderOptions = baseLite.getBuilder(generateDocsOptions)
7074

7175
export const inputPrompts = {
7276
schema: {
@@ -108,7 +112,7 @@ export const inputPrompts = {
108112
*/
109113
export async function handler(argv) {
110114
const base = await import('../utils/base.js')
111-
base.promptHandler(argv, generateDocsMain, inputPrompts, true, true, builder)
115+
base.promptHandler(argv, generateDocsMain, inputPrompts, true, true, generateDocsBuilderOptions)
112116
}
113117

114118
/**

bin/generateTestData.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const command = 'generateTestData'
66
export const aliases = ['testdata', 'gendata', 'generateData']
77
export const describe = baseLite.bundle.getText("generateTestData")
88

9-
export const builder = (yargs) => yargs.options(baseLite.getBuilder({
9+
const generateTestDataOptions = {
1010
table: {
1111
alias: ['t'],
1212
type: 'string',
@@ -69,11 +69,15 @@ export const builder = (yargs) => yargs.options(baseLite.getBuilder({
6969
type: 'string',
7070
desc: baseLite.bundle.getText("profile")
7171
}
72-
})).example(
72+
}
73+
74+
export const builder = (yargs) => yargs.options(baseLite.getBuilder(generateTestDataOptions)).example(
7375
'hana-cli generateTestData --table myTable --rows 100 --format sql',
7476
baseLite.bundle.getText("generateTestDataExample")
7577
)
7678

79+
export const generateTestDataBuilderOptions = baseLite.getBuilder(generateTestDataOptions)
80+
7781
export const inputPrompts = {
7882
table: {
7983
description: baseLite.bundle.getText("generateTestDataTable"),
@@ -125,7 +129,7 @@ export const inputPrompts = {
125129
*/
126130
export async function handler(argv) {
127131
const base = await import('../utils/base.js')
128-
base.promptHandler(argv, generateTestDataMain, inputPrompts, true, true, builder)
132+
base.promptHandler(argv, generateTestDataMain, inputPrompts, true, true, generateTestDataBuilderOptions)
129133
}
130134

131135
/**

bin/grantChains.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const command = 'grantChains'
55
export const aliases = ['grants', 'grantchain']
66
export const describe = baseLite.bundle.getText("grantChains")
77

8-
export const builder = (yargs) => yargs.options(baseLite.getBuilder({
8+
const grantChainsOptions = {
99
user: {
1010
alias: ['u'],
1111
type: 'string',
@@ -29,7 +29,11 @@ export const builder = (yargs) => yargs.options(baseLite.getBuilder({
2929
default: 'tree',
3030
desc: baseLite.bundle.getText("outputFormat")
3131
}
32-
})).example('hana-cli grantChains --user DBUSER', baseLite.bundle.getText("grantChainsExample"))
32+
}
33+
34+
export const builder = (yargs) => yargs.options(baseLite.getBuilder(grantChainsOptions)).example('hana-cli grantChains --user DBUSER', baseLite.bundle.getText("grantChainsExample"))
35+
36+
export const grantChainsBuilderOptions = baseLite.getBuilder(grantChainsOptions)
3337

3438
export let inputPrompts = {
3539
user: {
@@ -51,7 +55,7 @@ export let inputPrompts = {
5155
*/
5256
export async function handler(argv) {
5357
const base = await import('../utils/base.js')
54-
base.promptHandler(argv, visualizeGrantChains, inputPrompts, true, true, builder)
58+
base.promptHandler(argv, visualizeGrantChains, inputPrompts, true, true, grantChainsBuilderOptions)
5559
}
5660

5761
/**

0 commit comments

Comments
 (0)