From 5a1c06a19b68a75cec8e78c7273ef18d35db287d Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 18 Oct 2010 17:04:07 +0200 Subject: [PATCH] [REM] olap*: removal of olap modules, to be moved to extra-addons until after v6.0 bzr revid: odo@openerp.com-20101018150407-tqyokbfybb6lhr3i --- addons/olap/__init__.py | 23 - addons/olap/__openerp__.py | 52 - addons/olap/cli/Makefile | 69 - addons/olap/cli/tinybi.py | 86 - addons/olap/cube/__init__.py | 3 - addons/olap/cube/agregator.py | 9 - addons/olap/cube/axis.py | 43 - addons/olap/cube/axis_map.py | 109 - addons/olap/cube/common.py | 109 - addons/olap/cube/cross.py | 32 - addons/olap/cube/cube.py | 24 - addons/olap/cube/datatype.py | 8 - addons/olap/cube/formatstring.py | 8 - addons/olap/cube/level.py | 322 --- addons/olap/cube/levels/__init__.py | 3 - addons/olap/cube/levels/level_date.py | 109 - addons/olap/cube/levels/level_interface.py | 14 - addons/olap/cube/levels/level_normal.py | 32 - addons/olap/cube/mdx_input/__init__.py | 1 - addons/olap/cube/mdx_input/mdx_input.py | 5 - addons/olap/cube/mdx_operator.py | 35 - addons/olap/cube/mdx_output/__init__.py | 1 - addons/olap/cube/mdx_output/mdx_output.py | 56 - addons/olap/cube/mdx_parser.py | 201 -- addons/olap/cube/measure.py | 84 - addons/olap/cube/query.py | 236 -- addons/olap/cube/slicer.py | 42 - addons/olap/cube/warehouse.py | 270 -- addons/olap/data/olap_cube_view.xml | 682 ----- addons/olap/data/olap_cube_workflow.xml | 70 - addons/olap/data/olap_data.xml | 5 - addons/olap/data/olap_demo.xml | 171 -- addons/olap/data/olap_fact_view.xml | 339 --- addons/olap/data/olap_security.xml | 155 -- addons/olap/data/olap_view.xml | 69 - addons/olap/data/olap_wizard.xml | 44 - addons/olap/i18n/de.po | 1399 ----------- addons/olap/i18n/es.po | 1406 ----------- addons/olap/i18n/es_EC.po | 1406 ----------- addons/olap/i18n/et.po | 1400 ----------- addons/olap/i18n/fr.po | 1402 ----------- addons/olap/i18n/fr_BE.po | 1370 ---------- addons/olap/i18n/hr.po | 1399 ----------- addons/olap/i18n/it.po | 1436 ----------- addons/olap/i18n/nl.po | 1399 ----------- addons/olap/i18n/oc.po | 1399 ----------- addons/olap/i18n/olap.pot | 1370 ---------- addons/olap/i18n/pl.po | 1423 ----------- addons/olap/i18n/sl.po | 1400 ----------- addons/olap/i18n/sv.po | 1401 ----------- addons/olap/olap.py | 2214 ----------------- addons/olap/security/ir.model.access.csv | 2 - addons/olap/test/olap_test00.yml | 111 - addons/olap/wizard/__init__.py | 27 - addons/olap/wizard/olap_load_column.py | 57 - addons/olap/wizard/olap_load_column_view.xml | 39 - addons/olap/wizard/olap_query_logs_clear.py | 74 - .../wizard/olap_query_logs_clear_view.xml | 52 - .../wizard/wizard_load_configured_table.py | 61 - addons/olap/wizard/wizard_load_data.py | 401 --- addons/olap/wizard/wizard_query_builder.py | 231 -- addons/olap/wizard/wizard_test_connection.py | 52 - addons/olap_crm/__init__.py | 22 - addons/olap_crm/__openerp__.py | 37 - addons/olap_crm/i18n/de.po | 31 - addons/olap_crm/i18n/es.po | 34 - addons/olap_crm/i18n/es_EC.po | 34 - addons/olap_crm/i18n/fr.po | 34 - addons/olap_crm/i18n/fr_BE.po | 29 - addons/olap_crm/i18n/hr.po | 34 - addons/olap_crm/i18n/id.po | 31 - addons/olap_crm/i18n/it.po | 34 - addons/olap_crm/i18n/mn.po | 42 - addons/olap_crm/i18n/oc.po | 31 - addons/olap_crm/i18n/olap_crm.pot | 29 - addons/olap_crm/i18n/pl.po | 31 - addons/olap_crm/i18n/pt_BR.po | 34 - addons/olap_crm/i18n/sk.po | 34 - addons/olap_crm/i18n/sl.po | 34 - addons/olap_crm/olap_crm.xml | 462 ---- addons/olap_crm/olap_data.xml | 5 - addons/olap_extract/__init__.py | 23 - addons/olap_extract/__openerp__.py | 37 - addons/olap_extract/i18n/bg.po | 59 - addons/olap_extract/i18n/de.po | 56 - addons/olap_extract/i18n/es.po | 59 - addons/olap_extract/i18n/es_EC.po | 59 - addons/olap_extract/i18n/et.po | 56 - addons/olap_extract/i18n/fr.po | 59 - addons/olap_extract/i18n/fr_BE.po | 54 - addons/olap_extract/i18n/hr.po | 59 - addons/olap_extract/i18n/id.po | 56 - addons/olap_extract/i18n/it.po | 59 - addons/olap_extract/i18n/oc.po | 56 - addons/olap_extract/i18n/olap_extract.pot | 54 - addons/olap_extract/i18n/pt_BR.po | 59 - addons/olap_extract/i18n/ru.po | 56 - addons/olap_extract/i18n/sl.po | 56 - addons/olap_extract/i18n/sv.po | 56 - addons/olap_extract/i18n/zh_CN.po | 56 - addons/olap_extract/olap_extract_wizard.xml | 12 - addons/olap_extract/wizard_olap_extract.py | 249 -- addons/olap_sale/__init__.py | 22 - addons/olap_sale/__openerp__.py | 37 - addons/olap_sale/i18n/de.po | 31 - addons/olap_sale/i18n/es.po | 34 - addons/olap_sale/i18n/es_EC.po | 34 - addons/olap_sale/i18n/fr.po | 34 - addons/olap_sale/i18n/fr_BE.po | 29 - addons/olap_sale/i18n/hr.po | 34 - addons/olap_sale/i18n/it.po | 34 - addons/olap_sale/i18n/olap_sale.pot | 29 - addons/olap_sale/i18n/pt_BR.po | 34 - addons/olap_sale/i18n/ro.po | 34 - addons/olap_sale/i18n/sk.po | 34 - addons/olap_sale/i18n/sl.po | 34 - addons/olap_sale/olap_data.xml | 5 - addons/olap_sale/olap_sale.xml | 725 ------ 118 files changed, 29948 deletions(-) delete mode 100644 addons/olap/__init__.py delete mode 100644 addons/olap/__openerp__.py delete mode 100755 addons/olap/cli/Makefile delete mode 100644 addons/olap/cli/tinybi.py delete mode 100644 addons/olap/cube/__init__.py delete mode 100644 addons/olap/cube/agregator.py delete mode 100644 addons/olap/cube/axis.py delete mode 100644 addons/olap/cube/axis_map.py delete mode 100644 addons/olap/cube/common.py delete mode 100644 addons/olap/cube/cross.py delete mode 100644 addons/olap/cube/cube.py delete mode 100644 addons/olap/cube/datatype.py delete mode 100644 addons/olap/cube/formatstring.py delete mode 100644 addons/olap/cube/level.py delete mode 100644 addons/olap/cube/levels/__init__.py delete mode 100644 addons/olap/cube/levels/level_date.py delete mode 100644 addons/olap/cube/levels/level_interface.py delete mode 100644 addons/olap/cube/levels/level_normal.py delete mode 100644 addons/olap/cube/mdx_input/__init__.py delete mode 100644 addons/olap/cube/mdx_input/mdx_input.py delete mode 100644 addons/olap/cube/mdx_operator.py delete mode 100644 addons/olap/cube/mdx_output/__init__.py delete mode 100644 addons/olap/cube/mdx_output/mdx_output.py delete mode 100644 addons/olap/cube/mdx_parser.py delete mode 100644 addons/olap/cube/measure.py delete mode 100644 addons/olap/cube/query.py delete mode 100644 addons/olap/cube/slicer.py delete mode 100644 addons/olap/cube/warehouse.py delete mode 100644 addons/olap/data/olap_cube_view.xml delete mode 100644 addons/olap/data/olap_cube_workflow.xml delete mode 100644 addons/olap/data/olap_data.xml delete mode 100644 addons/olap/data/olap_demo.xml delete mode 100644 addons/olap/data/olap_fact_view.xml delete mode 100644 addons/olap/data/olap_security.xml delete mode 100644 addons/olap/data/olap_view.xml delete mode 100644 addons/olap/data/olap_wizard.xml delete mode 100644 addons/olap/i18n/de.po delete mode 100644 addons/olap/i18n/es.po delete mode 100644 addons/olap/i18n/es_EC.po delete mode 100644 addons/olap/i18n/et.po delete mode 100644 addons/olap/i18n/fr.po delete mode 100644 addons/olap/i18n/fr_BE.po delete mode 100644 addons/olap/i18n/hr.po delete mode 100644 addons/olap/i18n/it.po delete mode 100644 addons/olap/i18n/nl.po delete mode 100644 addons/olap/i18n/oc.po delete mode 100644 addons/olap/i18n/olap.pot delete mode 100644 addons/olap/i18n/pl.po delete mode 100644 addons/olap/i18n/sl.po delete mode 100644 addons/olap/i18n/sv.po delete mode 100644 addons/olap/olap.py delete mode 100644 addons/olap/security/ir.model.access.csv delete mode 100644 addons/olap/test/olap_test00.yml delete mode 100644 addons/olap/wizard/__init__.py delete mode 100644 addons/olap/wizard/olap_load_column.py delete mode 100644 addons/olap/wizard/olap_load_column_view.xml delete mode 100644 addons/olap/wizard/olap_query_logs_clear.py delete mode 100644 addons/olap/wizard/olap_query_logs_clear_view.xml delete mode 100644 addons/olap/wizard/wizard_load_configured_table.py delete mode 100644 addons/olap/wizard/wizard_load_data.py delete mode 100644 addons/olap/wizard/wizard_query_builder.py delete mode 100644 addons/olap/wizard/wizard_test_connection.py delete mode 100644 addons/olap_crm/__init__.py delete mode 100644 addons/olap_crm/__openerp__.py delete mode 100644 addons/olap_crm/i18n/de.po delete mode 100644 addons/olap_crm/i18n/es.po delete mode 100644 addons/olap_crm/i18n/es_EC.po delete mode 100644 addons/olap_crm/i18n/fr.po delete mode 100644 addons/olap_crm/i18n/fr_BE.po delete mode 100644 addons/olap_crm/i18n/hr.po delete mode 100644 addons/olap_crm/i18n/id.po delete mode 100644 addons/olap_crm/i18n/it.po delete mode 100644 addons/olap_crm/i18n/mn.po delete mode 100644 addons/olap_crm/i18n/oc.po delete mode 100644 addons/olap_crm/i18n/olap_crm.pot delete mode 100644 addons/olap_crm/i18n/pl.po delete mode 100644 addons/olap_crm/i18n/pt_BR.po delete mode 100644 addons/olap_crm/i18n/sk.po delete mode 100644 addons/olap_crm/i18n/sl.po delete mode 100644 addons/olap_crm/olap_crm.xml delete mode 100644 addons/olap_crm/olap_data.xml delete mode 100644 addons/olap_extract/__init__.py delete mode 100644 addons/olap_extract/__openerp__.py delete mode 100644 addons/olap_extract/i18n/bg.po delete mode 100644 addons/olap_extract/i18n/de.po delete mode 100644 addons/olap_extract/i18n/es.po delete mode 100644 addons/olap_extract/i18n/es_EC.po delete mode 100644 addons/olap_extract/i18n/et.po delete mode 100644 addons/olap_extract/i18n/fr.po delete mode 100644 addons/olap_extract/i18n/fr_BE.po delete mode 100644 addons/olap_extract/i18n/hr.po delete mode 100644 addons/olap_extract/i18n/id.po delete mode 100644 addons/olap_extract/i18n/it.po delete mode 100644 addons/olap_extract/i18n/oc.po delete mode 100644 addons/olap_extract/i18n/olap_extract.pot delete mode 100644 addons/olap_extract/i18n/pt_BR.po delete mode 100644 addons/olap_extract/i18n/ru.po delete mode 100644 addons/olap_extract/i18n/sl.po delete mode 100644 addons/olap_extract/i18n/sv.po delete mode 100644 addons/olap_extract/i18n/zh_CN.po delete mode 100644 addons/olap_extract/olap_extract_wizard.xml delete mode 100644 addons/olap_extract/wizard_olap_extract.py delete mode 100644 addons/olap_sale/__init__.py delete mode 100644 addons/olap_sale/__openerp__.py delete mode 100644 addons/olap_sale/i18n/de.po delete mode 100644 addons/olap_sale/i18n/es.po delete mode 100644 addons/olap_sale/i18n/es_EC.po delete mode 100644 addons/olap_sale/i18n/fr.po delete mode 100644 addons/olap_sale/i18n/fr_BE.po delete mode 100644 addons/olap_sale/i18n/hr.po delete mode 100644 addons/olap_sale/i18n/it.po delete mode 100644 addons/olap_sale/i18n/olap_sale.pot delete mode 100644 addons/olap_sale/i18n/pt_BR.po delete mode 100644 addons/olap_sale/i18n/ro.po delete mode 100644 addons/olap_sale/i18n/sk.po delete mode 100644 addons/olap_sale/i18n/sl.po delete mode 100644 addons/olap_sale/olap_data.xml delete mode 100644 addons/olap_sale/olap_sale.xml diff --git a/addons/olap/__init__.py b/addons/olap/__init__.py deleted file mode 100644 index 8e5f0dfc12c..00000000000 --- a/addons/olap/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -import olap -import wizard diff --git a/addons/olap/__openerp__.py b/addons/olap/__openerp__.py deleted file mode 100644 index 76d119322e2..00000000000 --- a/addons/olap/__openerp__.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -{ - "name" : "Olap Schemes Management", - "version" : "0.1", - "author" : "OpenERP SA", - "website" : "http://www.openerp.com", - "depends" : ["base"], - "category" : "Generic Modules/Olap", - "description": """ - Olap module is used to install BI module in client. Olap provides Online - Analytical Process with the mdx query. BI provides Cube Browsing and - Cube Designing. After installing Olap Module you will get Cube Browser - and Cube Desinger in Reporting Menu. Cube Browser is used to generate - the reports with table view (mdx view) of mdx query. and Cube designer - is used to make cubes in BI.. - """, - "init_xml" : ["data/olap_data.xml"], - "update_xml" : [ - "wizard/olap_query_logs_clear_view.xml", - "wizard/olap_load_column_view.xml", - "data/olap_wizard.xml", - "data/olap_view.xml", - "data/olap_cube_view.xml", - "data/olap_fact_view.xml", - "data/olap_cube_workflow.xml", - "data/olap_security.xml", - 'security/ir.model.access.csv' - ], - "demo_xml" : ["data/olap_demo.xml"], - "active": False, - "installable": True -} diff --git a/addons/olap/cli/Makefile b/addons/olap/cli/Makefile deleted file mode 100755 index dd44a2c1289..00000000000 --- a/addons/olap/cli/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -DATABASE = 'bi' - -all: simple sale date where sublevels calc_meas cross page complex test - -simple: - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[User].[all]} on rows, {[measures].[Credit Limit],[measures].[Count]} on columns from Partner" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[measures].[Credit Limit],[measures].[Count]} on rows, {[User].[all],[User].children} on columns from Partner" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[User].children} on rows from Partner" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[User].[all],[User].children} on rows, {[measures].[Credit Limit],[measures].[Count]} on columns from Partner" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[User].children} on rows, {[User].children} on columns from Partner where ([measures].[Count])" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[User].children} on rows, {[measures].[Count]} on columns from Partner where ([User].[3])" -# ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[Date].[2008]} on rows, {[measures].[Credit Limit],[measures].[Count]} on columns from Partner" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c "select {[Date].[all],[Date].children} on rows, {[measures].[Credit Limit],[measures].[Count]} on columns from Partner" - -sale: - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Partner Country].children} on rows from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].children} on rows from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].children,[City].[Paris].children,[Partner Country].children} on rows, {[measures].[Total Sales]} on columns from Sales" - - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].[all],[Order Date].children,[Users].children} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].children, [Order Date].[all]} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales" - - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Partner Country].children} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Partner Country].[China]} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Partner Country].[Belgium]} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales" - -date: - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].children} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].[2007]} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].[2008]} on rows, {[measures].[Average Sales],[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].children,[Order Date].[2008].children,[Order Date].[2008].[Q2].children} on rows, {[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Order Date].children,[Order Date].[2008].children,[Order Date].[2008].[Q2].children} on rows, {[measures].[Total Sales]} on columns from Sales where ([Order Date].[2008].[Q2])" - -where: - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c " select crossjoin (crossjoin ({[Order Date].[all],[Users].[all]} , {[Users].children} ) , {[Partner Country].[all]}) on rows, {[measures].[Units Sold]} on columns from Sales" -sublevels: - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all],[City].children} on rows, {[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all],[City].children} on rows, {[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all],[City].children,[City].[Liege].children} on rows, {[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Products Category].[all],[Products Category].children} on rows, {[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[Products Category].[all],[Products Category].children,[Products Category].[PC].children} on rows, {[measures].[Total Sales]} on columns from Sales" - -calc_meas: - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all]} on rows, {[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all],[City].children} on rows, {[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all],[City].children} on rows, {[measures].[Units Sold],[measures].[Total Sales]} on columns from Sales" - -cross: - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin ({[Order Date].[all],[Order Date].children} , {[All Products].[all]}) on rows from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin({[City].[all]},{[Users].[all]}) on rows, {[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin({[City].[all],[Users].[all]},{[Order Date].[all]}) on rows, {[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin({[City].[all],[City].children},{[Order Date].children}) on rows, {[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin(crossjoin({[City].[all],[City].children},{[Users].children}),{[Order Date].children}) on rows, {[measures].[Total Sales]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin(crossjoin({[City].[all],[City].children},{[Users].children}),{[Order Date].children}) on rows, {[measures].[Total Sales],[measures].[Units Sold]} on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin(crossjoin({[City].[all],[Users].[all]},{[Order Date].[all]}),{[Order Date].children}) on rows, crossjoin({[All Products].[all],[Products Category].[all]},{[Partner Country].children}) on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin({[City].[all]},{[Users].[all]}) on rows, crossjoin({[measures].[Total Sales]},{[Order Date].children}) on columns from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin({[City].[all]},{[Users].[all]}) on rows, crossjoin(crossjoin({[measures].[Total Sales]},{[Order Date].children}),{[Users].children}) on columns from Sales" - -page: - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[City].[all],[City].children} on rows, {[measures].[Units Sold],[measures].[Total Sales]} on columns, {[Order Date].children} on pages from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select {[measures].[Units Sold],[measures].[Total Sales]} on rows, {[City].[all],[City].children} on columns, {[Order Date].children} on pages from Sales" - -complex: - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin({[City].[all],[City].children},{[Order Date].[all]}) on rows, {[measures].[Units Sold],[measures].[Total Sales]} on columns, {[Order Date].children} on pages from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin(crossjoin({[City].[all],[City].children},{[Order Date].children}),{[Users].children}) on rows, {[measures].[Units Sold],[measures].[Total Sales]} on columns, {[Order Date].children} on pages from Sales" - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "OpenERPSales" -c "select crossjoin(crossjoin({[City].[all],[City].children},{[Order Date].children}),{[Users].children}) on rows, crossjoin({[measures].[Units Sold],[measures].[Total Sales]},{[City].children}) on columns, {[Order Date].children} on pages from Sales" - -test: - ./tinybi.py -d ${DATABASE} -H localhost -U admin -W admin -p 8069 -s "tinyerp" -c " select crossjoin (crossjoin ({[Order Date].[all],[Users].[all]} , {[Users].children} ) , {[Partner Country].[all]}) on rows, {[measures].[Units Sold]} on columns from Sales" \ No newline at end of file diff --git a/addons/olap/cli/tinybi.py b/addons/olap/cli/tinybi.py deleted file mode 100644 index ec31232110d..00000000000 --- a/addons/olap/cli/tinybi.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/python - -############################################################################## -# -# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved. -# Fabien Pinckaers -# -# WARNING: This program as such is intended to be used by professional -# programmers who take the whole responsability of assessing all potential -# consequences resulting from its eventual inadequacies and bugs -# End users who are looking for a ready-to-use solution with commercial -# garantees and support are strongly adviced to contract a Free Software -# Service Company -# -# This program is Free Software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -############################################################################## - -# -# This module test all RPC methods -# - -import optparse - -import xmlrpclib -import time - -__version__ = '1.0' - -parser = optparse.OptionParser(version=__version__) - -group = optparse.OptionGroup(parser, "General options") -group.add_option("-c", "--command", dest="command", help="The query to execute") -group.add_option("-s", "--schema", dest="schema", help="The schema to use for the query") -parser.add_option_group(group) - -group = optparse.OptionGroup(parser, "Connection options") -group.add_option("-d", "--database", dest="database", help="Database name") -group.add_option("-H", "--hostname", dest="hostname", default='localhost', help="Server hostname") -group.add_option("-U", "--username", dest="username", default='admin', help="Username") -group.add_option("-W", "--password", dest="password", default='admin', help="Password") -group.add_option("-p", "--port", dest="port", default=8069, help="Server port") -parser.add_option_group(group) - -(opt, args) = parser.parse_args() - -sock = xmlrpclib.ServerProxy('http://'+opt.hostname+':'+str(opt.port)+'/xmlrpc/object') -uid = 1 - -axis,data = sock.execute(opt.database, uid, opt.password, 'olap.schema', 'request', opt.schema, opt.command) -COLSPAN = 18 -ROWSPAN = 18 - -print -if len(axis)>1: - for i in range(8): - ok = False - for x in axis[1]: - if len(x[0])==i: - ok = True - if not ok: - continue - print ' '*COLSPAN, - print (('%-'+str(ROWSPAN)+'s ' ) * len(axis[1])) % tuple(map(lambda x: str(len(x[0])==i and x[1] or ''),axis[1])) -for col in data: - print ('%-'+str(COLSPAN)+'s')% (' '*(len(axis[0][0][0])-1)*2 + str(axis[0].pop(0)[1]),), - for row in col: - if row==[False]: - print ('%-'+str(ROWSPAN)+'s')%('',), - else: - print ('%-'+str(ROWSPAN)+'s')%(row,), - print -print - diff --git a/addons/olap/cube/__init__.py b/addons/olap/cube/__init__.py deleted file mode 100644 index 79c50e6422d..00000000000 --- a/addons/olap/cube/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from mdx_parser import mdx_parser -from mdx_output import mdx_output -from warehouse import warehouse diff --git a/addons/olap/cube/agregator.py b/addons/olap/cube/agregator.py deleted file mode 100644 index 27cede990f2..00000000000 --- a/addons/olap/cube/agregator.py +++ /dev/null @@ -1,9 +0,0 @@ -import sqlalchemy - -agregator = {} -agregator['sum'] = sqlalchemy.func.sum -agregator['count'] = sqlalchemy.func.count -agregator['avg'] = sqlalchemy.func.avg -agregator['min'] = sqlalchemy.func.min -agregator['max'] = sqlalchemy.func.max - diff --git a/addons/olap/cube/axis.py b/addons/olap/cube/axis.py deleted file mode 100644 index 6bff19b49cd..00000000000 --- a/addons/olap/cube/axis.py +++ /dev/null @@ -1,43 +0,0 @@ - -import sqlalchemy -import common - - - -class axis(object): - def __init__(self, axis, name=None): - self.axis = axis - self.name = name - - def validate(self, cube): - self.object = cube - self.axis.validate(cube) - - def name_set(self, name): - self.name = name - - def __repr__(self): - res = '\tself.object.dimension_id.cube_id.table_id: # Add a condition on the object - result = self._run_transform(metadata) - else: - result = self._run_star(metadata) - return result - - def _compute_axis(self, metadata, primarykey=False): - """ - Compute axis values, and transform the main query in the same way - to add this branch of the star for this subset. The mappers - reassign to values. - """ - - # - # Build a query on all tables of the hierarchy - # It passes the hierarchy table_id browse object (olap_cube_table ) - # - table = common.table_get(metadata, self.object.table_id) - # - # Implement the query for all sublevels - # Return: - # [ (ID1, ID2, ID3, NAME, [PRIMARYKEY]) ] - # - result_axis = {} - for slevel in self.sublevels: - res = slevel.run(metadata, table) - for key in res.keys(): - result_axis.setdefault(key, []) - result_axis[key] += res[key] - cols = [] - axis_select = sqlalchemy.select(from_obj=[table], columns=[], distinct=True) - for where in result_axis.get('where_clause', []): - axis_select.append_whereclause(where) - for col in result_axis.get('column', []): - axis_select.append_column(col) - for group in result_axis.get('group_by', []): - axis_select.append_group_by(group) - # TODO: find a way to do: axis_select2 = axis_select.copy() - axis_select2 = sqlalchemy.select(from_obj=[table], columns=[], distinct=True) - for where in result_axis.get('where_clause', []): - axis_select2.append_whereclause(where) - for col in result_axis.get('column', []): - axis_select2.append_column(col) - for group in result_axis.get('group_by', []): - axis_select2.append_group_by(group) - # TODO: end - #metadata.bind.echo = True - axis_select2.append_column(result_axis['column_name'][-1].label('axis_name')) - query = axis_select2.execute() - result = query.fetchall() - - def _tuple_define(x): - y=list(x) - if y[-1] == None: - y[-1] = '/' - elif isinstance(y[-1],float): - y[-1] = str (int(y[-1])) - else: - y[-1] = self._to_unicode(y[-1]) - y[-1] = tools.ustr(y[-1]) - return ([self.level]+y[:-1]),y[-1] - - axis = map(_tuple_define, result) - # Gives the mapping - - primary_key = '' - if primarykey: - if self.object.table_id.column_link_id.related_to: - primary_key = self.object.table_id.column_link_id.related_to - else: - primary_key = self.object.table_id.column_link_id.table_id - tableprim = sqlalchemy.Table(primary_key.table_db_name, metadata) - pk = common.get_primary_key(primary_key) - col = common.col_get(tableprim,pk) - axis_select.append_column(col.label('axis_primarykey')) - query = axis_select.execute() - result = query.fetchall() - else: - # To find the primary key that suits best as per the given criteria - raise 'Primary key table not made in the hierarchy' - - maps = [] - position =0 - for mapping in result_axis['axis_mapping']: - mapinst = mapping(result, position) - maps.append(mapinst) - position += mapinst.position_get() - result_axis['axis_mapping'] = maps -# -# # -# # Apply the filters on the main query object due to this block -# # -# -# maps = [] -# position =0 -# for mapping in result_axis['axis_mapping']: -# mapinst = mapping(result, position) -# maps.append(mapinst) -# position += mapinst.position_get() -# result_axis['axis_mapping'] = maps -# print '*'*50 -# print table, result, result_axis - return table, axis, result ,result_axis - - def _run_star(self, metadata): - """ - Compute axis values, and transform the main query in the same way - to add this branch of the star for this subset. The mappers - reassign to values. - """ - print '*** Start ***' - table, result,result_mapping, result_axis = self._compute_axis(metadata, True) - result_axis.setdefault('where_clause', []) - # - # The result to be applied to the main query object - # - result = { - 'value': result, - 'query': { -# 'whereclause': result_axis.get('where_clause',[]), - 'column': result_axis.get('column', []), - 'group_by': result_axis.get('column', []) - }, - ## - ## How to use group of axis_mapping ? - ## - 'axis_mapping': axis_map.column_static(False), - 'delta':0, - } - return [result] - - def _run_transform(self, metadata): - """ - Compute axis values, and transform the main query according to axis - values for this subset. The main query slicer is transformed to a - single condition like: foreign_key in (...) and reapplied to axis - values. - """ - - table, axis, mapping, result_axis = self._compute_axis(metadata, True) - table2 = common.table_get(metadata, self.object.dimension_id.cube_id.table_id) - sql_table = sqlalchemy.Table(self.object.table_id.column_link_id.table_id.table_db_name,metadata) - col = common.col_get(sql_table, self.object.table_id.column_link_id) - - # - # The result to be applied to the main query object - # - - result = [] - for a in axis: - k = tuple(list(a)[0][1:]) - mapping_axis = filter(lambda m: tuple(list(m)[:-1])==k, mapping) - primary_keys = map(lambda x:list(x)[-1], mapping_axis) - # To convert everything in to the string so that no conversion needed at later stage - # This is for the elements to be displayed in the rows and columns - for i in range(len(a[0])): - if a[0][i]: - if isinstance(a[0][i],int): - a[0][i] = str(a[0][i]) - elif isinstance(a[0][i],float): - a[0][i] = str(int(a[0][i])) - else: - a[0][i] = '/' - a = list(a) - if isinstance(a[-1],int): - a[-1] = str(a[-1]) - elif isinstance(a[-1],float): - a[-1] = str(int(a[-1])) - a = tuple(a) - primary_keys = map(lambda x: str(x),primary_keys) - result.append( { - 'value': [a], - 'query': { - - 'whereclause': [col.in_(primary_keys)],#.extend(result_axis['where_clause']), - 'column': [sqlalchemy.literal('transform')], - }, - 'axis_mapping': axis_map.column_static(False), - 'delta':0, - }) - return result - - def __repr__(self): - res= '\t\t' - -class level_function(object): - def __init__(self, name): - self.type='function' - self.name = name - self.object = None - # [{ - # 'level': ["Time","2008","Q1"], - # 'value': '1er Trim 2008', - # 'query': SQLAlchemy query object - # }] - def run(self, metadata, table): - return self.object._types[self.object.type].children( self, metadata, table) - - def validate(self, level): - self.object = level - return 0 - - def __repr__(self): - return '' - -# vim: ts=4 sts=4 sw=4 si et -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/olap/cube/levels/__init__.py b/addons/olap/cube/levels/__init__.py deleted file mode 100644 index ebfef2e83aa..00000000000 --- a/addons/olap/cube/levels/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -import level_interface -from level_normal import level_normal -from level_date import * diff --git a/addons/olap/cube/levels/level_date.py b/addons/olap/cube/levels/level_date.py deleted file mode 100644 index fc6ddb891a3..00000000000 --- a/addons/olap/cube/levels/level_date.py +++ /dev/null @@ -1,109 +0,0 @@ - -import sqlalchemy -from level_interface import level_interface - -from olap.cube import common -from olap.cube import axis_map - -# -# To Be Fixed: -# Mapping of QX and Month -# - -class level_date_month(level_interface): - def run(self, level, metadata, table): - col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - result = { - 'column': [sqlalchemy.func.date_part('month',col_id)], - 'column_name': [sqlalchemy.func.date_part('month', col)], - 'axis_mapping': [axis_map.column_mapping], - 'where_clause': [sqlalchemy.func.date_part('month',col_id) == level.name] - } - return result - - def children(self, level, metadata, table): - col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - qexpr = sqlalchemy.literal('Q')+ sqlalchemy.sql.cast(sqlalchemy.func.date_part('QUARTER',col_id), sqlalchemy.types.String) + sqlalchemy.sql.cast(sqlalchemy.func.date_part('month',col_id),sqlalchemy.types.String) - return { - 'column': [sqlalchemy.func.date_part('month',col)], - 'column_name':[sqlalchemy.func.date_part('month',col)], - 'axis_mapping': [axis_map.column_mapping] - } - - def validate(self, level, name): - - return 1 - -class level_date_year(level_interface): - def run(self, level, metadata, table): - col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata),level.object.column_name) - col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - result = { - 'column': [sqlalchemy.func.date_part('year',col_id)], - 'column_name': [sqlalchemy.func.date_part('year', col)], - 'axis_mapping': [axis_map.column_mapping], - 'where_clause': [sqlalchemy.func.date_part('year',col_id) == level.name] - } - return result - - def children(self, level, metadata, table): - col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - return { - 'column': [sqlalchemy.func.date_part('year',col_id)], - 'column_name':[sqlalchemy.func.date_part('year',col)], - 'axis_mapping': [axis_map.column_mapping], - 'where_clause':[] - } - - def validate(self, level, name): - return 1 - -# -# To Do: Create your own axis mapping -# -class level_date_quarter(level_interface): - - def run(self, level, metadata, table): - quarters = { - 'Q1': [1,2,3], - 'Q2': [4,5,6], - 'Q3': [7,8,9], - 'Q4': [10,11,12] - } - col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - qexpr = sqlalchemy.literal('Q')+ sqlalchemy.sql.cast(sqlalchemy.func.date_part('QUARTER',col_id), sqlalchemy.types.String) - if not level.name in quarters: - raise 'Quarter should be in Q1,Q2,Q3,Q4 !' - - result = { - 'column': [qexpr], - 'column_name': [qexpr], - 'axis_mapping': [axis_map.column_static], - 'where_clause': [ - (sqlalchemy.func.date_part('month',col_id)==quarters[level.name][0]) | - (sqlalchemy.func.date_part('month',col_id)==quarters[level.name][1]) | - (sqlalchemy.func.date_part('month',col_id)==quarters[level.name][2]) - ] - } - return result - - - - def children(self, level, metadata, table): - table = sqlalchemy.Table(level.object.table_name, metadata) - col =common.col_get(table, level.object.column_name) - col_id = common.col_get(table,level.object.column_name) - qexpr = sqlalchemy.literal('Q')+ sqlalchemy.sql.cast(sqlalchemy.func.date_part('QUARTER',col_id), sqlalchemy.types.String) - return { - 'column': [qexpr], - 'column_name': [qexpr], - 'axis_mapping': [axis_map.column_mapping_value] - } - - def validate(self, level, name): - return 1 -# vim: ts=4 sts=4 sw=4 si et diff --git a/addons/olap/cube/levels/level_interface.py b/addons/olap/cube/levels/level_interface.py deleted file mode 100644 index fc73dbc272a..00000000000 --- a/addons/olap/cube/levels/level_interface.py +++ /dev/null @@ -1,14 +0,0 @@ - -class level_interface(object): - # - # Return the number of position consummed by this level - # 1 means this goes to the next level object (.[20]) - # 0 means that the next argument is still on the same level object (.children) - # - def validate(self, level, name): - return 1 - - def run(self, level, metadata, table): - col = None - return {} -# vim: ts=4 sts=4 sw=4 si et diff --git a/addons/olap/cube/levels/level_normal.py b/addons/olap/cube/levels/level_normal.py deleted file mode 100644 index 1c3e860babd..00000000000 --- a/addons/olap/cube/levels/level_normal.py +++ /dev/null @@ -1,32 +0,0 @@ -import sqlalchemy -from olap.cube import common -from olap.cube import axis_map -from level_interface import level_interface - -class level_normal(level_interface): - def run(self, level, metadata, table): - col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - result = { - 'column': [col_id], - 'column_name': [col], - 'axis_mapping': [axis_map.column_mapping], - 'where_clause': [col_id == level.name ] - } - return result - - def children(self, level, metadata, table): - col = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - col_id = common.col_get(sqlalchemy.Table(level.object.table_name,metadata), level.object.column_name) - result = { - 'column': [col_id], - 'column_name': [col], - 'axis_mapping': [axis_map.column_mapping], - 'where_clause': [] - } - return result - - def validate(self, level, name): - return 1 - -# vim: ts=4 sts=4 sw=4 si et diff --git a/addons/olap/cube/mdx_input/__init__.py b/addons/olap/cube/mdx_input/__init__.py deleted file mode 100644 index 8c338cddef2..00000000000 --- a/addons/olap/cube/mdx_input/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from mdx_input import mdx_input diff --git a/addons/olap/cube/mdx_input/mdx_input.py b/addons/olap/cube/mdx_input/mdx_input.py deleted file mode 100644 index 92d6d983a1c..00000000000 --- a/addons/olap/cube/mdx_input/mdx_input.py +++ /dev/null @@ -1,5 +0,0 @@ - -class mdx_input(object): - - def parse(self, mdx): - return mdx diff --git a/addons/olap/cube/mdx_operator.py b/addons/olap/cube/mdx_operator.py deleted file mode 100644 index 92102d88f02..00000000000 --- a/addons/olap/cube/mdx_operator.py +++ /dev/null @@ -1,35 +0,0 @@ -import common - -# -# Class constructed by {..., ...} -# -class mdx_set(object): - def __init__(self, list): - self.list = list - - def run(self, metadata): - """ - Should use xcombine, I think it's currently False - common.xcombine(*result) - """ - result = [] - for l in self.list: - result += l.run(metadata) - position = 0 - for r in result: - r['delta'] = position - position += len(r['value']) - return result - - def validate(self, object): - for l in self.list: - l.validate(object) - return True - - def __repr__(self): - res = '\tSet: [' - for l in self.list: - res += str(l)+',\n' - res += '\t]' - return res -# vim: ts=4 sts=4 sw=4 si et diff --git a/addons/olap/cube/mdx_output/__init__.py b/addons/olap/cube/mdx_output/__init__.py deleted file mode 100644 index 0110b6fe01f..00000000000 --- a/addons/olap/cube/mdx_output/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from mdx_output import * diff --git a/addons/olap/cube/mdx_output/mdx_output.py b/addons/olap/cube/mdx_output/mdx_output.py deleted file mode 100644 index f4708387d0b..00000000000 --- a/addons/olap/cube/mdx_output/mdx_output.py +++ /dev/null @@ -1,56 +0,0 @@ -# -# Modify the final result (axis, data), for instance, reordering of axes -# -import copy - -def decimal_to_float(cube): -# Note FP: I think the decimal > float conversion should be done more -# in upstream - if type(cube)==type([]) and len(cube): - if type(cube[0])==type([]): - for b in cube: - decimal_to_float(b) - else: - for l in range(len(cube)): - cube[l] = str(float(cube[l])) - -def sort_apply(cube, axis_pos): - cube2 = copy.copy(cube) - for i in range(len(axis_pos)): - cube[i] = cube2[axis_pos[i]] - return cube - -def sort_axis(data): - for axis_id in range(len(data[0])): - axis_pos = [] - for i in range(len(data[0][axis_id])): - axis_pos.append((data[0][axis_id][i], i)) - axis_pos.sort() - data[0][axis_id] = map(lambda x: x[0], axis_pos) - axis_pos2 = map(lambda x: x[1], axis_pos) - cubes = [ data[1] ] - for i in range(axis_id): - cubes2 = [] - for cube in cubes: - cubes2 += cube - cubes = cubes2 - for cube in cubes: - sort_apply(cube, axis_pos2) - -def mdx_output(data): - print 'DATA', data -# decimal_to_float(data[1]) -# sort_axis(data) - return data - -if __name__=='__main__': - print 'Testing Code' - data = ([[(['user'], 'All user')], [(['measures', 'credit_limit'], 'credit_limit'), (['measures', 'count'], 'count')]], [[[66700.0], [22L]]]) - data = ([[([u'Products'], u'All Products'), ([u'Order Date'], u'All Order Date')]], [[False], [False]]) - data = ([[([u'Order Date'], u'All Order Date'), ([u'Order Date', 2007.0], 2007.0), ([u'Order Date', 2008.0], 2008.0), ([u'Order Date', 2007.0, 'Q1'], 'Q1'), ([u'Order Date', 2007.0, 'Q2'], 'Q2'), ([u'Order Date', 2007.0, 'Q3'], 'Q3'), ([u'Order Date', 2007.0, 'Q4'], 'Q4'), ([u'Users'], u'All Users'), ([u'Users', 'Administrator'], 'Administrator'), ([u'Users', 'Demo User'], 'Demo User'), ([u'Users', 'Root'], 'Root'), ([u'Partner Country'], u'All Partner Country'), ([u'Partner Country', 'Belgium'], 'Belgium'), ([u'Partner Country', 'China'], 'China'), ([u'Partner Country', 'France'], 'France'), ([u'Partner Country', 'Taiwan'], 'Taiwan')]], [[False], [False], [False], [False], [False], [False], [False], [False], [False], [False], [False], [False], [False], [False], [False], [False]]) - data = ([[([u'Order Date'], u'All Order Date'), ([u'Order Date', 2007.0], 2007.0), ([u'Order Date', 2008.0], 2008.0), ([u'Order Date', 2007.0, 'Q1'], 'Q1'), ([u'Order Date', 2007.0, 'Q2'], 'Q2'), ([u'Order Date', 2007.0, 'Q3'], 'Q3'), ([u'Order Date', 2007.0, 'Q4'], 'Q4'), ([u'Users'], u'All Users'), ([u'Users', 'Administrator'], 'Administrator'), ([u'Users', 'Demo User'], 'Demo User'), ([u'Users', 'Root'], 'Root'), ([u'Partner Country'], u'All Partner Country'), ([u'Partner Country', 'Belgium'], 'Belgium'), ([u'Partner Country', 'China'], 'China'), ([u'Partner Country', 'France'], 'France'), ([u'Partner Country', 'Taiwan'], 'Taiwan')], [(['measures', u'Items Sold'], u'Items Sold')]], [[[Decimal("258.00")]], [[Decimal("34.00")]], [[Decimal("224.00")]], [[Decimal("12.00")]], [[Decimal("9.00")]], [[Decimal("6.00")]], [[Decimal("7.00")]], [[Decimal("258.00")]], [[Decimal("204.00")]], [[Decimal("16.00")]], [[Decimal("38.00")]], [[Decimal("258.00")]], [[Decimal("17.00")]], [[Decimal("78.00")]], [[Decimal("139.00")]], [[Decimal("2.00")]]]) - print 'Old', data - sort_axis(data) - print 'New', data - -# vim: ts=4 sts=4 sw=4 si et diff --git a/addons/olap/cube/mdx_parser.py b/addons/olap/cube/mdx_parser.py deleted file mode 100644 index 76014c91acb..00000000000 --- a/addons/olap/cube/mdx_parser.py +++ /dev/null @@ -1,201 +0,0 @@ -""" -Tiny BI -Copyright (C)2007 Fabien Pinckaers - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -""" - -from pyparsing import * - -import cube, axis, measure, level, query, slicer, cross -import mdx_operator - - -# -# Predicate: the construction of the object's query does not depend -# on the schema architecture. I think we can go on for this, this will -# simplify the extension/module architecture. -# -# Rethink about that in one month. -# - -class mdx_parser(object): - def mdx_level(self): - """ - Return a parser that parse the level part of the MDX query and - return a level object - Examples: - [prod].[all prod].children - [prod].[all prod].join(...) - """ - leftSqBr = Literal("[").suppress() - rightSqBr = Literal("]").suppress() - dotToken = Literal(".").suppress() - measuresToken = Literal("measures").suppress() - scalar = Word(alphanums+alphas8bit.encode("utf-8") +"_"+" "+"-" ) - level_filter = leftSqBr + scalar + rightSqBr - level_function = Keyword("children", caseless=True) - level_filter.setParseAction(lambda s,a,toks: level.level_filter(toks[0])) - level_function.setParseAction(lambda s,a,toks: level.level_function(toks[0])) - level_item = level_filter | level_function - level_parse = leftSqBr + scalar + rightSqBr + Optional(dotToken + delimitedList(level_item, ".", combine=False)) - level_parse.setParseAction(lambda s,a,toks: level.level(toks[0], toks[1:])) - measure_parse = leftSqBr + measuresToken + rightSqBr + dotToken + leftSqBr + scalar + rightSqBr - measure_parse.setParseAction(lambda s,a,toks: measure.measure(toks[0])) - lev = measure_parse | level_parse - return lev - - - def mdx_axis(self): - """ - Return a parser that parse the axis part of the MDX query and - return an axis object - Examples: - {[prod].[all prod].children, [a]} - OR - crossjoin({[Order Date].[all]},{[prod].[all prod].children, [a]}) - This is to be made recursive for the cross join - crossjoin(crossjoin({[City].[all],[City].children},{[User].[all]}),{[User].[Administrator]}) - - """ - leftCurlBr = Literal("{").suppress() - rightCurlBr = Literal("}").suppress() - comma = Literal(",").suppress() - - level_parse = self.mdx_level() - axis_parser = delimitedList(level_parse, ",", combine=False) - axis_parser.setParseAction(lambda s,a,toks:axis.axis(mdx_operator.mdx_set(toks))) - - mdx = leftCurlBr + axis_parser + rightCurlBr - - return mdx - - def cross_axis(self): - leftCurlBr = Literal("{").suppress() - rightCurlBr = Literal("}").suppress() - cross_parser = self.mdx_level() - cross_parser.setParseAction(lambda s,a,toks:cross.cross(toks)) - - cross_parse = leftCurlBr + cross_parser + rightCurlBr - - return cross_parse - - def mdx_cross_axis(self): - leftRoundBr = Literal("(").suppress() - rightRoundBr = Literal(")").suppress() - comma = Literal(",").suppress() - crossjoinToken = Keyword("crossjoin", caseless=True).suppress() - - crossx = Forward() - cross_mdx = crossx | self.mdx_axis() - crossx << (crossjoinToken + leftRoundBr + cross_mdx + comma + self.cross_axis() + rightRoundBr) -# crossx.setParseAction(lambda s,a,toks:axis.axis(toks) - simple_mdx = self.mdx_axis() - - mdx = simple_mdx | crossx - return mdx - - def mdx_axis_list(self): - # - # TODO: accept notation line AXIS(0) = rows, AXIS(1)=columns, ... - # - row_names = ["rows","columns","pages"] - onToken = Keyword("on", caseless=True).suppress() - page_name = oneOf(' '.join(row_names)) - axis_parser = self.mdx_cross_axis() + Optional(onToken + page_name) - - def _assign_name(s,a,toks): - if len(toks)>=3: - toks[0].name_set(toks[-1]) - for x in range(1,len(toks)-1): - toks[x].name_set('cross') - elif len(toks)==2: - toks[0].name_set(toks[1]) - elif len(toks)==1: - toks[0].name_set(row_names.pop(0)) - else: - raise 'invalid size' - return toks[:-1] - axis_parser.setParseAction(_assign_name) - axis_lst = delimitedList(axis_parser, ",") - axis_lst.setParseAction(lambda s,a,toks: [toks]) - return axis_lst - - def mdx_slice(self): - """ Return a MDX parser of the where clause of a MDX query """ - leftBr = Literal("(").suppress() - rightBr = Literal(")").suppress() - levels = delimitedList(self.mdx_level(), ',', combine=False) - levels.setParseAction(lambda s,a,toks: toks) - slicer_lst = delimitedList(leftBr + levels + rightBr, ",", combine=False) - slicer_lst.setParseAction(lambda s,a,toks:slicer.slicer(list(toks))) - return slicer_lst - - def mdx_cube(self): - """ Return a MDX parser of the from clause of a MDX query """ - mdx = Word(alphas+'_') - mdx.setParseAction(lambda s,a,toks: cube.cube(toks[0])) - return mdx - - def mdx_query(self): - """ Return a MDX parser of the from clause of a MDX query """ - selectToken = Keyword("select", caseless=True).suppress() - fromToken = Keyword("from", caseless=True).suppress() - whereToken = Keyword("where", caseless=True).suppress() - semicolon = Literal(";").suppress() - mdx = selectToken + self.mdx_axis_list() + fromToken + self.mdx_cube() + Optional(whereToken + self.mdx_slice()) + Optional(semicolon) - mdx.setParseAction(lambda s,a,toks: query.query(*toks)) - return mdx - - def parse(self, query): - """ Parse a string and get a MDX object """ - return self.mdx_query().parseString(query)[0] - -if __name__ == "__main__": - mdx = mdx_parser() - level_parse = mdx.mdx_level() - for test in ['[sales].children','[prod].[all prod]']: - print 'Testing level', test - print level_parse.parseString(test) - print - axis_parser = mdx.mdx_axis() - for test in ['{[a]}','{[prod].[all prod],[time].[Q3].[Sep]}']: - print 'Testing axis', test - print axis_parser.parseString(test) - - axis_parser = mdx.mdx_axis_list() - for test in ['{[a]} on rows, {[prod].[all prod],[time].[Q3].[Sep]} on columns', - '{[region].[all region].children} on rows, {[prod].[all prod].children} on columns' - ]: - print 'Testing axis', test - print axis_parser.parseString(test) - - cube_parser = mdx.mdx_cube() - for test in ['sales']: - print 'Testing axis', test - print cube_parser.parseString(test) - - for query_parser in [ -"Select {[region].[all region].children} on rows, {[product]} on columns from cubulus where ([time].[all time].[time_2005])", -"Select {[region].[all region].children} on rows, {[prod].[all prod].children} on columns from cubulus where ([time].[all time].[time_2005])", -#"Select {[time].[all time].children} on rows, crossjoin([region].[all region].children, [region].[all region].children) on columns from cubulus" - ]: - print 'Testing ', query_parser - print mdx.parse(query_parser) - - print mdx.parse('''select - {[date].[2007].[Q2].children} on rows, - {[country_id].children,[country_id].[1].children} on columns - from res_partner where ([measure].[credit_limit])''') -# vim: ts=4 sts=4 sw=4 si et diff --git a/addons/olap/cube/measure.py b/addons/olap/cube/measure.py deleted file mode 100644 index 2b8d563ba1d..00000000000 --- a/addons/olap/cube/measure.py +++ /dev/null @@ -1,84 +0,0 @@ - -import sqlalchemy -import common -import copy -import pyparsing -import operator -from operator import add,sub -from pyparsing import * - -from agregator import agregator -import axis_map - -class measure(object): - def __init__(self, name): - self.name = name - self.object = False - def validate(self, cube): - for measure in cube.measure_ids: - if measure.name==self.name: - self.object = measure - if not self.object: - raise 'This measure does not exist !' - return True - - def run(self, metadata): - table = common.table_get(metadata, self.object.cube_id.table_id) - if self.object.measure_type == 'fact_column': - col = common.col_get(sqlalchemy.Table(self.object.table_name,metadata), self.object.value_column) - col_agregated = agregator[self.object.agregator](col) - else: - scalar = Word(alphanums+"_"+" "+".") - sql_func = ["sum","max","min","count","avg"] - arith_operator = ["-","*","/","+"] - - sql_function = oneOf(' '.join(sql_func)) - leftRdBr = Literal("(").suppress() - rightRdBr = Literal(")").suppress() - operator_arith = oneOf(' '.join(arith_operator)) - sqlexpression = sql_function.setResultsName('sql_func') + leftRdBr + delimitedList(scalar,",",combine=False) + rightRdBr | sql_function + leftRdBr + scalar + ZeroOrMore(operator_arith.setResultsName('arithmetic') + scalar) + rightRdBr - res = sqlexpression.parseString(self.object.value_sql) - operators = [] - cols = [] - function = None - for item in res: - if str(item) == res.sql_func: - function = str(item) - elif str(item) == res.arithmetic or str(item) in ["+","-","/","*"]: - operators.append(str(item)) - else: - cols.append(common.measure_sql_exp_col(metadata,str(item))) - operations = { - '+':operator.add, - '-':operator.sub, - '/':operator.div, - '%':operator.mod, - '*':operator.mul, - } - operators = [operations[name] for name in operators] - ops_cols = zip(operators, cols[1:]) - col = reduce(lambda expr, op_col: op_col[0](expr, op_col[1]), ops_cols,cols[0]) - - if function: - col_agregated = agregator[function](col) - else: - col_agregated = col - - return [ { - 'value': [(['measures',self.name], self.name, False)], - 'query': { - 'column': [col_agregated] - }, - 'axis_mapping': axis_map.column_fixed(0), - 'delta': 0, - 'format':self.object.formatstring - } ] - - def children(self, level, metadata): - raise 'Not yet implemented !' - - def __repr__(self): - res= '\t\t\n' % (self.name,) - return res - -# vim: ts=4 sts=4 sw=4 si et diff --git a/addons/olap/cube/query.py b/addons/olap/cube/query.py deleted file mode 100644 index 37aaf365c87..00000000000 --- a/addons/olap/cube/query.py +++ /dev/null @@ -1,236 +0,0 @@ -import locale - - -import mdx_input -import sqlalchemy -import common -import slicer -import datetime -import pooler -import copy - -class mapper(object): - def __init__(self, size): - self.size = size - -class query(object): - def __init__(self, axis, cube, slicer_obj=None, *args): - super(query, self).__init__() - self.object = False - self.cube = cube - self.axis = axis - if not slicer_obj: - slicer_obj = slicer.slicer([]) - self.slicer = slicer_obj - - # - # Generate the cube with 'False' values - # This function could be improved - # - def _cube_create(self, cube_size): - cube_data = [False] - while cube_size: - newcube = [] - for i in range(cube_size.pop()): - newcube.append(copy.deepcopy(cube_data)) - cube_data = newcube - return cube_data - - def run(self,currency): - db = sqlalchemy.create_engine(self.object.schema_id.database_id.connection_url,encoding='utf-8') - metadata = sqlalchemy.MetaData(db) - print 'Connected to database...', self.object.schema_id.database_id.connection_url - # - # Compute axis - # - axis = [] - axis_result = [] - cube_size = [] - cross = False - cross_all = [] - for ax in self.axis: - if ax.name == 'cross': - cross = True - cross = ax.run(metadata) - cube_size[-1] = cube_size[-1] * len(cross) - temp = axis_result[0][:] - cross_all.append(cross) - final_axis = [] - for cr in cross: - for el in axis_result[-1]: - t = copy.deepcopy(el) - t = list(t) - t[0].append(cr['value'][0][0]) - t.append(cr['value'][0][1]) - final_axis.append(tuple(t)) - axis_result[-1]=final_axis[:] - final_axis=[] - len_axis = len(axis[-1]) - len_cross = len(cross) - delta_count = 0 - d=0 - for data in common.xcombine(axis[-1],cross): - flag = False - make_where = [] - temp_where = [] - temp_column = [] - if 'whereclause' in data[0]['query'].keys(): - flag = True - temp_where = data[0]['query']['whereclause'][0] - data[0]['query']['whereclause']=str(data[0]['query']['whereclause'][0]) - - if isinstance(type(data[0]['query']['column'][0]),type(sqlalchemy.sql.expression._BindParamClause)): - temp_column = data[0]['query']['column'][0] - data[0]['query']['column'][0] = str(data[0]['query']['column'][0]) - data_temp = copy.deepcopy(data[0]) - if 'whereclause' in data[1]['query'].keys(): - if 'whereclause' in data_temp['query'].keys(): - make_where.append(data[1]['query']['whereclause'][0]) - else: - make_where.append(data[1]['query']['whereclause'][0]) - delta_count = delta_count + 1 - if delta_count >= len_cross and len_cross!=1: - delta_count = 0 - data_temp['delta'] = d - d = d + 1 - else: - data_temp['delta'] = d - d = d + 1 - if flag: - data[0]['query']['whereclause']=[temp_where] - data_temp['query']['whereclause'] = [temp_where] - if make_where: - if 'whereclause' in data_temp['query'].keys(): - data_temp['query']['whereclause'].append(make_where[0]) - else: - data_temp['query']['whereclause'] = make_where - if temp_column: - data[0]['query']['column'] = [temp_column] - data_temp['query']['column'] = [temp_column] - final_axis.append(data_temp) - axis[-1] = [] - axis[-1] = final_axis - else: - cross = False - result = ax.run(metadata) - length = 0 - axis_result2 = [] - for r in result: - length += len(r['value']) - axis_result2 += map(lambda x: (map(lambda y: y or False,x[0]),x[1] or False), r['value']) - axis_result.append(axis_result2) - axis.append(result) - cube_size.append(length) - cube_data = self._cube_create(cube_size) - cr = [] - slice = self.slicer.run(metadata) - position = 0 - ax = [] - for subset in common.xcombine(*axis): - select,table_fact = self.cube.run(metadata) - for s in subset+slice: - for key,val in s['query'].items(): - for v in val: - if key=='column': - v = v.label('p_%d' % (position,)) - position += 1 - select.append_column(v) - elif key=='whereclause': - select.append_whereclause(v) - elif key=='group_by': - select.append_group_by(v) - else: - raise 'Error, %s not implemented !'% (key,) -# metadata.bind.echo = True - query = select.execute() - result = query.fetchall() - for record in result: - cube = cube_data - r = list(record) - value = False - for s in subset: - if s.has_key('format'): - # To make use of the format string if specified for the measure - # Its set to static for a testing - if not currency: - currency = "EUR" - if isinstance(r[0],float) or isinstance(r[0],int) or isinstance(r[0],long): - a = {'data':r[0]} - r[0] = str(r[0]) - else: - r[0] = '0.0' - a = {'data':0.0} - if s['format'] == 'cr_prefix': - r[0] = currency + " " + "%.2f"%a['data'] - elif s['format'] == 'cr_postfix': - r[0] = "%.2f"%a['data'] + " " + currency - elif s['format'] == 'comma_sep': - r[0] = locale.format("%(data).2f", a, 1) - elif s['format'] == 'cr_prefix_comma': - r[0] = locale.format("%(data).2f", a, 1) - r[0] = currency + " " + str(r[0]) - elif s['format'] == 'cr_postfix_comma': - a['currency'] = currency - r[0] = locale.format("%(data).2f %(currency)s", a, 1) - cube = s['axis_mapping'].cube_set(cube, r, s['delta']) - value = s['axis_mapping'].value_set(r) or value - for s in slice: - value = s['axis_mapping'].value_set(r) or value - if value: - assert not cube[0], 'Already a value in cube, this is a bug !' - cube[0] = value - - i=0 - for a in cube_data: - i=i+1; - return (axis_result, cube_data) - - def preprocess(self): - wrapper = mdx_input.mdx_input() - wrapper.parse(self) - - def validate(self, schema): - """ This function takes a query object and validate and assign - fact data to it. Browse object from Tiny ERP""" - cube = self.cube.validate(schema) - self.object = cube - if not self.object: - raise "Cube '%s' not found in the schema '%s' !"%(cube.name, schema.name) - self.slicer.validate(cube) - - for axis in self.axis: - axis.validate(cube) - for dimension in cube.dimension_ids: - pass - return True,cube - - def __repr__(self): - res = '=3: - if len(data[0]) == 2: - rows = data[0][0] - columns = data[0][1] - datas = data[1] - result = [] - - parent_list = [ rw[0] for rw in rows] - - for element in range(len(rows)): - res = {} - check_element = rows[element][0][:rows[element][0].index(rows[element][1])] - if check_element: - res['parent_id'] = str(parent_list.index(check_element)) - res['id'] = str(element) - else: - res['parent_id'] = str(None) - res['id'] = str(element) - res['name'] = str(rows[element][1]) - for col in range(len(columns)): - col_elem = columns[col][0][:columns[col][0].index(columns[col][1])+1] - c_element = '.'.join(map(lambda x: str(x), col_elem)) - res[c_element] = str(datas[element][col][0]) - result.append(res) - table_name = cube.name+'_'+str(count.id)+'_'+str(counter) - self.create_table(connection,table_name, result) - elif len(data[0]) == 3: - print "Its for Pages:>>>>>>>>>" - pooler.get_pool(cr.dbname).get('olap.query.logs').write(cr, uid, log_ids, {'count':counter, 'table_name': table_name}) - return True - else: - logentry={} - logentry['user_id']=uid - logentry['cube_id']=cube.id - logentry['query']=query - logentry['time']= str(datetime.datetime.now()) - logentry['result_size']=0 - logentry['count']=1 - logentry['schema_id'] = cube.schema_id.id - log_id = pooler.get_pool(cr.dbname).get('olap.query.logs').create(cr,uid,logentry) - return log_id - return -1 - - def run(self, currency, qry_obj): - schema = qry_obj.schema_id - table_name = str(qry_obj.table_name) - connection = schema.database_id.connection_url - engine = create_engine(connection, echo=False) - metadata = MetaData(engine) - metadata.create_all(engine) - tab = Table(table_name, metadata, autoload=True, autoload_with=engine) - total_columns = [c.name for c in tab.columns] - columns = [] - cols = [] - for c in tab.columns: - if not c.name.__contains__('name') and not c.name.__contains__('id') and not c.name.__contains__('parent_id'): - columns.append(c.name) - cols.append((c.name.split('.'), str(c.name.split('.')[1]))) - result = tab.select().execute() - res = result.fetchall() - rows = [] -# dt = [[[]] * len(columns)] * len(res) - for r in range(len(res)): - if res[r][1] == str(None): - rows.append(([str(res[r][0])], str(res[r][0]))) - else: - rows.append(([str(res[int(res[r][1])][0]),str(res[r][0])], str(res[r][0]))) - - data = [] - for r in range(len(res)): - data.append(res[r][3:]) - - datas = [] - for dd in range(len(data)): - datas.append([]) - for d in range(len(data[dd])): - datas[dd].append([str(data[dd][d])]) - - final_result = ([rows, cols], datas) - return final_result - - def match_table(self, cr, uid,request, context): - qry_obj = pooler.get_pool(cr.dbname).get('olap.query.logs') - result = self.parse_query(request) - qry = result[1][0] - qry_axis = result[0] - qry_id = qry_obj.search(cr, uid, [('query','=',str(qry))]) - result = () - if qry_id: - qry = qry_obj.browse(cr, uid, qry_id)[0] - schema = qry.schema_id - if qry.table_name !='': - total_rows = [] - total_cols = [] - data = [] - table_name = str(qry.table_name) - connection = schema.database_id.connection_url - engine = create_engine(connection, echo=False) - metadata = MetaData(engine) - metadata.create_all(engine) - tab = Table(table_name, metadata, autoload=True, autoload_with=engine) - total_columns = [c.name for c in tab.columns] - res = tab.select().execute().fetchall() - for val in range(len(res)): - for row in range(len(res[val])): - if total_columns[row]!='parent_id' and total_columns[row]!='id': - if total_columns[row] == 'name': - total_rows.append((str(res[val][row]).split("."), str(res[val][row]).split(".")[-1])) - else: - total_cols.append((str(total_columns[row]).split("."), str(total_columns[row]).split(".")[-1])) - data.append([[str(res[val][row])]]) - res_1 = [] - res_1.append(total_rows) - res_1.append(total_cols) - result = (res_1, data) - return result - - def parse_query(self, query): - result = [] - lrbrack, rrbrack = map( Suppress, "()" ) - comma = Suppress( "," ) - leftCurlBr, rightCurlBr = map( Suppress, "{}" ) - dot = Suppress( "." ) - crossToken = Literal( "crossjoin" ).suppress() - selectToken = Keyword( "select", caseless = True ).suppress() - fromToken = Keyword( "from", caseless = True ).suppress() - whereToken = Keyword( "where", caseless = True ).suppress() - - scalar = Word( alphanums + "_" + " " + "-" + "+") - cube = Word( alphas + '_' ) - level_scalar = Word( alphanums + "_" + " " ) - level_filter = Suppress( "[" ) + level_scalar + Suppress( "]" ) - level_function = Keyword( "children", caseless = True ) - level_item = level_filter | level_function - levels = Group( level_item + Optional( dot + delimitedList( level_item, ".", combine = False ) ) ) - axis_parser = delimitedList( levels, ",", combine = False ) - where_parse = lrbrack + Group( delimitedList( levels , ",", combine = False ) ) + rrbrack - - cross_parser = leftCurlBr + levels + rightCurlBr - crossx = Forward() - cross_mdx = crossx | leftCurlBr + axis_parser + rightCurlBr - crossx << ( crossToken + lrbrack + cross_mdx + comma + Group( cross_parser.setResultsName( "cross" ) ) + rrbrack ) - - rowsmdx = leftCurlBr + axis_parser + rightCurlBr - colsmdx = leftCurlBr + axis_parser + rightCurlBr - pagemdx = leftCurlBr + axis_parser + rightCurlBr - row_mdx_axis = rowsmdx | crossx - col_mdx_axis = colsmdx | crossx - row_names = ["rows", "columns", "pages"] - onToken = Keyword( "on", caseless = True ).suppress() - page_name = oneOf( ' '.join( row_names ) ).suppress() - - query_parser = selectToken + Group( row_mdx_axis ) + onToken + page_name + Optional( comma + Group( col_mdx_axis ) + onToken + page_name ) \ - + Optional( comma + Group( pagemdx ) + onToken + page_name )\ - + fromToken + cube.suppress() + Optional( whereToken + Group(where_parse )) - qr = query_parser.parseString(query) - axes = [[],[], []] - crossjoins=[[],[],[]] - ax = 0 - for items in qr: - for i in items: -# if ax == 2: -# if len( items ) > 1: -# for t in i: -# conditions.append( list(t) ) -# else: -# conditions.append( list(i)) - if i.cross: - if i[0][-1] == 'children': - crossjoins[ax].append( '.'.join(map(lambda x: "[" + x +"]",i[0][:-1]))+".children") - else: - crossjoins[ax].append( '.'.join(map(lambda x: "[" + x +"]",i[0]))) - else: - if i[-1] == 'children': - axes[ax].append( '.'.join(map(lambda x: "[" + x +"]",i[:-1]))+".children") - else: - axes[ax].append( '.'.join(map(lambda x: "[" + x +"]",i))) - ax = ax + 1 - - result.append(axes) - result.append(crossjoins) - qry_list = [[], []] - t_qry = [] - new_query = '' - - for x in range(len(axes)): - qry_select = 'select {' - if x == 0: - rs = axes[x][:-1] - if rs: - t_qry.append(rs) - rs_axis = ','.join(rs) - new_query = qry_select + rs_axis + '} on rows,' - elif x == 1: - cs_axis = ','.join(axes[x]) - if cs_axis: - t_qry.append(cs_axis) - new_query = new_query + ' {' + cs_axis + '} on columns from Sales' - - qry_list[0].append(t_qry) - qry_list[1].append(new_query) - - # else: - # print "pages" - return qry_list - \ No newline at end of file diff --git a/addons/olap/data/olap_cube_view.xml b/addons/olap/data/olap_cube_view.xml deleted file mode 100644 index 1afc1a5d520..00000000000 --- a/addons/olap/data/olap_cube_view.xml +++ /dev/null @@ -1,682 +0,0 @@ - - - - - - - - bi.load.db.form - bi.load.db.wizard - form - -
-