cube-js/cube

Data model generation with postgres and numeric types

Open

#8 149 ouverte le 15 avr. 2024

Voir sur GitHub
 (2 commentaires) (0 réactions) (0 assignés)Rust (1 965 forks)batch import
driver:postgreshelp wanted

Métriques du dépôt

Stars
 (19 563 stars)
Métriques de merge PR
 (Merge moyen 5j 16h) (138 PRs mergées en 30 j)

Description

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

Guide contributeur