cube icon indicating copy to clipboard operation
cube copied to clipboard

I can't see some columns

Open PatrykM11 opened this issue 3 years ago • 7 comments

I have a database in postgres (22mln rows and 17 columns) and when I use Cube.js i can see one column in measures and 10 columns in dimensions.

Btw I dropped 2 columns to see if i will be able to see 2 others but it did not happen and now there is 8 columns in dimensions.

PatrykM11 avatar Sep 01 '22 09:09 PatrykM11

Hi @PatrykM11 I have to take a look at your schema first for more details. Could you sign up with free Cloud deployment where it can be reproduced so we can take a closer look there?

ivan-vdovin avatar Sep 01 '22 10:09 ivan-vdovin

I'm new to BI tools like this but I think that I can't use Cloud with locally hosted database. Anyway thanks for contact I can paste some screenshots of my schema if it can help with anything.

Postgres Postgres

Generating Generating

Dimensions Dimensions

Measures Measures

PatrykM11 avatar Sep 01 '22 13:09 PatrykM11

Could you share schema files to I can make sure they are defined there?

ivan-vdovin avatar Sep 06 '22 17:09 ivan-vdovin

Hi @PatrykM11 How many of these fields are numbers ?

From my understanding, the cube schema compiler only generates string dimensions and do not specify which is a primary key automatically.

davidfrisch avatar Sep 10 '22 22:09 davidfrisch

All missing columns are numerical, among those I can see, there is 1 numerical column.

Schema file look like this (missing columns are not defined).

cube(Iowa, { sql: SELECT * FROM public.iowa,

preAggregations: { // Pre-Aggregations definitions go here // Learn more here: https://cube.dev/docs/caching/pre-aggregations/getting-started
},

joins: {

},

measures: { count: { type: count, drillMembers: [categoryName, datea, storeName, city] },

stateBottleCost: {
  sql: `state_bottle_cost`,
  type: `sum`
}

},

dimensions: { county: { sql: county, type: string },

categoryName: {
  sql: `category_name`,
  type: `string`
},

itemNumber: {
  sql: `item_number`,
  type: `string`
},

itemDescription: {
  sql: `item_description`,
  type: `string`
},

invoice: {
  sql: `invoice`,
  type: `string`
},

datea: {
  sql: `datea`,
  type: `string`
},

storeName: {
  sql: `store_name`,
  type: `string`
},

city: {
  sql: `city`,
  type: `string`
}

},

dataSource: default });

PatrykM11 avatar Sep 11 '22 08:09 PatrykM11

Okay, so my hypothesis was correct.

Schema builder only generates automatically fields that are strings and will add the dimension of the primary key regardless it's type (however, you'll still have to add primarKey: true in the dimension object.

Until there's an improvement in the schema-compiler, you'll have to do it manually or do your own automation.

Please correct me @ivan-vdovin if I'm wrong ?

davidfrisch avatar Sep 11 '22 21:09 davidfrisch

Okay, thank you

PatrykM11 avatar Sep 12 '22 16:09 PatrykM11