Skip to content

Data model generation with postgres and numeric types #8149

@mealonso

Description

@mealonso

Hi cube.js devs!

Using cube version 0.35.6, I am traying to generate a model for a postgres database using the playground. When generating model for tables with numeric types, ie:

onln=# \d acm_coin_in_statistics2
                      Table "public.acm_coin_in_statistics2"
        Column         |           Type           | Collation | Nullable | Default
-----------------------+--------------------------+-----------+----------+---------
 device_id             | numeric(10,0)            |           | not null |
 game_id               | numeric(5,0)             |           | not null |
 statistics_date       | timestamp with time zone |           | not null |
 hour_00               | numeric(10,0)            |           |          |
 hour_01               | numeric(10,0)            |           |          |
...
Indexes:
    "acm_coin_in_statistics2_pk" PRIMARY KEY, btree (device_id, game_id, statistics_date)

dimension for numeric values are generated as strings and primary key is not extracted correctly. If I use other data types (for example, integer, everithing works fine)

cubes:
  - name: acm_coin_in_statistics
    sql_table: public.acm_coin_in_statistics
    data_source: default

    joins: []

    dimensions:
      - name: game_id
        sql: game_id
        type: string

      - name: device_id
        sql: device_id
        type: string
		
      - name: statistics_date
        sql: statistics_date
        type: time

      - name: hour_02
        sql: hour_02
        type: string
		
	  - name: hour_01
        sql: hour_01
        type: string

Is this the expected behaviour of the current version?

Thank you in advance!
Miguel

Metadata

Metadata

Assignees

No one assigned

    Labels

    driver:postgresIssues relating to the Postgres driverhelp wantedCommunity contributions are welcome.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions