On Aug 27, 2007, at 1:16 PM, mc wrote:

>
> Hi,
> I have the following two tables (in MySql):
>
> CREATE TABLE `A` (
>   `xkey` varchar(200) NOT NULL,
>   `yval` int(11) default NULL,
>   PRIMARY KEY  (`xkey`)
> ) ENGINE=InnoDB;
>
> and
>
> CREATE TABLE `B` (
>   `xkey` varchar(200) NOT NULL default '',
>   `s` enum('yes','no') NOT NULL default 'yes',
>   PRIMARY KEY  (`xkey`,`s`)
> ) ENGINE=InnoDB;
>
> The following statement worked fine till 0.3.8 , and from 0.3.9 throws
> the exception:
>
> oj=outerjoin(A, B,  and_(A.c.xkey==B.c.xkey, B.c.s=='yes'))
>
>
> Traceback (most recent call last):
>   File "join.py", line 13, in ?
>     oj=outerjoin(A, B,  and_(A.c.xkey==B.c.xkey, B.c.s=='yes'))
>   File "/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.3.9-
> py2.4.egg/sqlalchemy/sql.py", line 117, in outerjoin
>     return Join(left, right, onclause, isouter = True, **kwargs)
>   File "/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.3.9-
> py2.4.egg/sqlalchemy/sql.py", line 2256, in __init__
>     self._init_primary_key()
>   File "/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.3.9-
> py2.4.egg/sqlalchemy/sql.py", line 2287, in _init_primary_key
>     if p.references(c) or (c.primary_key and not p.primary_key):
> AttributeError: '_BindParamClause' object has no attribute
> 'primary_key'
>
>
> Note, if B.s were not an enum but a varchar, it would have worked.
>
> 1) Is this a usage error or a bug?

its a bug, its ticket 768.


> 2) If the latter. How can i work around it?

override the "enum" column in the table with a regular String or  
similar on the Python side.



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