Menggunakan atribut pengguna untuk skema dinamis dan memasukkan nama tabel
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Fitur
Atribut Pengguna
Looker dapat digunakan untuk menyisipkan nama skema dan/atau tabel secara dinamis per pengguna.
Langkah pertama adalah
membuat atribut pengguna,
seperti custom_schema atau custom_table, yang akan Anda
tetapkan nilainya untuk setiap pengguna. Anda dapat menetapkan nilai berikut:
Setelah membuat atribut pengguna dan menetapkan nilai yang sesuai untuk
pengguna, Anda dapat menambahkan referensi ke atribut tersebut di
sql_table_name file tampilan, melalui
Variabel cair.
Berikut adalah dua contoh, satu menggunakan skema kustom dan satu lagi menggunakan tabel kustom.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-31 UTC."],[],[],null,["# Using user attributes for dynamic schema and table name injection\n\nLooker's\n[User Attributes](/looker/docs/admin-panel-users-user-attributes)\nfeature can be used to dynamically insert schema and/or table names on a per-user\nbasis.\n\n\nThe first step is to\n[create a user attribute](/looker/docs/admin-panel-users-user-attributes#creating_user_attributes),\nsuch as `custom_schema` or `custom_table`, to which you\nwill assign a value for each user. You can assign these values:\n\n- Through the UI\n- In [bulk via the API](/looker/docs/reference/looker-api/latest/methods/UserAttribute/user_attribute)\n- In the [SSO URL for embedded contexts](https://github.com/looker/looker_embed_sso_examples/blob/master/node_example.js#L31).\n\n\nOnce you have created the user attribute and assigned the appropriate value for\nyour users, you can add a reference to that attribute in the\n`sql_table_name` of your view files, via\n[Liquid variables](/looker/docs/liquid-variable-reference).\nFollowing are two examples, one using a custom schema and one a custom table.\n\nExample A\n---------\n\n\nUsing a `custom_schema`: \n\n```\nview: events {\n sql_table_name: {{ _user_attributes['custom_schema'] }}.events ;;\n\n dimension: event_id {\n type: number\n primary_key: yes\n sql: ${TABLE}.id ;;\n }\n}\n```\n\nExample B\n---------\n\n\nUsing a `custom_table`: \n\n```\nview: events {\n sql_table_name: web_traffic.{{ _user_attributes['custom_event_table_name'] }} ;;\n\n dimension: event_id {\n type: number\n primary_key: yes\n sql: ${TABLE}.id ;;\n }\n}\n```"]]