Re: [Monetdb-developers] Python + SQL
Martin, I have fixed the Mapi.py thanks to Niels' tips. The result strings still need parsing ofcourse. I could write my own parsing or write wrappers for the existing Mapi.h API. I am willing to implement a Python database wrapper according to the Python Database API specs (http://www.python.org/peps/pep-0249.html). Maybe we can talk about this tomorrow with Peter, and how something like this can fit into my graduation work ;) regards, Arjan Martin Kersten wrote:
Arjan,
It supprises me, because the Mapi protocol does not constrain the language. I noticed, though, that MapiClient.py is currently hardwired for mil indeed. It seems that Sjoerd (the Python expert) can help you (and make MapiClient.py a little better?)
The main question to decide upon is the functionality required. Using ODBC would allow your application also to run on other DBMSs From the perspective of re-use that is a nice property. Ofcourse, the application builder has to spent more energy to prepare for this. Using the ODBC layer of Sjoerd would be a good exercise to challenge its current functionality. Help is close at hand to make it bearable.
Perhaps an issue to discuss with Peter (and me).
regards, Martin
Arjan Scherpenisse wrote:
Hello,
can someone point me to a simple way of using the SQL frontend from within Python? The default interface (Mapi.py) does only allow the MIL language, as far as I can see.
In the past I did it by using the ODBC module, but that was very tiresome. Is there a better way?
cheers, Arjan
------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Monetdb-developers mailing list Monetdb-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-developers
-- Arjan Scherpenisse Centrum voor Wiskunde en Informatica, Amsterdam, the Netherlands
Arjan Scherpenisse wrote:
Martin,
I have fixed the Mapi.py thanks to Niels' tips. The result strings still need parsing ofcourse. I could write my own parsing or write wrappers for the existing Mapi.h API.
Are you aware of the mapi/clients/python/Cimpl directory and its contents? It contains a Python interface to the MAPI on top of the C implementation. This code is not (yet) integrated into the build process because it requires a newer version of SWIG than is installed by default on RedHat 9. It does provide a much more complete and more Python-like interface than the native Python code. I think this code should definitely be considered when thinking about a Python Database API wrapper. In a short discussion Stefan, Marcin and I have had, we concluded that the native code (Python/Perl/whatever) should be kept simple and a more complete interface could be provided using techniques such as SWIG. One reason for this is that we felt we didn't want to support many different implementations of the same underlying protocol (MAPI) which is still under development.
I am willing to implement a Python database wrapper according to the Python Database API specs (http://www.python.org/peps/pep-0249.html).
Maybe we can talk about this tomorrow with Peter, and how something like this can fit into my graduation work ;)
regards, Arjan
Martin Kersten wrote:
Arjan,
It supprises me, because the Mapi protocol does not constrain the language. I noticed, though, that MapiClient.py is currently hardwired for mil indeed. It seems that Sjoerd (the Python expert) can help you (and make MapiClient.py a little better?)
The main question to decide upon is the functionality required. Using ODBC would allow your application also to run on other DBMSs From the perspective of re-use that is a nice property. Ofcourse, the application builder has to spent more energy to prepare for this. Using the ODBC layer of Sjoerd would be a good exercise to challenge its current functionality. Help is close at hand to make it bearable.
Perhaps an issue to discuss with Peter (and me).
regards, Martin
Arjan Scherpenisse wrote:
Hello,
can someone point me to a simple way of using the SQL frontend from within Python? The default interface (Mapi.py) does only allow the MIL language, as far as I can see.
In the past I did it by using the ODBC module, but that was very tiresome. Is there a better way?
cheers, Arjan
------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ Monetdb-developers mailing list Monetdb-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-developers
--
Sjoerd Mullender
Sjoerd Mullender wrote:
Arjan Scherpenisse wrote:
Martin,
I have fixed the Mapi.py thanks to Niels' tips. The result strings still need parsing ofcourse. I could write my own parsing or write wrappers for the existing Mapi.h API.
Are you aware of the mapi/clients/python/Cimpl directory and its contents? It contains a Python interface to the MAPI on top of the C implementation. This code is not (yet) integrated into the build process because it requires a newer version of SWIG than is installed by default on RedHat 9. It does provide a much more complete and more Python-like interface than the native Python code.
I think this code should definitely be considered when thinking about a Python Database API wrapper.
Yeah, I noticed this Cimpl directory yesterday evening. Looks very nice indeed. It would certainly be a good idea to build the DB API on top of this module. Arjan
participants (2)
-
Arjan Scherpenisse
-
Sjoerd Mullender