| User | CREATE TABLE `User` (
`id` int(10) unsigned NOT NULL auto_increment,
`location_id` int(10) unsigned NOT NULL,
`mail` varchar(45) NOT NULL,
`password` varchar(45) NOT NULL,
`salt` varchar(8) NOT NULL,
`phone` varchar(24) default NULL,
`organization` varchar(45) default NULL,
`status` tinyint(1) NOT NULL default '1',
`ping_max` tinyint(3) unsigned NOT NULL default '1',
`probe_max` tinyint(3) unsigned NOT NULL default '1',
PRIMARY KEY USING BTREE (`id`),
KEY `FK_User_1` (`location_id`),
CONSTRAINT `FK_User_1` FOREIGN KEY (`location_id`) REFERENCES
`Location` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
Actually, there was some information in the logs that I just noticed
that might help detect the problem (some kind of unicode issue?):
12:58:21,710 INFO [sqlalchemy.engine.base.Engine.0x..50] SHOW CREATE
TABLE `User`
12:58:21,711 INFO [sqlalchemy.engine.base.Engine.0x..50] None
12:58:21,802 WARNING sqlalchemy
/home/aj99243/lib/python2.5/site-packages/SQLAlchemy-0.4.0beta3-py2.5.egg/sqlalchemy/databases/mysql.py:1891:
RuntimeWarning: Unknown schema content: u' PRIMARY KEY USING BTREE
(`id`),'
repr(line)))
12:58:21,805 INFO sqlalchemy.engine.base.Engine.0x..50 SHOW VARIABLES
LIKE 'character_set%%'
On 8/22/07, jason kirtland <[EMAIL PROTECTED]> wrote:
>
> Hi Anil,
>
> The recent 0.4 betas have an all-new MySQL table reflection routine
> that's being tried out. It's possible that it's not picking up
> your primary key when it should- could you send in the output of
> SHOW CREATE TABLE for this table, either on or off list? Also
> there should be a warning issued if a key is detected but is not
> registered on the table.
>
>
> Anil wrote:
> >
> > Module entic.controllers.access:74 in _login
> > <<
> > # select our user
> > user_q = model.Session.query(model.User)
> > user = user_q.filter_by(mail=mail)
> >>> user_q = model.Session.query(model.User)
> > Module sqlalchemy.orm.scoping:68 in do
> > Module sqlalchemy.orm.session:642 in query
> > Module sqlalchemy.orm.mapper:1648 in class_mapper
> > Module sqlalchemy.orm.mapper:236 in compile
> > Module sqlalchemy.orm.mapper:251 in _compile_all
> > Module sqlalchemy.orm.mapper:278 in _do_compile
> > Module sqlalchemy.orm.mapper:446 in _compile_tables
> > <class 'sqlalchemy.exceptions.ArgumentError'>: Could not assemble
> > any primary key columns for mapped table 'User'
> >
> >
> > I have defined a table as such:
> > user_table = Table("User", metadata,
> > autoload=True, autoload_with=config['pylons.g'].sa_engine)
> >
> > mapper(User, user_table, properties = {
> > 'alerts':
> > relation(Alert, cascade="all, delete-orphan", lazy=False),
> > 'hosts': relation(Host,
> > cascade="all, delete-orphan", lazy=False)
> > })
> >
> > I do have a pri key set in the User table (MySQL).
> >
> > I tried to explicitly specify a primary_key even with the
> > autoload=True, but I get other exceptions after this.
> >
> > Is this a bug or an incorrect usage?
> >
> > Thanks
> >
> >
> > >
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---