wfbsantos
unread,Jul 18, 2009, 3:36:43 PM7/18/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to juno-framework
Hello, I'm new to Juno, but I love it, simple, faster and powerful.
All works fine, least one thing:
I'm trying to create 2 tables, one have 4 columns: id (default),
username, password and active.
Ok, then I try to create one called: Perfil, who will store user
information, I try to do it:
User = model('User',
username=Column('username', String(20),
nullable=False, index=True, unique=True),
password=Column('password', CHAR(32), nullable=False),
active=Column('active', Boolean, nullable=False,
server_default='0', index=True)
)
Perfil = model('Perfil',
id_user=Column('id_user', ForeignKey('User.id',
onupdate='CASCADE', ondelete='CASCADE'), nullable=False, index=True,
unique=True),
email=Column('email', String(50), nullable=False,
index=True, unique=True),
)
When I do it, I get the following error message:
sqlalchemy.exc.NoReferencedTableError: Could not find table 'User'
with which to generate a foreign key
Altought, I figured out that Juno saves the table with an additional
s, then I tried: Users.id instead User.id in foreign key, but I got
the same error message, only diff in table name (now is Users).
Can anyone help me please? I think that SQL couldn't see the table
because Juno doesn't create it with Table. Or create, commit and
delete. Don't know, but SQL Alchemy doesn't find it.
Please, I need the foreign keys so much. I can do a workaround
(program the "foreign key" by my self), but isn't a good practice, and
I will lose database native validation. (I don't wanna do it in
triggers too).
Thank you in advance for your time and help.
Wagner F.