Skip to content

hdbtable

Ayhan Rashidov edited this page Aug 23, 2022 · 4 revisions

Tables (.hdbtable)

This object type represents a database table.

Reference

The information on how to develop and transform a design-time table resource into a table database object for a Kronos application.

SAP Help

https://help.sap.com/docs/SAP_HANA_PLATFORM/cc2b23beaa3344aebffa2f6e717df049/89cbf999e6004be3a5324b8f9ef0c53f.html https://help.sap.com/docs/SAP_HANA_PLATFORM/3823b0f33420468ba5f1cf7f59bd6bd9/453d48e28f6747799546236b4b432e58.html

Sample Hana XS Classic Syntax

table.schemaName = "MYSCHEMA";
table.tableType = COLUMNSTORE;
table.columns = [
	{name = "Col1"; sqlType = VARCHAR; nullable = false; length = 20; comment = "dummy comment";},
	{name = "Col2"; sqlType = INTEGER; nullable = false;},
	{name = "Col3"; sqlType = NVARCHAR; nullable = true; length = 20; defaultValue = "Defaultvalue";},
	{name = "Col4"; sqlType = DECIMAL; nullable = false; precision = 2; scale = 3;}];
table.indexes =  [
	{name = "MYINDEX1"; unique = true; indexColumns = ["Col2"];},
	{name = "MYINDEX2"; unique = true; indexColumns = ["Col1", "Col4"];}];
table.primaryKey.pkcolumns = ["Col1", "Col2"];

Sample Hana XS Advanced Syntax

COLUMN TABLE "MYSCHEMA::MYTABLE" ( 
   "ID" INTEGER DEFAULT 555, "NAME" NVARCHAR(256),
   "ACTIVE" TINYINT,
   "COUNTRY" NVARCHAR(256),
   PRIMARY KEY ("ID") )

Parser Specific Details

The parser does not allow duplicate properties.

The order of the table's properties, as well as column's and index's properties is not taken into account when table definition is parsed. Exception will be thrown if a property is defined more than once in the *.hdbtable file. Also, additional exception will be thrown in case a mandatory field is missing.

Sample

https://github.com/codbex/codbex-kronos/tree/main/samples/hdb-hdbtable-simple

Modules

  • ANTLR Parser

https://github.com/codbex/codbex-kronos/tree/main/modules/parsers/parser-hdbtable/src/main

  • Data Structure Parser

https://github.com/codbex/codbex-kronos/tree/main/modules/engines/engine-hdb/src/main/java/com/codbex/kronos/hdb/ds/parser/hdbtable

  • Processor

https://github.com/codbex/codbex-kronos/tree/main/modules/engines/engine-hdb/src/main/java/com/codbex/kronos/hdb/ds/processors/table

Unit Tests

https://github.com/codbex/codbex-kronos/tree/main/modules/parsers/parser-hdbtable/src/test https://github.com/codbex/codbex-kronos/tree/main/modules/engines/engine-hdb/src/test/java/com/codbex/kronos/hdb/ds/parser/hdbtable https://github.com/codbex/codbex-kronos/tree/main/modules/engines/engine-hdb/src/test/java/com/codbex/kronos/hdb/ds/processors/table

Integration Tests

https://github.com/codbex/codbex-kronos/tree/main/integration-tests/engine-hdb/src/test/java/com/codbex/kronos/integration/tests/hdb/ds/itest/hdbtable

Clone this wiki locally