Categories:

System functions (System information)

SYSTEM$ENCODE_CKE_PRIMARY_KEY

Takes one or more primary key columns from a Cortex Knowledge Extensions (CKE) document and converts them into an encoded representation.

The encoded primary key is used as an input for further hashing, which anonymizes document identifiers in access history tables. This process helps protect customer data by ensuring that Snowflake stores hashed values derived from the encoded primary key instead of plain-text document IDs.

See also:

SYSTEM$CKE_HASH_FUNCTION

Syntax

SYSTEM$ENCODE_CKE_PRIMARY_KEY(
  '<pk_column_name>'
  [ , '<additional_pk_column_name>' ]
  [ , '<additional_pk_column_name>' ]
  [ , '<additional_pk_column_name>' ]
  [ , '<additional_pk_column_name>' ]
)

Arguments

Required:

pk_column_name

The primary key column name.

Optional:

additional_pk_column_name

Additional primary key column names.

You can specify up to four additional primary key column names as separate arguments.

Returns

Returns a length-encoded string from the combined primary keys. This serves as the unique document ID.

Examples

The following example returns the encoded primary key for the primary key columns pkCol1 and pkCol2:

SELECT ["pkCol1", "pkCol2"], SYSTEM$ENCODE_CKE_PRIMARY_KEY('primary_key_col_1' , 'primary_key_col_2') AS encoded_primary_key
  FROM your_cortex_search_service_table;