olapy Documentation Release Abilian SAS

Similar documents
I hate money. Release 1.0

Canvas Data Utilities Documentation

Google Domain Shared Contacts Client Documentation

Pulp Python Support Documentation

SQL Server Analysis Services

Bitdock. Release 0.1.0

OLAP Introduction and Overview

Call: SAS BI Course Content:35-40hours

BUSINESS INTELLIGENCE. SSAS - SQL Server Analysis Services. Business Informatics Degree

Magento OpenERP Integration Documentation

TangeloHub Documentation

InfoSphere Warehouse V9.5 Exam.

Implementing and Maintaining Microsoft SQL Server 2008 Analysis Services

Top 24 Obiee Interview Questions & Answers

pydrill Documentation

Archan. Release 2.0.1

chatterbot-weather Documentation

oemof.db Documentation

CSE 344: Section 1 Git Setup for HW Introduction to SQLite

Quality Gates User guide

Python simple arp table reader Documentation

open-helpdesk Documentation

newauth Documentation

DIMEX Data Import/Export

A Case Study Building Financial Report and Dashboard Using OBIEE Part I

TPS Documentation. Release Thomas Roten

CSE 344: Section 1 Git Setup for HW Introduction to SQLite. September 28, 2017

REST API Operations. 8.0 Release. 12/1/2015 Version 8.0.0

flask-dynamo Documentation

Python Project Example Documentation

Release Nicholas A. Del Grosso

Aldryn Installer Documentation

Trunk Player Documentation

ClickToCall SkypeTest Documentation

External Data Connector for SharePoint

MIS2502: Data Analytics Dimensional Data Modeling. Jing Gong

Libra Client Documentation

Unit 7: Basics in MS Power BI for Excel 2013 M7-5: OLAP

turbo-hipster Documentation

Koalix ERP. Release 0.2

Business Analytics in the Oracle 12.2 Database: Analytic Views. Event: BIWA 2017 Presenter: Dan Vlamis and Cathye Pendley Date: January 31, 2017

INTRODUCTION. Chris Claterbos, Vlamis Software Solutions, Inc. REVIEW OF ARCHITECTURE

Python AutoTask Web Services Documentation

CIS 611: ENTERPRISE DATABASE AND DATA WAREHOUSING. Project: Multidimensional OLAP Cube using Adventure Works Data Warehouse

Get Weather Data Documentation

Media Writer. Installation Guide LX-DOC-MW5.1.9-IN-EN-REVB. Version 5.1.9

Hands-On Lab. Lab: Developing BI Applications. Lab version: Last updated: 2/23/2011

Deccansoft Software Services Microsoft Silver Learning Partner. SSAS Syllabus

google-search Documentation

sainsmart Documentation

20466C - Version: 1. Implementing Data Models and Reports with Microsoft SQL Server

SQL Server 2005 Analysis Services

COURSE 20466D: IMPLEMENTING DATA MODELS AND REPORTS WITH MICROSOFT SQL SERVER

ejpiaj Documentation Release Marek Wywiał

WF-distiller Installation Guide

Integration Overview, Example Data Model & Reports for Oracle Business Intelligence Cloud Service

Roman Numeral Converter Documentation

SAS Data Integration Studio 3.3. User s Guide

agate-sql Documentation

Implementing and Maintaining Microsoft SQL Server 2005 Analysis Services

Jet Data Manager 2014 Product Enhancements

CHAPTER 8 DECISION SUPPORT V2 ADVANCED DATABASE SYSTEMS. Assist. Prof. Dr. Volkan TUNALI

neo4django Documentation

SSAS Tabular in the Real World Lessons Learned. by Gerhard Brueckl

AnyDo API Python Documentation

Proceedings of the IE 2014 International Conference AGILE DATA MODELS

Contents. Getting Set Up Contents 2

CIS-CAT Pro Dashboard Documentation

Django IPRestrict Documentation

BanzaiDB Documentation

Sql Fact Constellation Schema In Data Warehouse With Example

Kivy Designer Documentation

I2C LCD Documentation

After completing this course, participants will be able to:

SAS Information Map Studio 3.1: Tips and Techniques

django-dynamic-db-router Documentation

Setting up Caravel with IBM Big SQL

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

ANALYZE. Business Analytics Technical White Paper. Microsoft Dynamics TM NAV. Technical White Paper

Implementing Data Models and Reports with SQL Server 2014

STRATandGO Technology

SendCloud OpenCart 2 Extension Documentation

Queries give database managers its real power. Their most common function is to filter and consolidate data from tables to retrieve it.

Gunnery Documentation

Business Intelligence Tutorial

diceware Documentation

External Data Connector for SharePoint

Introduction to DWH / BI Concepts

Verteego VDS Documentation

Creating a target user and module

Python Schema Generator Documentation

SAS Web Report Studio 3.1

to-end Solution Using OWB and JDeveloper to Analyze Your Data Warehouse

PyCRC Documentation. Release 1.0

Module 1.Introduction to Business Objects. Vasundhara Sector 14-A, Plot No , Near Vaishali Metro Station,Ghaziabad

Redis Timeseries Documentation

SnowAlert Documentation. Snowflake Security

Extract API: Build sophisticated data models with the Extract API

Oracle Big Data Cloud Service, Oracle Storage Cloud Service, Oracle Database Cloud Service

Manual Trigger Sql Server 2008 Examples Update

Transcription:

olapy Documentation Release 0.6.2 Abilian SAS Oct 01, 2018

Contents 1 Installation 3 1.1 Install from PyPI............................................. 3 1.2 Install from Github............................................ 3 1.3 Initialization............................................... 3 1.4 Olapy-data................................................ 4 2 Quick Start 5 2.1 OlaPy as XMLA server......................................... 5 2.2 Olapy as a library............................................. 6 3 Advanced Olapy options 7 4 Cubes creation 9 4.1 OLAPY CUBES RULES........................................ 9 4.2 Examples:................................................ 10 5 Cube customization 13 6 Running olapy with Database 15 6.1 Environnement variable......................................... 15 6.2 Database string connection........................................ 16 6.3 Olapy config file............................................. 16 7 OlaPy ETL 17 8 API Documentation 19 8.1 Package olapy.core.services.xmla.............................. 19 8.2 Package olapy.core.mdx.executor............................... 19 8.3 Package olapy.etl.etl....................................... 19 9 Indices and tables 21 i

ii

olapy Documentation, Release 0.6.2 OlaPy is an OLAP engine based on Python, which gives you a set of tools for the development of reporting and analytical applications, multidimensional analysis, and browsing of aggregated data with MDX and XMLA support. It can be found in GitHub. or PyPI. It is fast and uses in-memory technology and various techniques (aggregation and real-time computation) to provide sub-second responses. It includes an ETL layer (Extract Transform Load) for better data handling. It support most common databases (Postgres, MySql, Oracle, SQL Server) and CSV file format (only CSV right now) to construct cubes. Contents: Contents 1

olapy Documentation, Release 0.6.2 2 Contents

CHAPTER 1 Installation 1.1 Install from PyPI You can install it directly from the Python Package Index: pip install olapy 1.2 Install from Github The project sources are stored in Github repository. Download from GitHub: git clone git://github.com/abilian/olapy.git Then install: cd olapy python setup.py install 1.3 Initialization Before running olapy, you have to initialize it with: olapy init 3

olapy Documentation, Release 0.6.2 1.3.1 Testing OlaPy is configured to run units and integrations tests suites. Before running tests, make sure you have installed all development requirements with: pip install -r dev-requirements.txt and then run: tox Test other databases The default database used with tests is sqlite, if you want to run tests against mysql or postgres, you need to install the appropriate driver and export a connection string like this export SQLALCHEMY_DATABASE_URI = { dialect+driver://username:password@host:port/ database } take a look to SQLAlchemy documentation for more information. 1.4 Olapy-data After Olapy initialization, you can take a look to olapy-data folder located under: ~/olapy-data C:\User\{USER_NAME}\olapy-data for Linux/Mac user for Windows This folder contains some required files to configure olapy and some demo cubes under /cubes folder, we will deeply discuss about this in the Cubes and Cube Customization 4 Chapter 1. Installation

CHAPTER 2 Quick Start 2.1 OlaPy as XMLA server After installation, you can run the Olapy server with: olapy runserver All you have to do now is to try it with an Excel spreadsheet: open excel, open new spreadsheet and go to : Data -> From Other Sources -> From Analysis Services After that, Excel will ask you the server name: put http://127.0.0.1:8000/ and click next, then you can chose one of default olapy demo cubes (sales, foodmart... ) and finish. That s it! Now you can play with your data. 5

olapy Documentation, Release 0.6.2 2.2 Olapy as a library If you want to use olapy as a library to execute MDX queries, start by importing the MDX engine: from olapy.core.mdx.executor.execute import MdxEngine In our example, we re going to use sales demo cube: executor = MdxEngine() # instantiate the MdxEngine executor.load_cube('sales') # load sales cube We set an MDX query: query = """ SELECT Hierarchize({[Measures].[Amount]}) ON COLUMNS FROM [sales] """ and execute it: df = executor.execute_mdx(query)['result'] print(df) Result: Amount 0 1023 6 Chapter 2. Quick Start

CHAPTER 3 Advanced Olapy options Olapy is easy configurable. When using the olapy runserver command, you can pass a lot of options to it: -st Cubes source type (db csv), DEFAULT : csv only -sa SQL Alchemy URI to connect to database, **DON'T PUT THE DATABASE NAME!** -wf Write logs into a file or display them into the console. log file location, by default under olapy-data folder -lf If you want to change log file location. -od Olapy-Data folder location -h Host ip adresse -p Host port -dbc Database configuration file path, Default : ~/olapy-data/olapy-config.yml -cbf Cube config file path, default : ~/olapy-data/cube/cubes-config.yml -tf File path or DB table name if you want to construct cube from a single file (or table) -c To explicitly specify columns (construct cube from a single file), columns order matters -m To explicitly specify measures (construct cube from a single file) Here is an example of olapy runserver with all options: olapy runserver -sa=postgresql://postgres:root@localhost:5432 -wf=false -lf=/home/{user_name}/documents/olapy_logs -od=/home/{user_name}/documents -st=db,csv -h=0.0.0.0 -p=8000 Here is an example of olapy runserver with a simple csv file: olapy runserver -tf=/home/moddoy/olapy-data/cubes/sales/data.csv -c=city,licence -m=amount,count 7

olapy Documentation, Release 0.6.2 8 Chapter 3. Advanced Olapy options

CHAPTER 4 Cubes creation To add new cube, put your CSV files in a folder (folder name <=> cube name), make sure that they follow OLAPY CUBES RULES, and move that folder under olapy-data/cubes, thus, the path to your cube will be: ~/olapy-data/cubes/{your_cube}/{you_csv_files} for Mac/Linux, C:\\User\\{USER_NAME}\\olapy-data\\{YOUR_CUBE}\\{YOU_CSV_FILES} for Windows. 4.1 OLAPY CUBES RULES NOTE : THE SAME THING IF YOU WANT TO WORK WITH DATABASES Here are the rules to apply to your tables so that can works perfectly with olapy: 1. Make sure that your tables follow the star schema 2. The fact table should be named Facts 3. Each table id columns, must be the same in facts table, example ( product_id column from product table must be product_id in Facts table, 4. Avoid id for id columns name, you should use something_id for example 5. The columns name must be in a good order (hierarchy) (example : Continent -> Country -> City... ) take a look to the default cubes structure (sales and foodmart). Here are two examples of table structures that follows olapy rules: 9

olapy Documentation, Release 0.6.2 4.2 Examples: 4.2.1 Cube 1 Geography table Geo_id Continent Country 0001 America Canada... 00526 Europe France Facts table Geo_id Prod_id Amount Count 0001 111111 5000 20... 0011 222222 1000 40 Product table Prod_id Company Name 111111 Ferrero Nutella... 222222 Nestle KitKat 4.2.2 Cube 2 Here we don t use id column name in tables. Geography table Continent America... Europe Country Canada France Facts table Continent Company Amount Count America Ferrero 5000 20... Europe Nestle 1000 40 10 Chapter 4. Cubes creation

olapy Documentation, Release 0.6.2 Product table Company Ferrero... Nestle Name Nutella KitKat 4.2. Examples: 11

olapy Documentation, Release 0.6.2 12 Chapter 4. Cubes creation

CHAPTER 5 Cube customization If you don t want to follow olapy cubes rules and you want to customize your cube construction, you can use a configuration file, you can find the default example in ~/olapy-data/cubes/cubes-config.xml for mac/linux C:\\User\\{USER_NAME}\\olapy-data\\cubes\\cubes-config.xml for windows Here is an examples of configuration: Assuming we have two tables as follows under custom_cube folder table 1: stats (which is the facts table) table 2: organization (which is a dimension) departement_id amount monthly_salary total monthly cost 111 1000 2000 3000... id type name acronym other colums..... 111 humanitarian humania for better life...... you can use a configuration file like this to construct cube and access to it with excel: # if you want to set an authentication mechanism to access cube, # user must set a token with login url like 'http://127.0.0.1/admin # default password = admin xmla_authentication : False # cube name <==> db name name : custom_cube #csv postgres mysql... (continues on next page) 13

olapy Documentation, Release 0.6.2 source : csv (continued from previous page) # star building customized star schema facts : table_name : stats keys: departement_id : organization.id measures : # by default, all number type columns in facts table, or you can specify them here - amount - monthly_salary # star building customized dimensions display in excel from the star schema dimensions: # IMPORTANT, put here facts table also - name : stats displayname : stats - name : organization displayname : Organization columns : - name : id - name : type - name : name column_new_name : full_name 14 Chapter 5. Cube customization

CHAPTER 6 Running olapy with Database As we said in the previous section, Olapy uses CSV files as source type by default when using the olapy runserver command, so how can we work with databases? Well, you need to provide some database information (login, password, etc... ) to Olapy so it can connect to your database management system. The command to run Olapy with databases is olapy runserver -st=csv,db Here, Olapy gets cubes from csv and database (of course if you want only database use -st=db... ) You have three possibilities to configure olapy with database: 6.1 Environnement variable At startup, Olapy looks for an environment variable called SQLALCHEMY_DATABASE_URI which is the connection string that holds your database credentials and its something like: SQLALCHEMY_DATABASE_URI = mysql://root:root@localhost:3306 To use this method, just before starting Olapy with olapy runserver, use the following command: export SQLALCHEMY_DATABASE_URI = mysql://root:root@localhost:3306 for mac/linux set SQLALCHEMY_DATABASE_URI = mysql://root:root@localhost:3306 for windows and then start Olapy with the option -st=csv,db of course. NOTE don t put the database name in the connection string, you will select the database after from Excel. SQLALCHEMY_DATABASE_URI = mysql://root:root@localhost:3306/my_database -> this will not work 15

olapy Documentation, Release 0.6.2 6.2 Database string connection This is simple as running Olapy with the -sa option: olapy runserver -st=csv,db -sa=mysql://root:root@localhost:3306 and the same rule don t put the database name. 6.3 Olapy config file The third way to configure a database connection is using a file configuration named olapy-config.yml under olapy-data folder. A default/demo olapy-config file is created after installing olapy under olapy-data. You can modify this file according to your configuration: connection_string : postgresql+psycopg2://postgres:root@localhost:5432 take a look to SQLAlchemy documentation for more information. 16 Chapter 6. Running olapy with Database

CHAPTER 7 OlaPy ETL NOTE: this part is working only with Python 3.5+. OlaPy ETL can be used if you have an excel file (one sheet) contains all your data in order to let OlaPy make necessary transformations relative to its rules on your data. To use OlaPy ETL, after installing OlaPy with python setup.py install use the following command: etl --input_file_path=<excel FILE PATH> --config_file=<config FILE PATH> [OPTIONAL] -- output_cube_path=<path WHERE TO GENERATE THE CUBE> config_file describe how to create the cube, here an example of the configuration file, consider this excel sheet: Count Continent Country Year Month Day 84 America Canada 2010 January 2010 January 1,2010 841 America Canada 2010 January 2010 January 2,2010 2 America United States 2010 January 2010 January 3,2010 and we want to divide it into three table, we use a configuration file like this: Facts: Geography: Date: [Count] # just measures [Continent, Country] [Year, Month, Day] and you save it as yaml file (.yml). 17

olapy Documentation, Release 0.6.2 18 Chapter 7. OlaPy ETL

CHAPTER 8 API Documentation 8.1 Package olapy.core.services.xmla to import the package use: import olapy.core.services.xmla 8.2 Package olapy.core.mdx.executor to import the package use: import olapy.core.mdx.executor.execute 8.3 Package olapy.etl.etl to import the package use: import olapy.etl.etl 19

olapy Documentation, Release 0.6.2 20 Chapter 8. API Documentation

CHAPTER 9 Indices and tables genindex modindex search 21