title: python/sqlachemy/ibmdb2 - sqlAlchemy insert with Db2 for i, AS400?
body: <p>Trying to use sqlAlchemy with IBM Db2 AS400 (IBM i7.2) database. but get an error while adding objects in the database via sqlAlchemy query.</p>
  
  <pre><code>class Client(Base):
      """
      Client Account Schema
      """
      __tablename__ = 'client'
      client_id = Column('client_id', Integer, primary_key=True, nullable=False)
      client_name = Column('client_name', String(200))
      client_address = Column('client_name', Text)
  
  input_client_data = {'client_name': 'test', 'client_address': 'client address'}
  
  with conn.db_session() as session:
      client = Client(**input_client_data)
      session.add(client)
      session.commit()
  </code></pre>
  
  <blockquote>
    <p><strong>Error</strong> - pyodbc.Cursor' object has no attribute 'lastrowid</p>
  </blockquote>
  
  <p>Also we are using IBM i access ODBC drivers to connect to Db2. My connection string is below:</p>
  
  <p><code>ibm_db_sa+pyodbc400://{user}:{password}@{host}:{port}/{database}</code></p>
  
  <ol>
  <li>SQL Alchemy version: 1.3.6 </li>
  <li>IBM DB SA version: 0.3.5 </li>
  <li>Python: 3.5</li>
  <li>Platform: Ubuntu 16.04</li>
  </ol>
  
  <p>Details of drivers -</p>
  
  <pre><code>[iSeries Access ODBC Driver]
  Description=IBM i Access for Linux ODBC Driver
  Driver=/opt/ibm/iaccess/lib/libcwbodbc.so
  Setup=/opt/ibm/iaccess/lib/libcwbodbcs.so
  Driver64=/opt/ibm/iaccess/lib64/libcwbodbc.so
  Setup64=/opt/ibm/iaccess/lib64/libcwbodbcs.so
  Threading=0
  DontDLClose=1
  UsageCount=1
  </code></pre>