Skip to content

GNNTable.add_column()

Add a column that exists in the original dataset but not yet in the GNN table.

NameTypeDescriptionOptional
col_namestrThe name of the column to add.No
dtypeColumnDTypeThe data type of the column.No

Raises ValueError if the column is already part of the GNN table or if the column does not exist in the original dataset.

from relationalai_gnns import GNNTable, CandidateKey
from 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 GNNTable
table_with_ckey.remove_column(col_name="some_column_name")
# Use the column as an input feature for the GNNTable
table_with_ckey.add_column(col_name="some_column_name",
dtype=ColumnDType('category'))