Hi everyone,

I'm new to SqlAlchemy, but I've got some things working and really am
enjoying it. Right now I'm trying to ORM map some existing MySQL
database tables to a class. I've read the documentation, I guess I'm
just not getting it. Can someone help me out. I've done this:

# initialize the sqlite engine and SqlAlchemy base objects
engine = create_engine('mysql://username:@hostname/database', echo=True)
meta = MetaData(engine)

myTable = Table('mytable', meta, autoload=True)
l = [c.name for c in pressrouting.columns]
print l

And this works fine, but if I try this:

# initialize the sqlite engine and SqlAlchemy base objects
engine = create_engine('mysql://username:@hostname/database', echo=True)
meta = MetaData(engine)
Base = declarative_base(metadata=meta)        

class MyTable(Base):
    __tablename__ = "mytable"
    Pass

I get this error:

sqlalchemy.exc.ArgumentError: Mapper Mapper|MyTable|mytable could not
assemble any primary key columns for mapped table 'mytable'

What is this error message trying to tell me?

Thanks in advance,
Doug

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to