title: Query OLAP Mondrian (MDX, XMLA) with a Python interface?
body: <p>Actually I'm using <a href="http://en.wikipedia.org/wiki/R_%28programming_language%29" rel="noreferrer">R</a> + Python with RPY2 to manipulate data and ggplot to create beautiful graphics.. I have some data in a PostgreSQL database, and I'm using psycopg2 to query data.</p>
  
  <p>I'm starting a thesis, and in the future I need an <a href="http://en.wikipedia.org/wiki/OLAP_cube" rel="noreferrer">OLAP cube</a> to store my (very big) simulation data: multiple dimension, aggregation query, etc.</p>
  
  <p>Is there any best or standard practice for interfacing between Python (and I want Python + R, no jpivot or some other dashboard in Java) and an OLAP engine like <a href="http://en.wikipedia.org/wiki/Mondrian_OLAP_server" rel="noreferrer">Mondrian</a>? I searched on Google for any solution, and didn't I find anything.</p>
  
  <p>I've briefly evaluated <a href="http://en.wikipedia.org/wiki/SQLAlchemy" rel="noreferrer">SQLAlchemy</a>, and Django-ORM, but they have no <a href="http://en.wikipedia.org/wiki/MultiDimensional_eXpressions" rel="noreferrer">MDX</a> or XML/A interface to query an OLAP server (Mondrian or other) ...</p>
  
  <p>Is it possible to write a query in MDX and, with psycopg + ODBC, query my OLAP server, and the OLAP server giving me an answer from my simulation data (no mapping on Python object, but it's OK for me)?</p>
  
  <p><strong>Update 1 :</strong> </p>
  
  <p><strong><em>Why do I need to search around OLAP + Mondrian technology ?</em></strong></p>
  
  <p>Because <a href="http://en.wikipedia.org/wiki/Universit%C3%A9_Laval" rel="noreferrer">University of Laval</a> (GeoSoa departements + Thierry Badard) wrote a spatial extension to OLAP: SOLAP, and implemented this in Mondrian as <a href="http://www.spatialytics.org/projects/geomondrian/" rel="noreferrer">GeoMondrian</a>.
  That interest me because I'm working on spatial multi agent based simulation ( ~= geosimulation).</p>
  
  <p>The GeoSoa departement created an Ajax based component to communicate and visualize spatial data with GeoMondrian: SOLAPLAYERS, which can query a Mondrian server by its Xlma servlet.</p>
  
  <p>Problem : probably slow in big data manipulation, need Internet or Apache 2. Briefly, it's only to visualize data or map ... In my case, I need raw data to make my own data manipulation + graphics with R: spatial analysis, regression analysis, rank-tail, etc. Here, SOLAP help me to prepare data for this later complex R analysis.</p>
  
  <p><strong><em>Why Python?</em></strong></p>
  
  <p>1 - Web access to spatial data -</p>
  
  <p>I'm trying to use a "cool" Python framework, like <a href="http://geodjango.org/" rel="noreferrer">GeoDjango</a> or <a href="http://en.wikipedia.org/wiki/MapFish" rel="noreferrer">MapFish</a>: big community in GIS, open-source, use <a href="http://www.geoalchemy.org/intro.html" rel="noreferrer">GeoAlchemy</a> to manipulate spatial query/data, include visualisation with JavaScript extensions and <a href="http://en.wikipedia.org/wiki/OpenLayers" rel="noreferrer">OpenLayers</a>, etc.</p>
  
  <p>2 - Local access to spatial data in GIS -</p>
  
  <p>I want to create a plugin in QGIS (open source GIS) to access and visualize data, and QGIS plugin and API = Python.</p>
  
  <p>3 - Automatic analysis of data - </p>
  
  <p>A user or scientist runs a simulation with grid computing and choose automatic analysis (R + ggplot2 + MDX query) they want to run on this data. My goal here is to create a synthetic report of the simulation (graphic, tabular data, etc.).</p>
  
  <p>So, after simulation, data go to OLAP/SOLAP cube, and many Python scripts (created by the user) get data with MDX, manipulate data with R + RPY2, and write and produce cool output for the scientist on doku-wiki or another community-platform.</p>
  
  <p><strong><em>Problem?</em></strong></p>
  
  <p>1 - Olap4j, the API core of Mondrian to communicate with an external component, is Java-made :/</p>
  
  <p>2 - SOLAPLAYERS uses Ajax to access data, too slow for me.</p>
  
  <p>3 - SQLAlchemy and GeoAlchemy have no driver connection to a multidimensional database (OLAP).</p>
  
  <p><strong>* Solution? *</strong></p>
  
  <p>1 - Py4j to access Java object or Java collection in olap4j with Python? Write my own function to access the Java mapped collection? => dangerous and not very easy?... </p>
  
  <p>2 - XLMA with Ajax Mondrian server? It is too slow.</p>
  
  <p>3 - Write my own py-connector to OLAP Mondrian ? => Ouch. It's an hard way, I think.</p>
  
  <p>What should I do?</p>