I have postgres database with a jsonb column which contains custom attribute keys and values. Is there any approach to get these to show up in the dimensions?
Asked
Active
Viewed 1,233 times
1 Answers
9
You can use ->>
json operator for that https://www.postgresql.org/docs/9.5/functions-json.html. For example:
cube(`Users`, {
sql: `select * from users`,
// ...
dimensions: {
firstName: {
sql: `${CUBE}.attributes->>'firstName'`,
type: `string`
},
lastName: {
sql: `${CUBE}.attributes->>'lastName'`,
type: `string`
}
}
})

Pavel Tiunov
- 1,163
- 6
- 8