Making dynamic data available via ODBC with Python

Erwin S. Andreasen erwin+usenet at andreasen.org
Mon Feb 7 10:49:14 EST 2005


I have a Python application server that manages several different data
sets, permits various reports to be run on them and the data to be
downloaded as tab-delimetered files, all via a web interface.

I'd like to explore the possibilities of making the data directly
available in Windows applications (such as Excel, where it would very
nice to directly do pivot tables from the live data) via ODBC.

So I basically need for my Python server (deployed on UNIX) to act as
a remotely queriable database. This is live and changing data, so I'd
prefer not to have to dump it into a real database first, but I
suppose that's one solution (e.g. letting PostgreSQL get the query,
run some trigger that asks my server to update the table with data and
then return the data).

Knowing little about the various available ODBC modules, one solution
seems to be to take a client/server protocol of an existing database
(such as PostgreSQL) and implement a Python server for it: so my
Python program acts like a server you could run the psql client up
against and so also get data via ODBC using the PG ODBC drivers. It
seems a bit complex because all I want to allow is to select a table
with a certain name, allow a query of what columns are available and
what type they are and to fetch the data, perhaps with minimal support
for filtering queries.

I've seen at least one program that emulates the PG client/server API
-- I think it stored some configuration data, so it acted like a
ordinary PG server you could run queries against but wasn't really
one. Its name completely escapes me at the moment though.

Is there some better way of doing this -- some way to provide tabular
data remotely to Windows machines, usable in Office programs, which
happens to already have some Python code written for it? Looking
around, there is at least one XML-to-ODBC bridge but encoding the
entire data file as XML is likely to have prohibitive overhead.



-- 
===============================================================
<erwin+usenet at andreasen.org>                    Herlev, Denmark     
<URL:http://www.andreasen.org/>                             <*>   
===============================================================




More information about the Python-list mailing list