Here is my model ...
# -*- coding: utf-8 -*-
"""Sample model module."""

from sqlalchemy import *
from sqlalchemy.orm import mapper, relation
from sqlalchemy import Table, ForeignKey, Column
from sqlalchemy.types import Integer, Unicode
from sqlalchemy.orm import relation, backref

from mygtd.model import DeclarativeBase, metadata, DBSession


class Users(DeclarativeBase):
    __tablename__ = 'users'
    id = Column(Integer, primary_key=True)
    name = Column(Unicode(255), nullable=False)
    def __init__(self,name):
        self.name = name

class Address(DeclarativeBase):
    __tablename__ = 'addresses'
    id = Column(Integer, primary_key=True)
    email_address = Column(String)
    people_id = Column(Integer, ForeignKey('users.id'))
    person = relation(Users, backref=backref('addresses',
order_by=id))
    def __init__(self, email_address):
        self.email_address = email_address
    def __repr__(self):
        return "<Address('%s')>" % self.email_address

when i run paster setup-app development.ini i get ...
 raise exc.DBAPIError.instance(statement, parameters, e,
connection_invalidated=is_disconnect)
sqlalchemy.exc.ProgrammingError: (ProgrammingError) (1064, "You have
an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ' \n\tpeople_id
INTEGER, \n\tPRIMARY KEY (id), \n\t FOREIGN KEY(people_id) REFERENCES
u' at line 3") '\nCREATE TABLE addresses (\n\tid INTEGER NOT NULL
AUTO_INCREMENT, \n\temail_address VARCHAR, \n\tpeople_id INTEGER, \n
\tPRIMARY KEY (id), \n\t FOREIGN KEY(people_id) REFERENCES users (id)
\n)\n\n' ()

I have been banging away at this all afternoon any help would be
appreciated.
Code was pretty much copied from the sqlalchemy tutorial as a test.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to