Looks like I wasn't looking at it correctly then...

What I did so far lets it pass through statements using execute() which is 
what I need for now but at least I know not to spend much more time on it.

I just took another look at the ibm_db_sa and installed it but it seems to 
have Python 3 issues, I'll submit a request on the google code site for it 
and see where I get.

Thanks for letting me know

On Wednesday, June 11, 2014 4:16:19 AM UTC-7, Jaimy Azle wrote:
>
> Actually the ibm_db_sa support several methods to connect to iSeries; 
> natively through ibm_db, pyodbc, or jdbc (with jython). 
>  On Jun 8, 2014 8:53 AM, "Cory Lutton" <cory....@gmail.com <javascript:>> 
> wrote:
>
>> Thanks for such a quick reply.  Great to hear that I am starting out on 
>> the right path with building a dialect, I have some work to do so I just 
>> wanted to make sure I wasn't missing something before I spend the time.  
>> Hopefully I can get things working enough where I can post it somewhere.
>>
>> I have looked at that IBM DB package, unfortunately the iSeries is a 
>> "remote" connection using ibm_db meaning I would have to get the Enterprise 
>> DB2 connect or get a special quote for unlimited.... makes me laugh a bit 
>> what the listed price is.
>>
>> On Saturday, June 7, 2014 5:48:02 PM UTC-7, Michael Bayer wrote:
>>>
>>>
>>> On Jun 7, 2014, at 8:27 PM, Cory Lutton <cory....@gmail.com> wrote:
>>>
>>> I have been looking at using sqlalchemy in an internal company cherrypy 
>>> application I am working on.  It will need to interface with my companies 
>>> iSeries server in order to use ERP data.  I have been using pyodbc so far 
>>> and everything works great.  I am thinking of adding access to another 
>>> database that is postgres.  Rather than write that stuff again, I was 
>>> thinking about trying to use sqlalchemy.  If I use that I would want to use 
>>> it for both....one for the iSeries (DB2) and one for postgres......
>>>
>>> So, I started writing a "dialect" for iseries+pyodbc and want to make 
>>> sure I am headed down the right path.  It seems to be working so far.... 
>>> import sqlalchemy as sa
>>> import sqlalchemy_iseries
>>> from urllib.parse import quote
>>>     
>>> engine = sa.create_engine(
>>>         "iseries+pyodbc:///?odbc_connect={connect}".format(
>>>             connect=quote(connect)), pool_size=1)
>>> con = engine.connect()
>>>
>>> # Only using like a pyodbc cursor, executing specifically created 
>>> statements.
>>> rows = con.execute("SELECT * FROM alpha.r50all.lbmx")
>>>
>>> # Access via name like a dictionary rather than row.LBID
>>> for row in rows:
>>>     print(row['LBID'])
>>>
>>> con.close()
>>>
>>> Being new to sqlalchemy I am hoping to get some advice on whether what I 
>>> am doing below is basically going in the right direction or point me in the 
>>> right direction if I am headed the wrong way (or reinventing something) 
>>> .....
>>>
>>> Here is what I have so far...
>>>
>>> *__init__.py:*
>>> from sqlalchemy.dialects import registry
>>> from . import pyodbc
>>>
>>> dialect = pyodbc.dialect
>>>
>>> registry.register("iseries.pyodbc", "sqlalchemy_iseries", "dialect")
>>>
>>> *base.py:*
>>> from sqlalchemy.engine import default
>>>
>>> class ISeriesDialect(default.DefaultDialect):
>>>     name = 'iseries'
>>>     max_identifier_length = 128
>>>     schema_name = "qgpl"
>>>
>>>
>>> *pyodbc.py:*
>>> from .base import ISeriesDialect
>>> from sqlalchemy.connectors.pyodbc import PyODBCConnector
>>>
>>> class ISeriesDialect_pyodbc(PyODBCConnector, ISeriesDialect):
>>>     pyodbc_driver_name = 'iSeries Access ODBC Driver'
>>>
>>>     def _check_unicode_returns(self, connection):
>>>         return False
>>>
>>> dialect = ISeriesDialect_pyodbc
>>>
>>>
>>>
>>> looks great.    if you want examples of the full format, take a look at 
>>> some of the existing external dialects at http://docs.sqlalchemy.org/
>>> en/rel_0_9/dialects/index.html#external-dialects.
>>>
>>> Are you sure that the IBM DB SA dialect doesn’t cover this backend 
>>> already?  They have support for pyodbc + DB2, but I’m not really sure how 
>>> “iSeries” differs.  https://code.google.com/p/ibm-db/
>>>
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sqlalchemy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sqlalchemy+...@googlegroups.com <javascript:>.
>> To post to this group, send email to sqlal...@googlegroups.com 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/sqlalchemy.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to