Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

massconvert for hdbtabletype #104

Closed
karthicktsb opened this issue Mar 9, 2023 · 9 comments
Closed

massconvert for hdbtabletype #104

karthicktsb opened this issue Mar 9, 2023 · 9 comments

Comments

@karthicktsb
Copy link

Hi Jung,

Do you plan to support massConvert from hdbdd (Type) to hdbtable or hdbtabletype.

For example:

context GLOBAL {

type AUDIT {
	CREATED: UTCTimestamp;
	CREATEDBY: Integer64;
	CHANGED: UTCTimestamp;
	CHANGEDBY: Integer64;
};

entity TTO{
	key PO_TYPE: String(32);
	PRIO: Integer;
};

};

During massconvert, "entity" is converted but not the "type". I have around 100 such types needs to be converted to hdbtable or hdbtabletype.

Do you able to take this enhancement request?

Regards,
Karthick

@jung-thomas
Copy link
Contributor

I'm afraid that wouldn't be in the scope of this tool. We read the SQL/runtime definition of the object (regardless of origin/design time type) and then convert that to a new target. But what you are describing would require input of the existing hdbdd and processing it directly.

@karthicktsb
Copy link
Author

I can understand, sorry i showed you the hdbdd file. These are also part of runtimes as row tables in the sys.tables view.
can able to see those tables during inspectTable command.

hana-cli inspectTable -s INTERNAL -t HFP_PMT.TABLE::GLOBAL.AUDIT -o cds -a
Using Connection Configuration loaded via default-env-admin.json

@cds.persistence.exists
Entity HFP_PMT_TABLE::GLOBAL_AUDIT {
CREATED: Timestamp @title: 'CREATED' ;
CREATEDBY: Integer64 @title: 'CREATEDBY' ;
CHANGED: Timestamp @title: 'CHANGED' ;
CHANGEDBY: Integer64 @title: 'CHANGEDBY' ;
}

hana-cli inspectTable -s INTERNAL -t HFP_PMT.TABLE::GLOBAL.AUDIT -o hdbtable -a
Using Connection Configuration loaded via default-env-admin.json

CDS compilation failed
.cds:1:22-23: Error: Extraneous ‘:’, expecting ‹Identifier›
.cds:1:23-35: Error: No artifact has been found with name “GLOBAL_AUDIT” (in entity:“HFP_PMT_TABLE”)

There is also some issue during conversion to hdbtable in inspect. But I am mainly looking this feature in massConvert.

No worries if that's not part of scope, just want to check whether it is feasible.

@jung-thomas
Copy link
Contributor

Looks like the issue here is just the :: in the original object name which isn’t valid in CAP CDS. You can use the noColons option to replace those with a period instead

Replace :: in table/view path with
dot [boolean] [default: false]

@karthicktsb
Copy link
Author

Thanks but still it is returning the same error and program hasn't terminate.

hana-cli inspectTable -s HFP_INTERNAL -t HFP_PMT.TABLE::GLOBAL.AUDIT -o hdbtable -a --noColons
Using Connection Configuration loaded via default-env-admin.json

CDS compilation failed
.cds:1:22-23: Error: Extraneous ‘:’, expecting ‹Identifier›
.cds:1:23-35: Error: No artifact has been found with name “GLOBAL_AUDIT” (in entity:“HFP_PMT_TABLE”)

And my main request is do you able to support this massConvert also ?

@jung-thomas
Copy link
Contributor

You need to add “true” after noColons

@karthicktsb
Copy link
Author

Sorry to trouble you again, I am unable to see any effect of using --noColons true in the command.
output CDS generates cds file with ::.

hana-cli inspectTable -s HFP_INTERNAL -t HFP_PMT.TABLE::GLOBAL.AUDIT --noColons true -a -o hdbtable --hana
Using Connection Configuration loaded via default-env-admin.json

CDS compilation failed
.cds:1:22-23: Error: Extraneous ‘:’, expecting ‹Identifier›
.cds:1:23-35: Error: No artifact has been found with name “GLOBAL_AUDIT” (in entity:“HFP_PMT_TABLE”)
^C
C:\Users\I312836>hana-cli inspectTable -s HFP_INTERNAL -t HFP_PMT.TABLE::GLOBAL.AUDIT --noColons true -a -o cds --hana
Using Connection Configuration loaded via default-env-admin.json

@cds.persistence.exists
Entity HFP_PMT_TABLE::GLOBAL_AUDIT {
CREATED: Timestamp @title: 'CREATED' ;
CREATEDBY: Integer64 @title: 'CREATEDBY' ;
CHANGED: Timestamp @title: 'CHANGED' ;
CHANGEDBY: Integer64 @title: 'CHANGEDBY' ;
}

@jung-thomas
Copy link
Contributor

You said you wanted to do the massConvert. The noColons option is in the massConvert command. https://github.com/SAP-samples/hana-developer-cli-tool-example#massconvert

@karthicktsb
Copy link
Author

yes i wanted to use massConvert but tabletypes are not picked up in massConvert. Those are ROW tables and those are listing in hana-cli tables command.

@jung-thomas
Copy link
Contributor

Just published a new version with two things that should help. I added the noColons option to inspectTable:
image

And the massConvert command will now find user defined types (Table Types):
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants