Danger

You are looking at the documentation for an older version of the SDV! We are no longer supporting or maintaining this version of the software

Click here to go to the new docs pages.

sdv.metadata.dataset.Metadata.set_primary_key

Metadata.set_primary_key(table, field)[source]

Set the primary key field of the indicated table.

The field must exist and either be an integer or categorical field.

Parameters
  • table (str) – Name of the table where the primary key will be set.

  • field (str) – Name of the field to be used as the new primary key.

Raises

ValueError – If the table or the field do not exist or if the field has an invalid type or subtype.