Python多维数据集Olap框架切片器Model.json

2024-05-06 00:42:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用cubes OLAP框架和切片器服务器进行多维分析,我的model.json在维度、映射和连接的概念方面存在问题

我正在使用Postgres数据库,它包含一个事实表和维度表。 这是我的代码和我的数据库模式,请帮助我的概念或文档或任何对我有帮助的东西

{
"dimensions": [
    {
        "name": "departement",
        "levels": [
            {
                "name": "id_departement",
                "label": "Id_departement",
                "attributes": [
                    "id_departement"
                ]
            },
            {
                "name": "Nom",
                "label": "Nom",
                "attributes": [
                    "Nom"
                ]
            }
        ]
    },
    {
        "name": "clients",
        "levels": [
            {
                "name": "id_client",
                "label": "Id_client",
                "attributes": [
                    "id_client","Nom","Prenom","profession","degre_d_importance","type_interne_externe","I_age_ans_"
                ]
            }
            
           
            
           
            

        ]
    },
    {
        "name": "domaine_informatique",
        "levels": [
            {
                "name": "id_domaine_application",
                "label": "Id_domaine_application",
                "attributes": [
                    "id_domaine_application","Non_service_informatique"
                ]
            }
        ]
    },
    {
        "name": "temps",
        "levels": [
         {
                "name": "id_temps",
                "label": "Id_temps",
                "attributes": [
                    "id_temps","date_paiment"
                ]
            },
        
            {
                "name": "jours",
                "label": "jours",
                "attributes": [
                    "jours"
                ]
            },
            {
                "name": "mois",
                "label": "mois",
                "attributes": [
                    "mois"
                ]
            },
            {
                "name": "annees",
                "label": "annees",
                "attributes": [
                    "annees"
                ]
            }
        ]
    }
],
"cubes": [
    {
        "name": "fact_table_service_info",
        "dimensions": [
            "departement",
            "clients",
            "domaine_informatique",
            "temps"
        ],
        "measures": [
            {
                "name": "nbr_client",
                "label": "Nbr_client"
            },
            {
                "name": "gains",
                "label": "Gains"
            }
        ],
        "aggregates": [
            {
                "name": "Nbr_client",
                "function": "count",
                "measure": "nbr_client"
            },
            {
                "name": "Gains",
                "function": "sum",
                "measure": "gains"
            }
        ],
         "mappings": {
                      "departement.Id_departement": "dim_departement.id_departement",
                      "departement.Nom": "dim_departement.Nom",
                      "clients.id_client": "dim_clients.id_client",
                      "clients.Nom": "dim_clients.Nom",
                      "clients.Prenom": "dim_clients.Prenom",
                      "clients.profession": "dim_clients.profession",
                      "clients.degre_d_importance": "dim_clients.degre_d_importance",
                      "clients.type_interne_externe": "dim_clients.type_interne_externe",
                      "clients.I_age_ans_": "dim_clients.I_age_ans_",
                      "domaine_informatique.id_domaine_application": "dim_domaine_informatique.id_domaine_application",
                      "domaine_informatique.Non_service_informatique": "dim_domaine_informatique.Non_service_informatique",
                      "temps.date_paiment": "dim_temps.date_paiment",
                      "temps.id_temps":"dim_temps.id_temps",
                      "temps.jours": "dim_temps.jours",
                      "temps.mois": "dim_temps.mois",
                      "temps.annees": "dim_temps.annees",
                      "fact_table_service_info.nbr_client": "nbr_client",
                      "fact_table_service_info.gains": "gains"
                     },
                     "joins": [
            {
                "master": "fact_table_service_info.id_temps",
                "detail": "dim_temps.id_temps"
            },
            {
                "master": "fact_table_service_info.id_departement",
                "detail": "dim_departement.id_departement"
            },
            {
               "master": "fact_table_service_info.id_domaine_application",
                "detail": "dim_domaine_informatique.id_domaine"
            },
            {
               "master": "fact_table_service_info.id_clients",
                "detail": "dim_clients.id_client"
            }
            
        ]
                     
                                 
        
    }
]

}

start schema of my database