SAP HANA HDBTable定义table语法
table文件以.hdbtable结尾
语法:
Scehme Name
table.schemaName = "MYSCHEMA";
Temporary
table.temporary = true;
Table Type
table.tableType = [COLUMNSTORE | ROWSTORE];
Table Logging Type
table.tableLoggingType = [LOGGING | NOLOGGING];
Table Column Definition
- SqlDataType
enum SqlDataType { DATE; TIME; TIMESTAMP; SECONDDATE; INTEGER; TINYINT; SMALLINT; BIGINT; REAL; DOUBLE; FLOAT; SMALLDECIMAL; DECIMAL; VARCHAR; NVARCHAR; CLOB; NCLOB; ALPHANUM; TEXT; SHORTTEXT; BLOB; VARBINARY; };
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;}];
- SqlDataType
Table Logging Type
table.tableLoggingType = [LOGGING | NOLOGGING];
Primary Key Definition
table.primaryKey.pkcolumns = ["Col1", "Col2"];
Table Index Definition
- Table Index Type
indexType = [B_TREE | CPB_TREE];
- Table Index Order
order = [ASC | DSC];
table.indexes = [ {name = "MYINDEX1"; unique = true; order = DSC; indexColumns = ["Col2"];}, {name = "MYINDEX2"; unique = true; order = DSC; indexColumns = ["Col1", "Col4"];}];
- Table Index Type
Complete Table-Definition Configuration Schema
enum TableType { COLUMNSTORE; ROWSTORE; }; enum TableLoggingType { LOGGING; NOLOGGING; }; enum IndexType { B_TREE; CPB_TREE; }; enum Order { ASC; DSC; }; enum SqlDataType { DATE; TIME; TIMESTAMP; SECONDDATE; INTEGER; TINYINT; SMALLINT; BIGINT; REAL; DOUBLE; FLOAT; SMALLDECIMAL; DECIMAL; VARCHAR; NVARCHAR; CLOB; NCLOB; ALPHANUM; TEXT; SHORTTEXT; BLOB; VARBINARY; }; struct PrimaryKeyDefinition { list<string> pkcolumns; optional IndexType indexType; }; struct IndexDefinition { string name; bool unique; optional Order order; optional IndexType indexType; list<string> indexColumns; }; struct ColumnDefinition { string name; SqlDataType sqlType; optional bool nullable; optional bool unique; optional int32 length; optional int32 scale; optional int32 precision; optional string defaultValue; optional string comment; }; struct TableDefinition { string schemaName; optional bool temporary; optional TableType tableType; optional bool public; optional TableLoggingType loggingType; list<ColumnDefinition> columns; optional list<IndexDefinition> indexes; optional PrimaryKeyDefinition primaryKey; optional string description; }; TableDefinition table;
示例:
table.schemaName = "SCHEMA_ODATA001"; 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 = 12; scale = 3;}]; table.indexes = [ {name = "MYINDEX1"; unique = true; order = DSC; indexColumns = ["Col2"];}, {name = "MYINDEX2"; unique = true; order = DSC; indexColumns = ["Col1", "Col4"];}]; table.primaryKey.pkcolumns = ["Col1", "Col2"];
post SAP-Garson
原文链接:https://blog.csdn.net/qq_30797051/article/details/122686173文章来自于网络,如果侵犯了您的权益,请联系站长删除!