zzzeek / test_sqlalchemy

0 stars 0 forks source link

tutorial does not work with Informix DB #972

Closed sqlalchemy-bot closed 15 years ago

sqlalchemy-bot commented 16 years ago

Issue created by Anonymous


I am new to Sqlalchemy and started to check it with the tutorial. The database I have to use is Informix (10.3). But with that database I get the "TypeError: init() got multiple values for keyword argument 'column_keys'" Exception Traceback below. Using Postgres it runs fine.

Any idea for a work-around or fix? Thanks, Bernd

----------- Here is what I copied from the tutorial so far ----------------------

import sqlalchemy from sqlalchemy import create_engine

no Exception with this engine

engine = create_engine('postgres://bernd:password@localhost/testdb',echo=True)

engine = create_engine('informix://bernd:password@ol_fuchs/testdb',echo=True)

from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey metadata = MetaData() users_table = Table('users', metadata, Column('id', Integer, primary_key=True), Column('name', String(40)), Column('fullname', String(100)), Column('password', String(15)) ) metadata.create_all(engine) class User(object): def init(self, name, fullname, password): self.name = name self.fullname = fullname self.password = password

def __repr__(self):
   return "<User('%s','%s', '%s')>" % (self.name, self.fullname, self.password)

from sqlalchemy.orm import mapper mapper(User, users_table) ed_user = User('ed', 'Ed Jones', 'edspassword') from sqlalchemy.orm import sessionmaker Session = sessionmaker(bind=engine, autoflush=True, transactional=True) session = Session() session.save(ed_user) session.commit()

------------- Exception thrown when Informix is used -----------------------------------

Traceback (most recent call last): File "tutorial.py", line 43, in session.commit() File "C:\Python25\lib\site-packages\sqlalchemy-0.4.3-py2.5.egg\sqlalchemy\orm\session.py", line 544, in commit self.transaction.commit() File "C:\Python25\lib\site-packages\sqlalchemy-0.4.3-py2.5.egg\sqlalchemy\orm\session.py", line 250, in commit self._prepare_impl() File "C:\Python25\lib\site-packages\sqlalchemy-0.4.3-py2.5.egg\sqlalchemy\orm\session.py", line 234, in _prepare_impl self.session.flush() File "C:\Python25\lib\site-packages\sqlalchemy-0.4.3-py2.5.egg\sqlalchemy\orm\session.py", line 764, in flush self.uow.flush(self, objects) File "c:\python25\lib\site-packages\SQLAlchemy-0.4.3-py2.5.egg\sqlalchemy\orm\unitofwork.py", line 215, in flush flush_context.execute() File "c:\python25\lib\site-packages\SQLAlchemy-0.4.3-py2.5.egg\sqlalchemy\orm\unitofwork.py", line 437, in execute UOWExecutor().execute(self, tasks) File "c:\python25\lib\site-packages\SQLAlchemy-0.4.3-py2.5.egg\sqlalchemy\orm\unitofwork.py", line 927, in execute self.execute_save_steps(trans, task) File "c:\python25\lib\site-packages\SQLAlchemy-0.4.3-py2.5.egg\sqlalchemy\orm\unitofwork.py", line 942, in execute_save_steps self.save_objects(trans, task) File "c:\python25\lib\site-packages\SQLAlchemy-0.4.3-py2.5.egg\sqlalchemy\orm\unitofwork.py", line 933, in save_objects task.mapper._save_obj(task.polymorphic_tosave_objects, trans) File "c:\python25\lib\site-packages\SQLAlchemy-0.4.3-py2.5.egg\sqlalchemy\orm\mapper.py", line 1106, in _save_obj c = connection.execute(statement.values(value_params), params) File "c:\python25\lib\site-packages\SQLAlchemy-0.4.3-py2.5.egg\sqlalchemy\engine\base.py", line 846, in execute return Connection.executorsc(self, object, multiparams, params) File "c:\python25\lib\site-packages\SQLAlchemy-0.4.3-py2.5.egg\sqlalchemy\engine\base.py", line 897, in execute_clauseelement return self._execute_compiled(elem.compile(dialect=self.dialect, column_keys=keys, inline=len(params) > 1), distilled_params=params) File "C:\Python25\lib\site-packages\sqlalchemy-0.4.3-py2.5.egg\sqlalchemy\sql\expression.py", line 1043, in compile compiler = dialect.statement_compiler(dialect, self, column_keys=column_keys, inline=inline) File "C:\Python25\lib\site-packages\sqlalchemy-0.4.3-py2.5.egg\sqlalchemy\databases\informix.py", line 374, in init compiler.DefaultCompiler.init( self , dialect , statement , parameters , **kwargs ) TypeError: init() got multiple values for keyword argument 'column_keys'

sqlalchemy-bot commented 15 years ago

Michael Bayer (zzzeek) wrote:


the actual error here was fixed, even though informix has issues remaining, so closing.

sqlalchemy-bot commented 16 years ago

Michael Bayer (zzzeek) wrote:


sqlalchemy-bot commented 16 years ago

Michael Bayer (zzzeek) wrote:


unfortunately none of us (SA developers) have access to informix so we are unable to keep our test coverage working with it. I've gotten the compiler working again in 1aebdb231f395aa68bd1767ffd897189107e070a, so the error above is resolved. However, you might have other issues - informix has a lot of caveats as to what it can do and the informix dialect tries to work around these, but the tutorial would exercise a lot of things that might be tricky for that dialect.

For the purposes of the tutorial, it might be best to use it with sqlite (which is built in to Python 2.5). Or if you're willing to hit bugs, report them, and run tests for us, we can get informix covered better (just keep filing tickets).

sqlalchemy-bot commented 15 years ago

Changes by Michael Bayer (zzzeek): set state to "resolved"

sqlalchemy-bot commented 16 years ago

Changes by Michael Bayer (zzzeek): changed priority from "critical" to "minor"