Skip to content
Lucas Lessa
Voltar para as notícias
DatabricksGAImpacto: Médio

Scala UDFs in Unity Catalog can now access secrets

Session-scoped and Unity Catalog Scala UDFs can now access secrets managed in Unity Catalog.

O que mudou

User-defined functions in Scala, both session-scoped and Unity Catalog native ones, now support reading centrally managed secrets. Unity Catalog UDFs use the function owner's permissions, eliminating the need for callers to have direct access to the secrets.### Use casesImagine you need to write a Scala UDF that connects to an external API using protected credentials without exposing sensitive passwords in the code.

  • Read secrets in session-scoped Scala UDFs using the caller's permissions.
  • Read secrets in Unity Catalog Scala UDFs by declaring them in the SECRETS clause.
  • Isolate credentials so regular users can execute functions without direct secret access.### How to useTo use secrets in Unity Catalog UDFs, declare the secret in the function and ensure the environment version meets the requirements.```sql CREATE FUNCTION meu_catalogo.meu_esquema.minha_udf_scala() RETURNS STRING LANGUAGE SCALA ENVIRONMENT_VERSION '6' SECRETS ('meu_catalogo.meu_esquema.meu_segredo') AS 'com.exemplo.MinhaClasse.lerSegredo';
1. Creates a new Scala UDF inside Unity Catalog.
2. Sets the environment version to 6 or above, which is required for secret access.
3. Declares the secret to be securely consumed by the function logic.### Limitations and requirements- Requires serverless compute with environment version 6 or above, or classic compute with Databricks Runtime 19 or above in standard access mode.
- Only serverless SQL warehouses support Unity Catalog Scala UDFs that access secrets.
- The function creator must have READ SECRET permission on the secret and USE CATALOG/USE SCHEMA on parent objects.
Ver nota oficial do Databricks

Scala UDFs can access Unity Catalog secrets

Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.

Relacionadas