cancel
Showing results for 
Search instead for 
Did you mean: 

HDBTABLE definition with default values

Former Member
0 Kudos

Hi,

We are creating tables in HANA with hdbtable.

We need to add default values for the date fields as current date. However, the regular CURRENT_UTCDATE is not recognized as a system variable to be assigned. This works fine when we create a table manually  using the CREATE statement but not in HDBTABLE.

Is there some other variable I can use?

Regards,

Nehal.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182302
Active Contributor
0 Kudos

Hi Nehal,

did you try with hdbdd as well?

Regards,

Krishna Tangudu

Former Member
0 Kudos

Hi Krishna,

Thanks for responding.

Is there a difference? I thought the way we define in HDBDD and HDBTABLE are the same

Regards,

Nehal.

former_member182302
Active Contributor
0 Kudos

yeah both should behave same and most likely it may not work on hdbdd as well but you can give a try once to confirm it.

Regards,

Krishna Tangudu

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

HDBDD is the replacement for HDBTABLE.  Both are still supported, but new enhancements will really only come to HDBDD.  If you are starting something new, I would really recommend HDBDD. However what you describe - using a calculated column with a formula - isn't yet available for either artifact. It is planned to be added in the future with HDBDD.

Former Member
0 Kudos

is HDBDD the only change or does it require a new development model with changes to .hdbschema, .hdbti, etc.?

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

No hdbschema and other artifacts stay the same. There is slight syntax change in the hdbti to reference HDBDD object instead of HDBTABLE. You use CDSTABLE in the HDBTI like so:

            { 

               cdstable = "sap.hana.democontent.epmNext.data::EPM.MasterData.Addresses";

                file = "sap.hana.democontent.epmNext.data.loads:addresses.csv";

                header = false;

            } ];

Also in the HDBDD you can create views, so it also really replaces HDBVIEW as well. Long term, we will certainly move more functionality into the HDBDD as well.

Former Member
0 Kudos

Thanks Thomas,

HDB tables(HDBDD/HDBTABLE) do not seem to support the following:

  • Default values like you specified above
  • Partitioning syntax
  • Foreign keys (this i guess is possible, not sure how, read something in the dev guide on using River like associations - it will be great if you can confirm)

If we need these functionalities, what then is the recommendation on table creation (especially when we want to transport our table structures to production) ? We're considering the simpler way exporting our entire schema (tables created by the CREATE statement) and then importing them in each system.

Regards,

Nehal.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>Partitioning syntax

Correct. Not currently supported.  Planned for the future of HDBDD - a general roundout of the missing SQL Syntax.  In other words, its not there yet but we absolutely plan to add it in the future to HDBDD.

>Foreign keys (this i guess is possible, not sure how, read something in the dev guide on using River like associations - it will be great if you can confirm)

Yes you can create associations.  Those associations can be used within views that are defined within the same HDBDD.  No these associations do not generate database constraints. They also are not currently considered by either XSODATA or automatically in XSJS or SQLScript. You would have to code logic at these levels to enforce the associations as constraints. Today they are mostly for simplified view creation.  In the near future they will be exposed to XSJS via an SAP supplied library and will be reusable in XSODATA and will therefore be enforced in CUD operations.

The recommendation is still to use the repository and the built in lifecycle.  This would mean coding your logic at a higher level until we have the above mentioned functionality. Or you could generate constraints via SQL on first run of an application to avoid having to have manual SQL setup scripts and/or a more complicated lifecycle management approach.

Former Member
0 Kudos

Thanks Thomas, your response is very very useful.

Regards,

Nehal.

Former Member
0 Kudos

Hi ,

Default timestamp for hdbdd table is possible?

I tried to have current timestamp for a field with LocalUTCTimestamp but couldn't.

Regards

Srivatsan

Answers (0)