[egenix-users] mxODBC Connect integration with SQLAlchemy

M.-A. Lemburg mal at egenix.com
Tue Aug 19 19:42:26 CEST 2014


Hi Baiju,

On 19.08.2014 15:19, Baiju M wrote:
> Hi,
> 
> Can I use mxODBC Connect with SQLAlchemy ?
> Is there any documentation on this ?

It should be possible to reuse the existing mxODBC support in SQLAlchemy
for mxODBC Connect as well, but we have not looked into this yet:

https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/connectors/mxodbc.py

Here's an example of how to use the mxODBC Connect Client (section 4.3
of the documentation):

http://www.egenix.com/products/python/mxODBCConnect/doc/#_Toc388647689

>From looking at the SA code, a couple of changes seem to be necessary:

 * class methods need to be adapted to open the server connection
   to mxODBC Connect Server

 * error handler has to be replaced with a conn.warningformat =
   self.dbapi.WARN_WARNINGFORMAT or .IGNORE_WARNINGFORMAT

   Note that warnings will be emitted on the server, not the client
   side if you use .WARN_WARNINGFORMAT.

 * some session cleanup code will have to be added to close down
   the server session when it is no longer needed to free up
   resources

Apart from that, the code should work with mxODBC Connect as well.

Regards,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Aug 19 2014)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________
2014-09-19: PyCon UK 2014, Coventry, UK ...                31 days to go

::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/



More information about the egenix-users mailing list