Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
igorlukanin committed Feb 1, 2025
1 parent 1f3f600 commit 1752769
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ cubes:
views:
- name: total_revenue_per_customer
public: {{ COMPILE_CONTEXT['securityContext']['isFinance'] }}
includes:
- orders.total_revenue
- users.company

cubes:
- join_path: orders
includes:
- total_revenue

- join_path: users
includes:
- company
```
```javascript
Expand All @@ -75,12 +81,25 @@ cube(`users`, {
});

// total_revenue_per_customer.js
view("total_revenue_per_customer", {
view(`total_revenue_per_customer`, {
description: `Total revenue per customer`,
public: COMPILE_CONTEXT.securityContext.isFinance,

includes: [orders.total_revenue, users.company],
});
cubes: [
{
join_path: orders,
includes: [
`total_revenue`
]
},
{
join_path: users,
includes: [
`company`
]
}
]
})
```

</CodeTabs>
Expand Down
74 changes: 23 additions & 51 deletions docs/pages/reference/data-model/view.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,20 @@ view(`arr`, {
description: `Annual Recurring Revenue`,
public: COMPILE_CONTEXT.security_context.is_finance,

includes: [revenue.arr, revenue.date, customers.plan],
});
cubes: [
{
join_path: revenue,
includes: [
`arr`,
`date`
]
},
{
join_path: customers,
includes: `plan`
}
]
})
```

```yaml
Expand All @@ -302,12 +314,15 @@ views:
description: Annual Recurring Revenue
public: COMPILE_CONTEXT.security_context.is_finance

includes:
# Measures
- revenue.arr
# Dimensions
- revenue.date
- customers.plan
cubes:
- join_path: revenue
includes:
- arr
- date

- join_path: customers
includes:
- plan
```
</CodeTabs>
Expand Down Expand Up @@ -340,49 +355,6 @@ views:

</CodeTabs>

### `includes` (deprecated)

<WarningBox>

The top-level `includes` parameter is deprecated and might be removed in
the future. Please always use the `includes` parameter with `cubes` and
`join_path` parameters so you can explicitly control the join path.

</WarningBox>

The top-level `includes` parameter is used to bulk add measures or dimensions
to a view.

<CodeTabs>

```javascript
view(`active_users`, {
includes: [
// Measures
users.rolling_count,

// Dimensions
users.city,
users.created_at,
],
});
```

```yaml
views:
- name: active_users

includes:
# Measures
- users.rolling_count

# Dimensions
- users.city
- users.created_at
```
</CodeTabs>

[ref-recipe-control-access-cubes-views]:
/guides/recipes/access-control/controlling-access-to-cubes-and-views
Expand Down

0 comments on commit 1752769

Please sign in to comment.