Skip to content

cubes.errors.MappingError:Unable to find detail key (schema None) "date"."id" #497

@JoshuaFaber

Description

@JoshuaFaber

Hi everyone,
my project group and I are recently using cubes and cubes-viewer for a project at university. Our aim is to develop a model in cubes and use the cubes-viewer for data representation. The data is already loaded in a SQL DB and we have created a first model.json for testing (which is valide referring to the model validator from cubes). The cubes-viewer can load this cube, but whenever we select any dimension a cubes.errors.MappingError:Unable to find detail key (schema None) "date"."id" occurs.

This is our model.json:

{
    "cubes": [
        {
            "name": "bookings",
            "label": "booking",
            
            "dimensions": [
                "date"
            ],
            "mappings":
                {
                    "price_total": "bookings.price",
                    "date.id":"date.date_id",
                    "date.year": "date.year",
                    "date.month":"date.month",
                    "date.day":"date.day"
                    
                }        
            ,
            "measures": [
                { "name": "price_total" }
            ],
            "aggregates": [
            
                {
                    "name": "price_total_sum",
                    "label": "Total Price",
                    "function": "sum",
                    "measure": "price_total"
                },
                {
                    "name": "price_total_avg",
                    "label": "Average Price",
                    "function": "avg",
                    "measure": "price_total"
                },
                {
                    "name": "price_total_max",
                    "label": "Maximum Price",
                    "function": "max",
                    "measure": "price_total"
                },
                {
                    "name": "price_total_min",
                    "label": "Minimum Price",
                    "function": "min",
                    "measure": "price_total"
                }
            ],
            "joins":[
                
                {
                    "master":"bookings.date_id",
                    "detail":"date.id",
                    "alias":"date"
                }
            ]
        }
    ],
    "dimensions": [
        {
             
            "name": "date", 
            "label": "Date", 
            
            "role": "time",

            "levels": [
                {
                    "name": "year", 
                    "key":"year",
                    "label": "Year",
                    "attributes":[
                        "year"
                    ]
                },
                {
                    "name": "month", 
                    "label": "Month",
                    "key":"month",
                    "attributes":[
                        "month"
                    ]
                }, 
                {
                    "name": "day", 
                    "label": "Day",
                    "key":"day",
                    "attributes":[
                        "day"
                    ]
                }
            ], 
            "hierarchies": [
                {
                    "name": "daily", 
                    "label": "Daily",
                    "levels": ["year", "month", "day"]
                }, 
                {
                    "name": "monthly", 
                    "label": "Monthly",
                    "levels": ["year", "month"]
                }
            ]
        }
    ]
}

In the SQL DB there are two tables with the attributes:

  • bookings (attributes: price, date_id)

  • date (attributes: date_id, day, month, year)

Actually, for the project we will need more dimensions, but they did not work either, so we tried to reduce the model at first in order to test it. We tried to orientate our model on the examples, especially the workshop-example, but we could not solve this error.
As we are really beginners with cubes, maybe the sollution is very simple, but we have overseen it.
We hope anyone could help us.

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions