{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"redocly_category":"Products","product_name":"Data Workbench","type":"markdown"},"seo":{"title":"Logical Views","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"logical-views","__idx":0},"children":["Logical Views"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A logical view is a virtual table defined by a SQL query. Unlike a physical table, a logical view does not store data. Instead, it dynamically computes results from underlying tables each time the view is queried."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Logical views are currently available for Trino only. Hive support is planned for a future release."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"benefits-and-use-cases","__idx":1},"children":["Benefits and Use Cases"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Logical views provide several key benefits:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Query Reusability"]},": Define complex queries once and reuse them across multiple analyses"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Reduced Change Amplification"]},": Update data transformations in one place instead of modifying multiple queries"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Virtual Data Marts"]},": Create logical data structures without duplicating data"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["BI Tool Compatibility"]},": Convert Treasure Data native types to BI tool-compatible types (e.g., timestamp)"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"common-use-cases","__idx":2},"children":["Common Use Cases"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["BI Tool Timestamp Compatibility"]},": PlazmaDB tables store timestamps as Unix time (integer) or strings. Create logical views with timestamp columns to allow BI tools to directly use timestamp fields without custom calculations."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Event Log Transformation"]},": Transform event logs (such as Email Open/Bounce/Click events from Engage Studio) into aggregated metrics by customer or email address for easier analysis."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Simplify Complex Queries"]},": Encapsulate common filtering, aggregation, or joining logic in views for data analysts to query directly."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Data Masking and Security"]},": Use DEFINER mode to provide controlled access to specific columns or filtered rows without granting direct table access to users."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"creating-logical-views","__idx":3},"children":["Creating Logical Views"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Logical views are created using SQL CREATE VIEW statements in the Data Workbench query editor."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"using-trino-sql","__idx":4},"children":["Using Trino SQL"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"CREATE VIEW view_name AS\nSELECT column1, column2\nFROM table_name\nWHERE condition;\n\n-- With security mode specification\nCREATE VIEW view_name\nSECURITY DEFINER  -- or INVOKER\nAS\nSELECT * FROM table_name;\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For further detail: ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://trino.io/docs/423/sql/create-view.html"},"children":["Trino create view syntax"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"examples","__idx":5},"children":["Examples"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a view to filter columns:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"CREATE VIEW region_without_comment AS\nSELECT r_regionkey, r_name, r_dummy, time\nFROM tpch_sf1.region;\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a view with timestamp conversion:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"CREATE VIEW orders_with_timestamp AS\nSELECT\n  order_id,\n  customer_id,\n  FROM_UNIXTIME(order_time) AS order_timestamp,\n  amount\nFROM orders;\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Logical view queries can only be created and updated using SQL statements. However, you can edit view details (name, description, security mode) through the Data Workbench UI."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"viewing-and-querying-logical-views","__idx":6},"children":["Viewing and Querying Logical Views"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"list-logical-views","__idx":7},"children":["List Logical Views"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the UI, navigate to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Data Workbench"]}," > ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Databases"]}," and select a database. Logical views are shown in the table list with a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["view"]}," type indicator."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/logical-view-table-list.785cdfb96192c886ccf89a6ed90780e00d722da802c5fc0d82d4ceabe87acdb0.4c190181.png","alt":"Logical views in table list"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Using SQL:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT * FROM INFORMATION_SCHEMA.VIEWS;\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"query-a-logical-view","__idx":8},"children":["Query a Logical View"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Query logical views just like regular tables using Trino:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT * FROM region_without_comment WHERE r_name = 'ASIA';\n\nSELECT * FROM customer_summary WHERE total_orders > 10;\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"view-details","__idx":9},"children":["View Details"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The view detail page shows:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Details"]},": Name, description, last updated, security mode, owner, created date, database"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Records"]},": Preview data (select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Update Preview"]}," to fetch up to 40 sample records)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Schema"]},": Column definitions and query text. Note that data types used in view schema are different from tables. For tables, ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/databases/td-native-data-types"},"children":["TD native data types"]}," are used. For views, query engine data types are used (e.g., ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://trino.io/docs/423/language/types.html"},"children":["Trino data types"]}," for Trino)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Dependencies"]},": Tables and views referenced by this view"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/logical-view-details.c4dadffa2a5456e8a28bb8f1661b99f4b1036f34e6ccfb8273229f65ac6a42f6.4c190181.png","alt":"Logical view details page"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Records"]}," tab allows you to preview the view's data. Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Update Preview"]}," to fetch up to 40 sample records:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/logical-view-preview.feb7fee1a60d573f253800cd9156232a781548cf894c373aa3699c2bfb6cc39f.4c190181.png","alt":"Logical view preview"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"managing-logical-views","__idx":10},"children":["Managing Logical Views"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"update-view-definition","__idx":11},"children":["Update View Definition"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To update a view definition, use the CREATE OR REPLACE VIEW statement:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"CREATE OR REPLACE VIEW view_name AS\nSELECT new_column1, new_column2\nFROM table_name\nWHERE new_condition;\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When you use CREATE OR REPLACE VIEW, the view definition is completely replaced with the new query. All previous columns and logic are removed."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"update-security-mode","__idx":12},"children":["Update Security Mode"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can change the security mode through the UI or SQL."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Using the UI:"]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Navigate to the view detail page"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select the menu (⋯) and choose ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Edit Details"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Edit Logical View Details"]}," dialog:",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Definer"]}," or ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Invoker"]}," under ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Security Mode"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Optionally update the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Name"]}," or ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Description"]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Confirm"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/logical-view-edit-details-dialog.e55c3c71ef4577f32e40badcd4c2eb9904ce516dcade6a1ff89fe06a9b57e635.4c190181.png","alt":"Edit Logical View Details dialog"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Using SQL:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To change the security mode via SQL, use CREATE OR REPLACE VIEW with the new security mode specification:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"-- Change to INVOKER mode\nCREATE OR REPLACE VIEW view_name\nSECURITY INVOKER\nAS\nSELECT * FROM table_name;\n\n-- Change to DEFINER mode\nCREATE OR REPLACE VIEW view_name\nSECURITY DEFINER\nAS\nSELECT * FROM table_name;\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When using CREATE OR REPLACE VIEW, you must also re-specify the complete query definition."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"delete-a-logical-view","__idx":13},"children":["Delete a Logical View"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To delete a logical view, use the DROP VIEW statement:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"DROP VIEW view_name;\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Deleting a view does not delete underlying tables. If other views reference this view, they will fail when queried."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"delegate-view-ownership","__idx":14},"children":["Delegate View Ownership"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The view owner is important when using DEFINER security mode, as queries execute with the owner's permissions."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Currently, ownership can only be changed via API. The target user must have Full Access permission on the database."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If a view owner is deleted and the view uses DEFINER mode, the view will no longer work."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"permissions","__idx":15},"children":["Permissions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Logical views inherit permissions from the database. The following operations are allowed based on database permission level:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Database Permission"},"children":["Database Permission"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"List/View"},"children":["List/View"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Create"},"children":["Create"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Update"},"children":["Update"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Delete"},"children":["Delete"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Query"},"children":["Query"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Full Access"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Manage Own"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["General Access"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Query-only"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✗"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✗"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✗"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Import-only"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✓"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✗"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✗"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✗"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✗"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["None"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✗"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✗"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✗"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✗"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["✗"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"security-mode-and-permissions","__idx":16},"children":["Security Mode and Permissions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/databases/logical-view-security-modes"},"children":["security mode"]}," determines whose permissions are used to access referenced tables:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["DEFINER mode"]}," (default): Uses view owner's permissions",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Query executors don't need permission to underlying tables"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Useful for providing controlled access to sensitive data"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["INVOKER mode"]},": Uses query executor's permissions",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Query executors must have permission to all underlying tables"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enforces user-level permissions"]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/data-workbench/databases/logical-view-security-modes"},"children":["Logical View Security Modes"]}," for detailed information."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"limitations","__idx":17},"children":["Limitations"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"capacity-limits","__idx":18},"children":["Capacity Limits"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Maximum 50 logical views per database"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Maximum 1,024 columns per logical view"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Maximum 256 KB for view definition query statement"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Maximum 10 levels of nested logical views"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"functional-limitations","__idx":19},"children":["Functional Limitations"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Read-only"]},": DML operations (INSERT, UPDATE, DELETE) are not supported"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Trino only"]},": Currently only Trino is supported; Hive support is planned for a future release"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["No cross-account queries"]},": Views cannot be used to reference tables of other accounts in Data Clean Room"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["No Parent Segment integration"]},": Logical views cannot be used as master tables or attribute tables in Parent Segments (support planned for a future release)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["No column-level tags"]},": View columns cannot be annotated with tags for data classification"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Schema stored at creation"]},": If underlying table columns change after view creation, the view schema is not automatically updated"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"column-permission-restrictions","__idx":20},"children":["Column Permission Restrictions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If a user has a column permission with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["except: false"]}," (cannot view non-tagged columns), they cannot use logical views in queries, regardless of security mode."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"lifecycle-independence","__idx":21},"children":["Lifecycle Independence"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The lifecycle of a view and its referenced tables are independent:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Referenced tables can be deleted at any time"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["When a referenced table is deleted, queries against the view will fail"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The view query is validated by the query engine when created"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"query-engine-compatibility","__idx":22},"children":["Query Engine Compatibility"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Currently, logical views are only supported for Trino"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Hive support is planned for a future release"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["View names must be unique within a database"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["SQL syntax may change when query engine versions are upgraded. If incompatible SQL syntax is used, views defined in old query engine versions may not work in a new query engine version. The view definition must be updated with the latest SQL syntax in that case."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"best-practices","__idx":23},"children":["Best Practices"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Use descriptive names"]},": Choose view names that clearly describe their purpose"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Test before deploying"]},": Query the view to verify it returns expected results"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Consider performance"]},": Complex views with multiple joins may impact query performance"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Mind nesting depth"]},": Keep view nesting to a reasonable level (limit is 10 levels)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Use DEFINER mode for controlled access"]},": Allow Query-only users to access transformed data without granting table access"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Monitor dependencies"]},": Check which views reference tables before deleting them"]}]}]},"headings":[{"value":"Logical Views","id":"logical-views","depth":1},{"value":"Benefits and Use Cases","id":"benefits-and-use-cases","depth":2},{"value":"Common Use Cases","id":"common-use-cases","depth":3},{"value":"Creating Logical Views","id":"creating-logical-views","depth":2},{"value":"Using Trino SQL","id":"using-trino-sql","depth":3},{"value":"Examples","id":"examples","depth":3},{"value":"Viewing and Querying Logical Views","id":"viewing-and-querying-logical-views","depth":2},{"value":"List Logical Views","id":"list-logical-views","depth":3},{"value":"Query a Logical View","id":"query-a-logical-view","depth":3},{"value":"View Details","id":"view-details","depth":3},{"value":"Managing Logical Views","id":"managing-logical-views","depth":2},{"value":"Update View Definition","id":"update-view-definition","depth":3},{"value":"Update Security Mode","id":"update-security-mode","depth":3},{"value":"Delete a Logical View","id":"delete-a-logical-view","depth":3},{"value":"Delegate View Ownership","id":"delegate-view-ownership","depth":3},{"value":"Permissions","id":"permissions","depth":2},{"value":"Security Mode and Permissions","id":"security-mode-and-permissions","depth":3},{"value":"Limitations","id":"limitations","depth":2},{"value":"Capacity Limits","id":"capacity-limits","depth":3},{"value":"Functional Limitations","id":"functional-limitations","depth":3},{"value":"Column Permission Restrictions","id":"column-permission-restrictions","depth":3},{"value":"Lifecycle Independence","id":"lifecycle-independence","depth":3},{"value":"Query Engine Compatibility","id":"query-engine-compatibility","depth":2},{"value":"Best Practices","id":"best-practices","depth":2}],"frontmatter":{"seo":{"title":"Logical Views"}},"lastModified":"2025-12-16T04:37:23.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/customer-data-platform/data-workbench/databases/logical-views","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}