Table APIs
insert
Description: Inserts a dataset into a database table.
Syntax:
insert(data, overwrite=False)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| data | Yes | dataset.Dataset | Dataset object to be inserted. The value must be of the aura_frame.multimodal.dataset.Dataset type. |
| overwrite | No | bool | Whether to overwrite existing data. The default value is False. |
Return type: None.
show
Description: Displays the first N rows of a table.
Syntax:
show(limit=10)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| limit | No | int | Maximum number of output rows. The default value is 10. |
Return type: None.
to_dataset
Description: Converts the current table object into a dataset object.
Syntax:
to_dataset()
Input parameters: None.
Return type: Dataset.
add_columns
Description: Adds one or more columns to a table.
Syntax:
add_columns(new_cols)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| new_cols | Yes | Dict[str, str] | Dictionary of columns to be added. The key is the column name (str), and the value is the column type (str). |
Return type: None.
drop_columns
Description: Removes one or more columns from a table.
Syntax:
drop_columns(*columns)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| *columns | Yes | str | Names of the columns to remove. Accepts multiple string arguments. |
Return type: None.
alter_column_type
Description: Changes the data type of a specified column in a table.
Syntax:
alter_column_type(column_name, new_type)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| column_name | Yes | str | Name of the column whose type is to be changed. |
| new_type | Yes | str | New data type. |
Return type: None.
rename_column
Description: Renames a column in a table.
Syntax:
rename_column(column_name, new_name)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| column_name | Yes | str | Current column name. |
| new_name | Yes | str | New column name. |
Return type: None.
delete
Description: Deletes rows from a table that meet the specified condition.
Syntax:
delete(where)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| where | Yes | str | An SQL WHERE clause, used to specify deletion conditions. |
Return type: None.
update
Description: Updates rows in a table that satisfy the given conditions.
Syntax:
update(values_expr, where)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| values_expr | Yes | Dict[str, ValueExpression] | A dictionary where keys are column names (str) and values are expressions (ValueExpression) used to update the column. |
| where | No | Union[ir.BooleanValue, list[ir.BooleanValue], IfAnyAll, None] | Condition used to filter the rows to be updated. If None, all rows are updated. |
Return type: None.
create_table
Description: Creates a table in a specified database.
Syntax:
create_table(name, /, *, schema, table_format, database=None, temp=False, external=False, overwrite=False, if_not_exists=False, partition_by=None, table_properties=None, location=None)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| name | Yes | str | Name of the table to create. |
| schema | Yes | ibis.Schema | Definition of the table. |
| table_format | Yes | str | Storage format of the table. |
| database | No | Optional[str] | Name of the database where the table is to be created. If it is not specified, the default database is used. |
| temp | No | bool | If it is set to True, a temporary table is created. |
| external | No | bool | If it is set to True, an external table is created. |
| overwrite | No | bool | If it is set to True, the existing table is overwritten. |
| if_not_exists | No | bool | If it is set to True, the table is created only when it does not exist. |
| partition_by | No | Optional[ibis.Schema] | Schema used to partition the table. |
| table_properties | No | Optional[dict] | Other properties of the table. |
| location | No | Optional[str] | Location where the table data is stored. |
Return type: Dataset.
delete_table
Description: Removes a specified dataset from the database.
Syntax:
delete_table(name, /, *, database=None, if_it_exists=False)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| name | Yes | str | Name of the table to be deleted. |
| database | No | Optional[str] | Name of the database from which the table is to be deleted. If not specified, the default database is used. |
| if_it_exists | No | bool | If this parameter is set to True, the table is deleted only when it exists. This prevents errors caused by the table's absence. |
Return type: str.
describe_table
Description: Describes the tables in a specified database.
Syntax:
describe_table(name, /, *, database=None)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| name | Yes | str | The function name. |
| database | No | Optional[str] | Name of the database where the table is located. |
Return type: str. Table metadata.
drop_table
Description: Deletes a table from a specified database.
Syntax:
drop_table(name, *, database=None, force=False)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| name | Yes | str | Name of the table to be deleted. |
| database | No | Optional[str] | Name of the database from which the table is to be deleted. If not specified, the default database is used. |
| force | No | bool | If this parameter is set to True, the table is forcibly deleted even if it contains data. The default value is False. |
Return type: None.
list_tables
Description: Lists all tables in a specified or default database.
Syntax:
list_tables(database=None)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| database | No | Optional[str] | Name of the database whose tables are to be listed. If it is None, the default database is used. |
Return type: list[tuple], a list of tuples, where each tuple contains table names.
open_table
Description: Opens a table in a specified database.
Syntax:
open_table(name, *, database=None)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| name | Yes | str | Name of the table to be opened. |
| database | No | Optional[str] | Name of the database that contains the table to be opened. If not specified, the default database is used. |
Return type: Table.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot