I suddenly started seeing an error in my Python SQLAlchemy application and I can't figure out what's causing it. My code looks like this:
from sqlalchemy import create_engine
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy.ext.declarative import declarative_base
def loadConnection(connection_string, echo=False):
engine = create_engine(connection_string, echo=echo)
Base = declarative_base(engine)
Session = sessionmaker(bind=engine)
session = Session()
return session, Base
connection = yaml.load('connection.yaml')
session, Base = loadConnection(connection['connection'], connection['echo'])
class Foo(Base):
__tablename__ = 'foo'
id = Column(Integer(11), primary_key=True)
And when I run this script I get the following error:
Traceback (most recent call last):
File "ephem/database_interface.py", line 52, in <module>
class Foo(Base):
File "ephem/database_interface.py", line 54, in Foo
id = Column(Integer(11), primary_key=True)
TypeError: object() takes no parameters
I am using SQLAlchemy 0.9.1. My backend is MySQL running on the localhost. As far as I can tell by inspecting with pdb connection, session, Base, Column, and Integer all seem normal.
Integertakes no arguments.