Im trying to run through this tutorial 
http://www.sqlalchemy.org/docs/05/ormtutorial.html.

After running.

>>> from sqlalchemy.ext.declarative import declarative_base

>>> Base = declarative_base()
>>> class User(Base):
...     __tablename__ = 'users'
...
...     id = Column(Integer, primary_key=True)
...     name = Column(String)
...     fullname = Column(String)
...     password = Column(String)
...
...     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)

I got an error.

Traceback (most recent call last):
  File "<ipython console>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.5.5-
py2.6.egg/sqlalchemy/ext/declarative.py", line 546, in __init__
    _as_declarative(cls, classname, dict_)
  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.5.5-
py2.6.egg/sqlalchemy/ext/declarative.py", line 539, in _as_declarative
    cls.__mapper__ = mapper_cls(cls, table, properties=our_stuff,
**mapper_args)
  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.5.5-
py2.6.egg/sqlalchemy/orm/__init__.py", line 749, in mapper
    return Mapper(class_, local_table, *args, **params)
  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.5.5-
py2.6.egg/sqlalchemy/orm/mapper.py", line 198, in __init__
    self._configure_pks()
  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.5.5-
py2.6.egg/sqlalchemy/orm/mapper.py", line 439, in _configure_pks
    "key columns for mapped table '%s'" % (self,
self.mapped_table.description))
ArgumentError: Mapper Mapper|User|users could not assemble any primary
key columns for mapped table 'users'


Any ideas why this happens?

rgds,
Paulo

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to