Create Table

# Create table
tbl_name = "name"
 
# Field declaration (field name, whether this field is primary key, data type and other params)
fields = [
    HippoField("pk", True, HippoType.INT64),
    HippoField("vector", False, HippoType.FLOAT_VECTOR, type_params = {"dimension": 2}),
    HippoField("text", False, HippoType.STRING),
    HippoField("number", False, HippoType.INT64)
]
table = hc.create_table(name = tbl_name, database_name = "my_database", fields = fields, number_of_shards = 1, number_of_replicas = 1)

Result:

This method will return a Hippo object. If failed, “ValueError” exception will be raised.

Parameter description:

ParametersDescriptionRequired
name (str)Table to be createdYes
fields (list[HippoField])Field list, every field is a Hippo project containing field name and typeYes
database_name (str)Database where the table is createdNo, defaults to "default" database
number_of_shards (int)Number of shardsNo, defaults to 1
number_of_replicas (int)Number of replicasNo, defaults to 1
Table 56 Create Table (Python API)