How can I dynamically change table name in the sql statements generated by cubejs?
I query open search via sql interface. Our index name consists of name + date partition
, e.g. transactions_2023_01_31.
How can I append this date partition to the generated sql statements?
I know I can use the security context in the cube model but that looks dirty to me.
cube(`Transactions`, {
sql: `SELECT * FROM table_${SECURITY_CONTEXT.datepartition.unsafeValue()}
}
Opensearch allows to use parameters to substitute ?
characters in the query, that works also for table names. Unfortunatelly cube.js opensearch driver uses it's own way of substitution:
SqlString.format(query, values)
Is there another solution?