Extended views for joining the same table with different logic

When building data models in Omni, there are times when you’ll want to join the same view more than once – like joining the users table twice, once as sellers and once as buyers. This is covered in a previous article, which introduces the join_to_view_as parameter – a great option when you only need a simple alias.

But what if you need to customize the aliased view beyond just the name? Or maybe you tried the previous approach and got a relationship alias duplicates view name error in the model.

For example, let’s say you want to rename the name field in the sellers view to “Seller Name” or changed how this view is ordered in the workbook field picker. In these cases, you’ll want to extend the base view instead. This allows you to reuse the logic in users, but override specific fields, labels, metadata.

Example

views:
  sellers:
    display_order: 1
    extends: [users]

    dimensions:
      name:
        label: Seller Name

relationships:
  - join_from_view: order_items
    join_to_view: sellers
    join_type: always_left
    on_sql: ${order_items.seller_id} = ${sellers.id}
    relationship_type: assumed_many_to_one

In this example:

  1. We define a new view, sellers, that extends the base view, users.
  2. We customize the name dimension label to show “Seller name” and set a specific display_order.
  3. We reference the sellers view in a relationship just like we would any other view.

When to Use This Pattern
Use extends when:

  • You want to customize field labels, display order or other metadata on the view.
  • You need to join to the same table multiple times with different representation.
  • You want to give end users a cleaner experience in the workbook UI with intuitive names and layout.
  • You run into a relationship alias duplicates view name error in the model IDE.