使用状況
view_name: view_name
}
階層
view_name |
デフォルト値
名前が Explore の名前と一致するビュー許可
既存のビューの名前 |
定義
view_name
は、Explore のフィールドを定義するビューを決定します。view_name
が省略されている場合、Looker は、基になるビュー名が Explore 名と同じであると見なします。通常、view_name
は、同じビューから複数の Explore を作成する場合にのみ使用されます。
例
Explore メニューに、user
というビューに基づいて Customer というオプションを追加します。
explore: customer {
view_name: user
}
一般的な課題
view_name
、from
、label
はよく混同されますが、動作が異なります
view_name
、from
、label
のパラメータでも効果は似ていますが、異なります。
view_name
の使用
view_name
を使用して、同じビューから複数の Explore を作成し、各 Explore で同じフィールドを参照します。
explore: customer {
view_name: user
}
# Would appear in the Explore menu as 'Customer'
# Fields would appear like 'User Name'
# You would reference fields like ${user.name}
explore: buyer {
view_name: user
}
# Would appear in the Explore menu as 'Buyer'
# Fields would appear like 'User Name'
# You would reference fields like ${user.name}
view_name: user
では、生成される SQL は元のテーブル名(FROM schema.users AS users
など)を使用します。
from
の使用
from
を使用して、同じビューから複数の Explore を作成し、Explore ごとに異なるフィールドを参照します。
explore: customer {
from: user
}
# Would appear in the Explore menu as 'Customer'
# Fields would appear like 'Customer Name'
# You would reference fields like ${customer.name}
explore: buyer {
from: user
}
# Would appear in the Explore menu as 'Buyer'
# Fields would appear like 'Buyer Name'
# You would reference fields like ${buyer.name}
from: user
を使用すると、生成された SQL は元のテーブル名(例: FROM schema.users AS customer
)をエイリアスにします。
label
の使用
同じビューから複数の Explore を作成する必要がない場合は、Explore メニューを使用して、Explore の名前を異なる方法で表示します。label
explore: user {
label: "Customer"
}
# Would appear in the Explore menu as 'Customer'
# Fields would appear like 'User Name'
# You would reference fields like ${user.name}
知っておくべきこと
view_name
を使用して Explore の名前を変更することはほとんどありません。
拡張モデルを作成し、同じビューから複数の Explore を作成する必要がない限り、view_name
を使用して Explore の名前を変更することは珍しくありません。
基になるビューの名前を変更するか、label
を使用してフィールド ピッカーでの Explore の表示方法を変更することを検討してください。