can you send the "SHOW CREATE TABLE", I'll copy it exactly

On Mar 11, 2013, at 9:59 AM, Felix Schwarz <felix.schw...@oss.schwarz.eu> wrote:

> Hey,
> 
> I'm trying to use reflection with SQLAlchemy 0.8 but I always get this 
> exception:
> sqlalchemy.exc.ArgumentError: Mapper Mapper|links|links could not assemble any
> primary key columns for mapped table 'links'
> 
> mysql> show fields from links;
> +--------+-----------------+------+-----+---------+-------+
> | Field  | Type            | Null | Key | Default | Extra |
> +--------+-----------------+------+-----+---------+-------+
> | l_from | int(8) unsigned | NO   | PRI | 0       |       |
> | l_to   | int(8) unsigned | NO   | PRI | 0       |       |
> +--------+-----------------+------+-----+---------+-------+
> 2 rows in set (0.00 sec)
> 
> The class definition is pretty simple:
> 
> class links(Base):
>    __table__ = Table('links', Base.metadata, autoload=True)
> 
> Traceback:
> File "…/main.py", line 36, in connect_to_db
>    class links(Base):
> File "…/sqlalchemy/ext/declarative.py", line 1343, in __init__
>    _as_declarative(cls, classname, cls.__dict__)
> File "…/sqlalchemy/ext/declarative.py", line 1336, in _as_declarative
>    **mapper_args)
> File "…/sqlalchemy/orm/__init__.py", line 1129, in mapper
>    return Mapper(class_, local_table, *args, **params)
> File "…/sqlalchemy/orm/mapper.py", line 203, in __init__
>    self._configure_pks()
> File "…/sqlalchemy/orm/mapper.py", line 773, in _configure_pks
>    (self, self.mapped_table.description))
> 
> Any idea why this happens and how I fix the problem? (without having to
> specify the ORM mapping myself)
> 
> fs
> 
> -- 
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to