Cube.js: issue with query generator for Mongobi for nested fields in document

Created on 19 Mar 2019  路  4Comments  路  Source: cube-js/cube.js

error while executing query with nested fields.

Error while querying: {"queryKey":["SELECT details.name flow.detailsname, count(*) flow.count FROM flow AS flow GROUP BY 1 ORDER BY 2 DESC LIMIT 10000",[],[]],"error":"Error: Unknown column 'details.name' in 'field list'

For schema file below

cube(Flow, { sql:SELECT * FROM 1224.flow`,

joins: {

},

measures: {
count: {
type: count,
drillMembers: [createdbyuser, details.name, projectid, createddate, modifieddate]
}
},

dimensions: {
details.owner: {
sql: details.owner,
type: string
},

createdbyuser: {
  sql: `createdByUser`,
  type: `string`
},

details.description: {
  sql: `details.description`,
  type: `string`
},

details.name: {
  sql: `details.name`,
  type: `string`
},
`

For mongobi query, the nested fields needs to be inside `` I tested this with mysql workbench connecting to mongo over same BI Connectors.
I think, may be query generator needs to handle this.

working version of same query from mysql test
SELECTdetails.nameflow.detailsname, count(*)flow.countFROM flow AS flow GROUP BY 1 ORDER BY 2 DESC LIMIT 10000

enhancement help wanted

Most helpful comment

@krunalsabnis Hey Krunal! I believe you can escape details.name in sql field like this:

detailsName: {
  sql: `\`details.name\``,
  type: `string`
},

All 4 comments

@krunalsabnis Hey Krunal! I believe you can escape details.name in sql field like this:

detailsName: {
  sql: `\`details.name\``,
  type: `string`
},

@paveltiunov
Yes that works !

@krunalsabnis Great to hear that!

Actually would leave this open as we'd need to handle this case at Scaffolding level.

Was this page helpful?
0 / 5 - 0 ratings