Looker will not be updating this content, nor guarantees that everything is up-to-date.
Alternatively to the method described below, you can use the Looker Data Dictionary from the Looker Marketplace if your admin has enabled certain Labs features.
You can use the Looker API to create a data dictionary based on the definitions and descriptions of fields defined in the Looker modeling layer. Creating a data dictionary can be useful for:
Authenticate into the API following the steps outlined in the Authentication with an SDK section of the Looker API Authentication documentation.
Define fields with descriptions and other parameters within the model in your Looker instance.
Call the lookML_model_explore
endpoint via the API and pull in the appropriate fields you want to identify within your data dictionary.
Here is a sample Ruby code that puts the above steps all together:
#Get Data Dictionary
require 'looker-sdk'
module ApplicationHelper
def self.api_auth
sdk = LookerSDK::Client.new(
# Looker/API Credentials
:client_id => ENV['API_CLIENT_ID'],
:client_secret => ENV['API_SECRET'],
:api_endpoint => ENV['API_ENDPOINT']
)
return sdk
end
def self.get_field_values(model_name, explore_name)
sdk = self.api_auth()
fields = {:fields => 'id, name, description, fields'}
#API Call to pull in metadata about fields in a particular explore
fields = sdk.lookml_model_explore(model_name, explore_name, fields)
my_fields = []
#Iterate through the field definitions and pull in the description, sql, and other looker tags you might want to include in your data dictionary.
fields[:fields][:dimensions].to_a.each do |x|
dimension = {
:field_type => 'Dimension',
:view_name => x[:view_label].to_s,
:field_name => x[:label_short].to_s,
:type => x[:type].to_s,
:description => x[:description].to_s,
:sql => x[:sql].to_s
}
my_fields << dimension
end
fields[:fields][:measures].to_a.each do |x|
measure = {
:field_type => 'Measure',
:view_name => x[:view_label].to_s,
:field_name => x[:label_short].to_s,
:type => x[:type].to_s,
:description => x[:description].to_s,
:sql => x[:sql].to_s
}
my_fields << measure
end
return my_fields
end
end
Format the results from the get_field_values
call. Consider using plugins to allow for search and sort functionality. In our example, we use the DataTable JS plugin.
Additional information on data dictionaries combining the API and Python to output a data dictionary to .csv can be found here in the Community post Writing a Simple Data Dictionary to CSV Using the Looker API and the Python requests library.