Aller au contenu principal

ai_mask function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Preview

This functionality is in Public Preview and HIPAA compliant.

During the preview:

The ai_mask() function uses an AI model to mask specified entities in a given text using SQL. Use it to redact sensitive values inside free text, such as support tickets, call transcripts, agent traces, and text extracted from documents, so the rest of the text stays usable.

To redact sensitive data in agent traces end to end, see Govern and redact traces in Unity Catalog.

Databricks recommends version 2.0 for new queries. It labels each masked value with its classifier, such as [NAME], and reports an error message for each row that fails. To use it, pass options => map('version', '2.0') and read the masked text from the response field:

SQL
> SELECT ai_mask(ticket_text, options => map('version', '2.0')):response::string AS masked_text
FROM support_tickets;

Version 1.0 vs. version 2.0​

The function has two versions. Version 1.0 is the default. To use version 2.0, pass options => map('version', '2.0'). A call without that option runs version 1.0. If you pass classifier names without it, version 1.0 reads them as labels and returns [MASKED] text.

Version 2.0 differs from version 1.0 as follows:

  • It masks sensitive data with a Databricks-built detection model. Version 1.0 uses a Llama chat model served by Databricks Foundation Model APIs.
  • It takes an optional list of system-defined classifiers, with an 18-classifier default set and 90 supported classifiers, listed under Supported classifiers. Version 1.0 takes free-text labels.
  • It replaces each detected value with its classifier placeholder, such as [NAME], and numbers several values of one classifier in a row, such as [NAME_1] and [NAME_2]. Version 1.0 replaces every detected value with [MASKED].
  • It returns a VARIANT that carries the masked text, the version, and a per-row error message. Version 1.0 returns a STRING. See Returns.

Version 2.0 is in Beta. For the regions and compliance standards it supports, see Requirements. Version 1.0 is in Public Preview and HIPAA compliant.

Requirements​

Model licenses

The underlying models that might be used at this time include Databricks-proprietary models (version 2.0), and models licensed under Llama Community License (version 1.0). Customers are responsible for ensuring compliance with applicable model licenses where made available. Databricks recommends reviewing these licenses to ensure compliance with any applicable terms. If models emerge in the future that perform better according to Databricks's internal benchmarks, Databricks might change the model (and the list of applicable licenses provided on this page).

Syntax​

ai_mask(content [, classifiers], options => map('version', '2.0'))

Arguments​

  • content: A STRING expression.
  • classifiers: Optional. An ARRAY<STRING> of classifier names such as array('NAME', 'EMAIL_ADDRESS'). Omit it, or pass NULL, to use the default set. Classifier names are case-insensitive. An explicitly empty array fails the query, and an unknown classifier name fails the query.
  • options: A MAP<STRING, STRING> containing configuration options. Required for version 2.0:
    • version: Set to "2.0". If you omit it, the function runs version 1.0, the default.

Supported classifiers​

The default classifier set applies when you pass no classifier list or NULL. It contains these 18 classifiers: NAME, EMAIL_ADDRESS, PHONE_NUMBER, STREET_ADDRESS, DATE_OF_BIRTH, AGE, US_SSN, US_ITIN, PASSPORT, DRIVER_LICENSE, CREDIT_CARD, CARD_SECURITY_CODE, CARD_EXPIRATION_DATE, CARD_PIN, BANK_NUMBER, IBAN_CODE, IP_ADDRESS, and SECRET.

Version 2.0 accepts 90 classifiers in total. Expand the table for all of them, with descriptions.

All supported classifiers

Classifier

Description

NAME

A person's name, such as first, middle, or last names, titles, suffixes, or nicknames.

EMAIL_ADDRESS

An email address conforming to RFC-822.

PHONE_NUMBER

A phone number pattern, such as an area code, prefix, line number, or country code.

STREET_ADDRESS

A street address: house or building number, street name, and unit.

DATE_OF_BIRTH

Birth dates of individuals.

AGE

Age of individuals.

US_SSN

A US Social Security number (SSN) containing 9 digits.

US_ITIN

A US Individual Taxpayer Identification Number (ITIN) starting with “9” and having "7" or "8" as the fourth digit.

PASSPORT

A passport number from any country.

DRIVER_LICENSE

A driver license number from any country.

CREDIT_CARD

A credit card number containing 12-19 digits.

CARD_SECURITY_CODE

A card security code, such as a CVV or CVC, used for authentication in payment card transactions.

CARD_EXPIRATION_DATE

A payment card expiration date indicating when a credit or debit card expires.

CARD_PIN

A Personal Identification Number (PIN) used to authenticate payment card or ATM transactions.

BANK_NUMBER

A bank account number from any country.

IBAN_CODE

An International Bank Account Number (IBAN).

IP_ADDRESS

An IPv4 or IPv6 address.

SECRET

Cryptographic secrets including passwords, API keys, authentication tokens, cloud credentials, private keys, and encryption keys.

GEO_COORDINATES

Geographic coordinates (latitude and longitude) used to specify a location on Earth.

MEDICAL_LICENSE

A medical provider credential identifier, such as a US National Provider Identifier (NPI, a 10-digit CMS/NPPES number) or a state-issued medical license number.

URL

A Uniform Resource Locator (URL) used to specify the address of a resource on the internet.

VIN

A 17-character Vehicle Identification Number (VIN) used to uniquely identify motor vehicles.

LICENSE_PLATE

Vehicle registration plate numbers.

MAC_ADDRESS

A Media Access Control (MAC) address: a 48-bit hardware identifier for network interfaces.

IMEI

An International Mobile Equipment Identity (IMEI): a 15-digit number uniquely identifying a mobile device.

ETHNICITY

Racial or ethnic origin.

MARITAL_STATUS

Marital or civil partnership status.

SEXUAL_ORIENTATION

Sexual orientation.

CRIMINAL_BACKGROUND

Criminal convictions, offences, or background check results.

HEALTH_DATA

Health or medical information about an individual, including diagnoses, conditions, treatments, or medications.

BIOMETRIC_DATA

Biometric identifiers used to uniquely identify an individual, such as fingerprints, facial scans, iris/retina scans, or voiceprints.

GENETIC_DATA

Genetic data, including DNA/RNA sequences, genotype, or genetic markers of an individual.

RELIGIOUS_BELIEF

Religious or philosophical beliefs of an individual, including religion, denomination, faith, or creed.

POLITICAL_OPINION

Political opinions or affiliations of an individual, including party membership, political views, or ideology.

TRADE_UNION_MEMBERSHIP

Trade union or labor union membership of an individual.

US_BANK_NUMBER

A US bank account number containing 8-17 digits.

US_DRIVER_LICENSE

A US driver license number following https://ntsi.com/drivers-license-format/

US_PASSPORT

A US passport number containing a letter followed by 8 digits.

UK_NHS

A UK National Health Service (NHS) number containing 10 digits.

UK_NINO

A UK National Insurance Number (NINO) following the format: 2 letters, 6 digits, 1 letter.

UK_UTR

A UK Unique Taxpayer Reference (UTR), 10 digits.

DE_ID_CARD

A German National ID Card number (Personalausweis) containing 9 alphanumeric characters.

DE_SVNR

A German Social Security Number (Sozialversicherungsnummer) containing 12 alphanumeric characters.

DE_TAX_ID

A German Tax Identification Number (Steueridentifikationsnummer) containing 11 digits.

AU_TFN

An Australian Tax File Number (TFN) containing 8 or 9 digits.

AU_MEDICARE

An Australian Medicare card number containing 10 or 11 digits.

BR_CPF

A Brazilian CPF (Cadastro de Pessoas Físicas): individual taxpayer identification number.

BR_CNPJ

A Brazilian CNPJ (Cadastro Nacional da Pessoa Jurídica): business/company tax identification number.

BR_RG

A Brazilian RG (Registro Geral): individual state identification number.

BR_PIS

A Brazilian PIS/PASEP/NIS social-identification number: 11 digits with a Mod-11 check digit.

BR_TITULO_ELEITOR

A Brazilian Título de Eleitor (voter registration) number: 12 digits with two check digits; digits 9–10 encode the issuing state.

BR_CNS

A Brazilian Cartão Nacional de Saúde (CNS / SUS health card) number: 15 digits beginning with 1, 2, 7, 8, or 9, validated by a Mod-11 weighted-sum rule.

IN_AADHAAR

An Indian Aadhaar number: a 12-digit unique identification number issued by UIDAI.

IN_PAN

An Indian Permanent Account Number (PAN): a 10-character alphanumeric tax identifier.

IN_VOTER_ID

An Indian Voter ID (EPIC): a 10-character identifier (3 letters + 7 digits) issued by the Election Commission.

IN_UAN

An India EPFO Universal Account Number (UAN): a 12-digit EPFO identifier linking provident-fund/pension accounts.

IN_ESIC

An India Employee State Insurance (ESI/ESIC) number: a 10-digit Insured Person (IP) number.

CA_SOCIAL_INSURANCE_NUMBER

A Canadian Social Insurance Number (SIN): a 9-digit identifier with Luhn check digit.

CA_HEALTH_NUMBER

A Canadian provincial health card number: format varies by province (Ontario OHIP, Quebec RAMQ, and 9-digit formats used by BC, AB, SK, MB, NB, NS, YT, NU).

CA_PR_CARD

A Canadian Permanent Resident (PR) Card number: two letters followed by 7 or 10 digits.

JP_MY_NUMBER

A Japan Individual Number (My Number / マイナンバー): a 12-digit national identification and tax number with a Mod-11 check digit.

JP_PENSION_NUMBER

A Japan Basic Pension Number (基礎年金番号): a 10-digit national-pension identifier, formatted XXXX-XXXXXX.

IT_CODICE_FISCALE

An Italian fiscal code (Codice Fiscale): a 16-character alphanumeric tax/identity code composed of 3 surname letters, 3 first-name letters, a 2-digit birth year, a month letter, a 2-digit birth day (+40 for females), a 4-character birthplace code, and a final check letter. Also the Tessera Sanitaria and INPS identifier.

IT_PARTITA_IVA

An Italian VAT number (Partita IVA): 11 digits (7-digit taxpayer code + 3-digit office code + 1 Luhn check digit).

IT_ID_CARD

An Italian identity card number.

MEDICAL_DEVICE_ID

Identifiers for medical devices, including FDA Unique Device Identifiers (UDI) and their GS1/HIBCC/ICCBBA device-identifier components, such as a GTIN-14, plus device-specific serial or lot numbers such as implant or pacemaker serials. Scoped to medical devices only.

MEDICAL_RECORD_NUMBER

A Medical Record Number (MRN): a provider-assigned internal unique identifier for a patient's medical record within a hospital or health system.

HEALTH_PLAN_BENEFICIARY_NUMBER

A health plan beneficiary number: a health insurance member or subscriber identifier, including the US Medicare Beneficiary Identifier (MBI), Medicaid IDs, and commercial insurer member IDs.

MEDICAL_DATE

A clinical date related to an individual: admission date, discharge date, or date of death.

NL_BSN

A Dutch citizen service number (BSN / burgerservicenummer), 8 or 9 digits.

FR_NIR

A French social security number (NIR / numéro de sécurité sociale), 15 digits.

FR_TAX_ID

A French tax identification number (numéro fiscal / SPI), 13 digits.

FR_ID_CARD

A French national identity card number (CNI / CNIe).

ES_DNI

A Spanish national identity number (DNI / NIF).

ES_NIE

A Spanish foreigner identity number (NIE).

ES_BUSINESS_TAX_ID

A Spanish company tax identification number (NIF).

CH_AHV

A Swiss social security number (AHV / AVS), 13 digits starting 756.

SE_PERSONNUMMER

A Swedish personal identity number (personnummer / samordningsnummer).

NO_FODSELSNUMMER

A Norwegian national identity number (fødselsnummer), 11 digits.

NO_D_NUMBER

A Norwegian D-number (temporary identity number), 11 digits.

DK_CPR

A Danish civil registration number (CPR-nummer), 10 digits.

CARD_TRACK_DATA

Magnetic stripe track data from a payment card, containing encrypted or obfuscated card information.

SWIFT_CODE

A SWIFT code (ISO 9362 Bank Identifier Code) used for international bank transfers and payment routing.

CREDIT_SCORE

A credit score or creditworthiness rating assigned to an individual or entity by a financial institution.

COMPENSATION

Compensation or salary information for an individual, including wages, salaries, bonuses, and other forms of remuneration.

EMPLOYMENT_STATUS

Employment status information indicating whether an individual is employed, unemployed, or in another employment state.

POSTAL_CODE

A postal or ZIP code.

CITY

A city, town, or municipality name.

COUNTRY

A country name.

PROVINCE

A state or province name or code.

Classifier

Description

NAME

A person's name, such as first, middle, or last names, titles, suffixes, or nicknames.

EMAIL_ADDRESS

An email address conforming to RFC-822.

PHONE_NUMBER

A phone number pattern, such as an area code, prefix, line number, or country code.

STREET_ADDRESS

A street address: house or building number, street name, and unit.

DATE_OF_BIRTH

Birth dates of individuals.

AGE

Age of individuals.

US_SSN

A US Social Security number (SSN) containing 9 digits.

US_ITIN

A US Individual Taxpayer Identification Number (ITIN) starting with “9” and having "7" or "8" as the fourth digit.

PASSPORT

A passport number from any country.

DRIVER_LICENSE

A driver license number from any country.

CREDIT_CARD

A credit card number containing 12-19 digits.

CARD_SECURITY_CODE

A card security code, such as a CVV or CVC, used for authentication in payment card transactions.

CARD_EXPIRATION_DATE

A payment card expiration date indicating when a credit or debit card expires.

CARD_PIN

A Personal Identification Number (PIN) used to authenticate payment card or ATM transactions.

BANK_NUMBER

A bank account number from any country.

IBAN_CODE

An International Bank Account Number (IBAN).

IP_ADDRESS

An IPv4 or IPv6 address.

SECRET

Cryptographic secrets including passwords, API keys, authentication tokens, cloud credentials, private keys, and encryption keys.

GEO_COORDINATES

Geographic coordinates (latitude and longitude) used to specify a location on Earth.

MEDICAL_LICENSE

A medical provider credential identifier, such as a US National Provider Identifier (NPI, a 10-digit CMS/NPPES number) or a state-issued medical license number.

URL

A Uniform Resource Locator (URL) used to specify the address of a resource on the internet.

VIN

A 17-character Vehicle Identification Number (VIN) used to uniquely identify motor vehicles.

LICENSE_PLATE

Vehicle registration plate numbers.

MAC_ADDRESS

A Media Access Control (MAC) address: a 48-bit hardware identifier for network interfaces.

IMEI

An International Mobile Equipment Identity (IMEI): a 15-digit number uniquely identifying a mobile device.

ETHNICITY

Racial or ethnic origin.

MARITAL_STATUS

Marital or civil partnership status.

SEXUAL_ORIENTATION

Sexual orientation.

CRIMINAL_BACKGROUND

Criminal convictions, offences, or background check results.

HEALTH_DATA

Health or medical information about an individual, including diagnoses, conditions, treatments, or medications.

BIOMETRIC_DATA

Biometric identifiers used to uniquely identify an individual, such as fingerprints, facial scans, iris/retina scans, or voiceprints.

GENETIC_DATA

Genetic data, including DNA/RNA sequences, genotype, or genetic markers of an individual.

RELIGIOUS_BELIEF

Religious or philosophical beliefs of an individual, including religion, denomination, faith, or creed.

POLITICAL_OPINION

Political opinions or affiliations of an individual, including party membership, political views, or ideology.

TRADE_UNION_MEMBERSHIP

Trade union or labor union membership of an individual.

US_BANK_NUMBER

A US bank account number containing 8-17 digits.

US_DRIVER_LICENSE

A US driver license number following https://ntsi.com/drivers-license-format/

US_PASSPORT

A US passport number containing a letter followed by 8 digits.

UK_NHS

A UK National Health Service (NHS) number containing 10 digits.

UK_NINO

A UK National Insurance Number (NINO) following the format: 2 letters, 6 digits, 1 letter.

UK_UTR

A UK Unique Taxpayer Reference (UTR), 10 digits.

DE_ID_CARD

A German National ID Card number (Personalausweis) containing 9 alphanumeric characters.

DE_SVNR

A German Social Security Number (Sozialversicherungsnummer) containing 12 alphanumeric characters.

DE_TAX_ID

A German Tax Identification Number (Steueridentifikationsnummer) containing 11 digits.

AU_TFN

An Australian Tax File Number (TFN) containing 8 or 9 digits.

AU_MEDICARE

An Australian Medicare card number containing 10 or 11 digits.

BR_CPF

A Brazilian CPF (Cadastro de Pessoas Físicas): individual taxpayer identification number.

BR_CNPJ

A Brazilian CNPJ (Cadastro Nacional da Pessoa Jurídica): business/company tax identification number.

BR_RG

A Brazilian RG (Registro Geral): individual state identification number.

BR_PIS

A Brazilian PIS/PASEP/NIS social-identification number: 11 digits with a Mod-11 check digit.

BR_TITULO_ELEITOR

A Brazilian Título de Eleitor (voter registration) number: 12 digits with two check digits; digits 9–10 encode the issuing state.

BR_CNS

A Brazilian Cartão Nacional de Saúde (CNS / SUS health card) number: 15 digits beginning with 1, 2, 7, 8, or 9, validated by a Mod-11 weighted-sum rule.

IN_AADHAAR

An Indian Aadhaar number: a 12-digit unique identification number issued by UIDAI.

IN_PAN

An Indian Permanent Account Number (PAN): a 10-character alphanumeric tax identifier.

IN_VOTER_ID

An Indian Voter ID (EPIC): a 10-character identifier (3 letters + 7 digits) issued by the Election Commission.

IN_UAN

An India EPFO Universal Account Number (UAN): a 12-digit EPFO identifier linking provident-fund/pension accounts.

IN_ESIC

An India Employee State Insurance (ESI/ESIC) number: a 10-digit Insured Person (IP) number.

CA_SOCIAL_INSURANCE_NUMBER

A Canadian Social Insurance Number (SIN): a 9-digit identifier with Luhn check digit.

CA_HEALTH_NUMBER

A Canadian provincial health card number: format varies by province (Ontario OHIP, Quebec RAMQ, and 9-digit formats used by BC, AB, SK, MB, NB, NS, YT, NU).

CA_PR_CARD

A Canadian Permanent Resident (PR) Card number: two letters followed by 7 or 10 digits.

JP_MY_NUMBER

A Japan Individual Number (My Number / マイナンバー): a 12-digit national identification and tax number with a Mod-11 check digit.

JP_PENSION_NUMBER

A Japan Basic Pension Number (基礎年金番号): a 10-digit national-pension identifier, formatted XXXX-XXXXXX.

IT_CODICE_FISCALE

An Italian fiscal code (Codice Fiscale): a 16-character alphanumeric tax/identity code composed of 3 surname letters, 3 first-name letters, a 2-digit birth year, a month letter, a 2-digit birth day (+40 for females), a 4-character birthplace code, and a final check letter. Also the Tessera Sanitaria and INPS identifier.

IT_PARTITA_IVA

An Italian VAT number (Partita IVA): 11 digits (7-digit taxpayer code + 3-digit office code + 1 Luhn check digit).

IT_ID_CARD

An Italian identity card number.

MEDICAL_DEVICE_ID

Identifiers for medical devices, including FDA Unique Device Identifiers (UDI) and their GS1/HIBCC/ICCBBA device-identifier components, such as a GTIN-14, plus device-specific serial or lot numbers such as implant or pacemaker serials. Scoped to medical devices only.

MEDICAL_RECORD_NUMBER

A Medical Record Number (MRN): a provider-assigned internal unique identifier for a patient's medical record within a hospital or health system.

HEALTH_PLAN_BENEFICIARY_NUMBER

A health plan beneficiary number: a health insurance member or subscriber identifier, including the US Medicare Beneficiary Identifier (MBI), Medicaid IDs, and commercial insurer member IDs.

MEDICAL_DATE

A clinical date related to an individual: admission date, discharge date, or date of death.

NL_BSN

A Dutch citizen service number (BSN / burgerservicenummer), 8 or 9 digits.

FR_NIR

A French social security number (NIR / numéro de sécurité sociale), 15 digits.

FR_TAX_ID

A French tax identification number (numéro fiscal / SPI), 13 digits.

FR_ID_CARD

A French national identity card number (CNI / CNIe).

ES_DNI

A Spanish national identity number (DNI / NIF).

ES_NIE

A Spanish foreigner identity number (NIE).

ES_BUSINESS_TAX_ID

A Spanish company tax identification number (NIF).

CH_AHV

A Swiss social security number (AHV / AVS), 13 digits starting 756.

SE_PERSONNUMMER

A Swedish personal identity number (personnummer / samordningsnummer).

NO_FODSELSNUMMER

A Norwegian national identity number (fødselsnummer), 11 digits.

NO_D_NUMBER

A Norwegian D-number (temporary identity number), 11 digits.

DK_CPR

A Danish civil registration number (CPR-nummer), 10 digits.

CARD_TRACK_DATA

Magnetic stripe track data from a payment card, containing encrypted or obfuscated card information.

SWIFT_CODE

A SWIFT code (ISO 9362 Bank Identifier Code) used for international bank transfers and payment routing.

CREDIT_SCORE

A credit score or creditworthiness rating assigned to an individual or entity by a financial institution.

COMPENSATION

Compensation or salary information for an individual, including wages, salaries, bonuses, and other forms of remuneration.

EMPLOYMENT_STATUS

Employment status information indicating whether an individual is employed, unemployed, or in another employment state.

POSTAL_CODE

A postal or ZIP code.

CITY

A city, town, or municipality name.

COUNTRY

A country name.

PROVINCE

A state or province name or code.

Returns​

A VARIANT containing:

JSON
{
"response": "[NAME] lives in New York. His email is [EMAIL_ADDRESS].",
"metadata": {
"version": "2.0"
},
"error_message": null
}
  • response: The content with each detected value replaced by its classifier placeholder. A placeholder is the classifier name in uppercase brackets, such as [NAME] or [EMAIL_ADDRESS]. When a row contains several distinct values for one classifier, the placeholders are numbered in order of first appearance, such as [NAME_1] and [NAME_2]. Repeated identical text reuses its placeholder. Overlapping detected spans form one placeholder.
  • metadata.version: The version that produced the result, "2.0".
  • error_message: null when the row succeeded. When the detection call for a row fails, such as a service error or a timeout after retries, response is null and error_message describes the failure. The query continues with the remaining rows.

To work with the masked text as a STRING, read the response field, for example masked:response::string.

NULL or empty content returns a result whose response and error_message are both null.

For how version 2.0 handles failures, see Error conditions.

Examples​

The following examples use version 2.0 to mask personal information (PII), such as names, email addresses, and phone numbers, in text. Databricks recommends version 2.0 for new queries. Because the model detects the values, results can vary.

To mask a text column and get the masked text as a STRING, read the response field of the result:

SQL
> SELECT
ticket_id,
ai_mask(ticket_text, array('NAME', 'EMAIL_ADDRESS', 'PHONE_NUMBER'), options => map('version', '2.0')):response::string AS masked_text
FROM support_tickets;

To mask names and email addresses in a literal, run the following:

SQL
> SELECT ai_mask(
'John Doe lives in New York. His email is john.doe@example.com.',
array('NAME', 'EMAIL_ADDRESS'),
options => map('version', '2.0')
);
{
"response": "[NAME] lives in New York. His email is [EMAIL_ADDRESS].",
"metadata": {"version": "2.0"},
"error_message": null
}

When a row contains several values for one classifier, each value gets a numbered placeholder:

SQL
> SELECT ai_mask(
'Contact Ana Lopez or Ben Ortiz at ana@example.com or ben@example.com.',
array('NAME', 'EMAIL_ADDRESS'),
options => map('version', '2.0')
);
{
"response": "Contact [NAME_1] or [NAME_2] at [EMAIL_ADDRESS_1] or [EMAIL_ADDRESS_2].",
"metadata": {"version": "2.0"},
"error_message": null
}

To use the default classifiers, pass no classifier list:

SQL
> SELECT ai_mask(
'SSN 123-45-6789.',
options => map('version', '2.0')
);
{
"response": "SSN [US_SSN].",
"metadata": {"version": "2.0"},
"error_message": null
}

To get the masked text as a STRING, read the response field of the result:

SQL
> SELECT masked:response::string AS masked_text
FROM (
SELECT ai_mask(
'John Doe lives in New York.',
array('NAME'),
options => map('version', '2.0')
) AS masked
);
"[NAME] lives in New York."

Limitations​

This function is not available on Databricks SQL Classic.

For the errors the function returns, see Error conditions.

Error conditions​

In these cases, the query fails before any row runs with AI_FUNCTION_COMPILATION_ERROR, and the error message includes the text shown:

  • version in options isn't in the major.minor format, such as '2'. The error is Invalid version: <value>, expected a string in the format of major.minor.
  • version in options names a version the function doesn't have. The error is Version <value> is not supported. Supported versions: <versions>.
  • Version 2.0 isn't enabled for the workspace. The error is ai_mask version 2.0 is not enabled for this workspace. A workspace admin enables the version 2.0 Beta on the Previews page. See Manage Databricks previews.
  • A classifier name isn't one of the supported classifiers. The error is Invalid ai_mask classifiers: unknown system classifier: <names>. or Invalid ai_mask classifiers: unsupported system classifier: <names>. Classifier names are case-insensitive.
  • classifiers is an empty array. The error is The classifiers parameter must contain at least 1 classifier.

When version 2.0 isn't available to the workspace, such as in a region the region table doesn't list, the query fails when it starts.

When the detection call for a row fails, that row returns a null response and an error_message, and the query continues with the remaining rows. Filter on error_message to find rows that weren't masked. A null response alone doesn't mean the text contains no sensitive data. Common error_message values include the following:

  • Rate limit exceeded after several retries. Try again later.
  • The request timed out. Try again later.
  • A connection error occurred after several retries. Try again later.
  • The service was unavailable after several retries. Try again later.
  • Sensitive data detection failed for this row. Try again.
  • An unexpected error occurred. Try again later.

A NULL or empty content isn't an error. See Returns.