I'm plus or minus on this, not sure, but thought it might be worth
bringing up.

I had the following typo in a declarative class def:

class Foo(Base):
    __tablename__ = 'foo_table'
    __table_args_ = {'mysql_engine':'InnoDB', 'mysql_charset':'utf8'}

... so I had only one underscore character at the end of __table_args_
where I should have had two.  By failing to see this I led myself on a
wild goose chase.  MySQL refused to create another table that
references this table.  In mysql from the terminal, SHOW ENGINE INNODB
STATUS told me that the error was due to failing to reference the
parent table.  I kept trying to figure out how the Integer primary key
could be somehow mismatched with the Integer foreign key that referred
to it.

Ultimately the answer was that the referenced table was the only table
in my entire db that was using MyISAM.  I had to return to the class
definition a couple more times and finally caught the missing
underscore.

It generally does not need to be sqlalchemy's job or responsibility to
scan for typo errors.  But given that it seems to be 'reading' the
whole class definition and that it notices and warns about things like
a dangling comma after a Column specification, maybe it should watch
for single vs. double underscore in the standard __table__,
__tablename__, __table_args__, and __mapper_args__.

Not a strong contention, just tossing it out there.
- Eric

-- 
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