GNNTable.set_candidate_key()
Set an existing column in the GNN table as a candidate key.
Parameters
Section titled “Parameters”| Name | Type | Description | Optional |
|---|---|---|---|
col_name | CandidateKey | The name of an existing column to set as a candidate key. | No |
Returns
Section titled “Returns”Raises ValueError if the column does not exist in the GNN table.
Example
Section titled “Example”from relationalai_gnns import GNNTable, CandidateKey
table_with_ckey = GNNTable( connector=connector, name="TableWithCKey", source="DATABASE.SCHEMA.TABLE_WITH_CKEY", type="node", candidate_keys = [CandidateKey(column_name="UniqueNumber")])
#set column "Id" as another candidate keytable_with_ckey.set_candidate_key(CandidateKey(column_name="Id"))