Views
What are Views and Why Use Them
Views are SQL abstractions that wrap UDTFs, providing several benefits:
- No Credentials Required: Views automatically inject SECRET() calls, so users don't need to provide credentials
- Simplified Queries: Users query Views directly without knowing the underlying UDTF parameters
- Discoverability: Views are indexed in the Databricks UI and appear in search results
- Governance: Unity Catalog permissions apply to Views, enabling fine-grained access control
View Discovery in Databricks UI
After registration, Views appear in the Databricks UI:
- Catalog Explorer: Navigate to
Catalog > main > sailboat_sailboat_1 > smallboat - Search Box: Search for "smallboat" in the Databricks search box
- Data Explorer: Views appear alongside tables in the Data Explorer
Querying Views vs UDTFs Directly
Querying Views (Recommended)
Views are easier to query because they don't require credentials:
-- Query a View (no credentials needed)
SELECT * FROM main.sailboat_sailboat_1.smallboat
WHERE name = 'MyBoat'
LIMIT 10;
Querying UDTFs Directly
You can also query UDTFs directly, but you must provide credentials:
-- Query UDTF directly (credentials required)
SELECT * FROM main.sailboat_sailboat_1.smallboat_udtf(
client_id => SECRET('cdf_sailboat_sailboat', 'client_id'),
client_secret => SECRET('cdf_sailboat_sailboat', 'client_secret'),
tenant_id => SECRET('cdf_sailboat_sailboat', 'tenant_id'),
cdf_cluster => SECRET('cdf_sailboat_sailboat', 'cdf_cluster'),
project => SECRET('cdf_sailboat_sailboat', 'project'),
name => 'MyBoat'
) LIMIT 10;
Next Steps
- Learn about Querying Views and UDTFs
- See Filtering for filtering examples
- Set up Governance permissions