# 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:
Parameters | Description | Required |
---|---|---|
name (str) | Table to be created | Yes |
fields (list[HippoField]) | Field list, every field is a Hippo project containing field name and type | Yes |
database_name (str) | Database where the table is created | No, defaults to "default" database |
number_of_shards (int) | Number of shards | No, defaults to 1 |
number_of_replicas (int) | Number of replicas | No, defaults to 1 |