GNNTable.add_column()
Add a column that exists in the original dataset but not yet in the GNN table.
Parameters
Section titled “Parameters”| Name | Type | Description | Optional |
|---|---|---|---|
col_name | str | The name of the column to add. | No |
dtype | ColumnDType | The data type of the column. | No |
Returns
Section titled “Returns”Raises ValueError if the column is already part of the GNN table or if the column does not exist in the original dataset.
Example
Section titled “Example”from relationalai_gnns import GNNTable, CandidateKeyfrom relationalai_gnns import ColumnDType
table_with_ckey = GNNTable( connector=connector, name="TableWithCKey", source="DATABASE.SCHEMA.TABLE_WITH_CKEY", type="node", candidate_keys=[CandidateKey(column_name="Id")])
# Do not use this column as an input feature for the GNNTabletable_with_ckey.remove_column(col_name="some_column_name")
# Use the column as an input feature for the GNNTabletable_with_ckey.add_column(col_name="some_column_name", dtype=ColumnDType('category'))