- changed status to wontfix
Composite Primary Key mapping that works in 0.4.8 is broken in 0.5.3
+------------+--------------+------+-----+-------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+-------------------+-------+
| userid | int(11) | NO | PRI | 0 | |
| fieldname | varchar(255) | NO | PRI | | |
| fieldvalue | varchar(255) | NO | | | |
| timestamp | timestamp | NO | | CURRENT_TIMESTAMP | |
+------------+--------------+------+-----+-------------------+-------+
4 rows in set (0.00 sec)
user_info_table = Table("UserInfo", registration_metadata, Column("userid", types.Integer(11), nullable=False), Column("fieldname", types.String(255), nullable = False, default = None), Column("fieldvalue", types.String(255), nullable = False, default = None), Column("timestamp", types.DateTime, nullable = False), PrimaryKeyConstraint("userid", "fieldname"),
mysql_engine = "myIsam"
)
The above mapping works correctly using 0.4.8. When upgrading to 5.3 I get the following error:
Traceback (most recent call last): File "/usr/local/bin/paver", line 8, in <module> load_entry_point('Paver==0.8.1', 'console_scripts', 'paver')() File "/Library/Python/2.5/site-packages/Paver-0.8.1-py2.5.egg/paver/command.py", line 48, in main setuputils.setup(setupargs) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/core.py", line 151, in setup dist.run_commands() File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/dist.py", line 974, in run_commands self.run_command(cmd) File "/Library/Python/2.5/site-packages/Paver-0.8.1-py2.5.egg/paver/setuputils.py", line 167, in run_command cmd_obj.run() File "/Library/Python/2.5/site-packages/Paver-0.8.1-py2.5.egg/paver/runtime.py", line 328, in run self.task_obj() File "/Library/Python/2.5/site-packages/Paver-0.8.1-py2.5.egg/paver/runtime.py", line 377, in call return self.func(*args, kw) File "pavement.py", line 47, in start_local_server from dartoo.application import get_wsgi_application File "src/dartoo/application.py", line 10, in <module> import dartoo.state as state File "src/dartoo/state.py", line 2, in <module> from dartoo.models.registration import User, UserInfo,UserP File "src/dartoo/models/registration.py", line 109, in <module> column_prefix = "SA", File "/Library/Python/2.5/site-packages/SQLAlchemy-0.5.2-py2.5.egg/sqlalchemy/orm/init.py", line 752, in mapper return Mapper(class_, local_table, args, *params) File "/Library/Python/2.5/site-packages/SQLAlchemy-0.5.2-py2.5.egg/sqlalchemy/orm/mapper.py", line 199, in init self._configure_pks() File "/Library/Python/2.5/site-packages/SQLAlchemy-0.5.2-py2.5.egg/sqlalchemy/orm/mapper.py", line 443, in _configure_pks "key columns for mapped table '%s'" % (self, self.mapped_table.description)) sqlalchemy.exc.ArgumentError: Mapper Mapper|UserInfo|UserInfo could not assemble any primary key columns for mapped table 'UserInfo'.
The issue appears to be around the composite primary key. Mapping the primary keys using the "primary_key" argument int The column constructor yields the same behavior. However, if I just make 1 column a PK there is no exception.
Comments (2)
-
repo owner -
repo owner - removed milestone
Removing milestone: 0.5.xx (automated comment)
- Log in to comment
sorry, this can't be reproduced.
output: