Is there a way to pass the parameters to `segments` ?
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
**Problem**
I need a complex filter which based on the documentation I need to use `segments`. The filter that I want to achieve is gonna be look like these:
```
segments: {
notMemberExcept: {
sql: `(
${CUBE}.user_id NOT IN (
SELECT user_id FROM members
) OR ${CUBE.userId} IN ($ValueFromUser) )`,
},
},
```
This where clause is important to be like that because previously I used alternative SQL that complied with CubeJS implementation but turns out it's gonna be a performance issue.
The problem is how I get the value from API in cube schema?
**Related Cube.js schema**
```javascript
cube(`Users`, {
sql: `SELECT * FROM users`,
joins: {
Members: {
relationship: `hasMany`,
sql: `
${CUBE.orgId} = ${Members.orgId} AND
${CUBE.userId} = ${Members.userId}
`,
}
}
dimensions: {
orgId: {
sql: `org_id`,
type: `string`,
primaryKey: true,
shown: true,
},
issueId: {
sql: `user_id`,
type: `string`,
primaryKey: true,
shown: true,
},
name: {
sql: `name`,
type: `string`,
},
},
```
Contributor guide
Assessment
This issue has not been assessed yet.