gravitino.api.expressions.indexes.indexes.Indexes¶
- class gravitino.api.expressions.indexes.indexes.Indexes¶
Bases:
object
Helper methods to create index to pass into Apache Gravitino.
- Attributes:
- EMPTY_INDEXES (List[Index]):
An empty array of indexes.
- DEFAULT_MYSQL_PRIMARY_KEY_NAME (str):
MySQL does not support setting the name of the primary key, so the default name is used.
- __init__()¶
Methods
__init__
()create_mysql_primary_key
(field_names)primary
(name, field_names)unique
(name, field_names)Attributes
DEFAULT_MYSQL_PRIMARY_KEY_NAME
EMPTY_INDEXES
- final class IndexImpl(index_type: IndexType, name: str | None, field_names: List[List[str]])¶
Bases:
Index
- class IndexType(value)¶
Bases:
str
,Enum
The enum IndexType defines the type of the index.
Currently, PRIMARY_KEY and UNIQUE_KEY are supported.
- PRIMARY_KEY = 'PRIMARY_KEY'¶
PRIMARY KEY index in a relational database is a field or a combination of fields that uniquely identifies each record in a table. It serves as a unique identifier for each row, ensuring that no two rows have the same key. The PRIMARY KEY is used to establish relationships between tables and enforce the entity integrity of a database. Additionally, it helps in indexing and organizing the data for efficient retrieval and maintenance.
- UNIQUE_KEY = 'UNIQUE_KEY'¶
UNIQUE KEY in a relational database is a field or a combination of fields that ensures each record in a table has a distinct value or combination of values. Unlike a primary key, a UNIQUE KEY allows for the presence of null values, but it still enforces the constraint that no two records can have the same unique key value(s). UNIQUE KEYs are used to maintain data integrity by preventing duplicate entries in specific columns, and they can be applied to columns that are not designated as the primary key. The uniqueness constraint imposed by UNIQUE KEY helps in avoiding redundancy and ensuring data accuracy in the database.
- field_names() List[List[str]] ¶
Returns the field name under the table contained in the index.
It is the column names, could be “a.b.c” for nested column, but normally it could only be “a”.
- Returns:
List[List[str]]: The field name under the table contained in the index.
- name() str | None ¶
Returns the name of the index.
- Returns:
Optional[str]: The name of the index.