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?
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`
}
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With