NameError's are thrown usualy by import'ing or similar mechanisms.
have a look on your code.
eventualy post the whole traceback?

On Friday 11 July 2008 12:14:12 Heston James - Cold Beans wrote:
> Good morning all,
>
>
>
> So, this morning's challenge has been learning many-to-many
> relationships, after reading through the tutorial I understand most
> of the core concepts of how it should work but I'm struggling to
> actually make it do so, I thought I would come and rely on you good
> people to help me in the right direction.
>
>
>
> I have 3 tables configured in my MySQL database, for arguments sake
> let's say they're called 'post', 'keyword' and 'post_keyword'. I'm
> declaring my 'post' class like so in a module called post.py:
>
>
>
> from sqlalchemy.ext.declarative import declarative_base
>
> from sqlalchemy import Table, Column, Integer, String, MetaData,
> ForeignKey
>
> from sqlalchemy.orm import relation, backref
>
>
>
> # Configure the delarative base for SQL Alchemy.
>
> Base = declarative_base()
>
>
>
> # Define the Remote Device class.
>
> class post(Base):
>
>
>
>     # Define the table for SQL Aclchemy
>
>     __tablename__ = "post"
>
>
>
>     # Define the class properties for SQL Alchemy
>
>     id = Column(String, primary_key=True)
>
>     content = Column(String)
>
>
>
>     keywords = relation("keyword", secondary=post_keyword,
> backref='keywords')
>
>
>
> I then have a pretty much identical class declaration for 'post'
> but with the obvious changes to its name and property. However,
> when trying to use this class I get an exception thrown by
> SQLAlchemy saying:
>
>
>
> NameError: name 'remote_device_message' is not defined
>
>
>
> Which is fair enough, as it isn't, I wonder if I'm meant to import
> it somehow into that post class?
>
>
>
> All the examples I've found seem to focus on the idea of A) having
> these two classes defined in the same file and B) using an in
> memory database where you 'create' the association table in the
> script, whereas with mine it already exists in the database. It's
> making me a little confused I think.
>
>
>
> I'd really appreciate your help on showing me how this implements.
>
>
>
> Cheers,
>
>
>
> Heston
>
>
> 


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to