On Sep 18, 2007, at 8:29 AM, svilen wrote:

>
> g'day
> i have a case where one bindparam's shortname conflicts with another
> bindparam's key.
>
> The sql.Column._bindparam assigns columns name as bindparam's
> shortname, while haveing the full calculated _label as its key, and
> the bindparam is requested unique. later, in
> Compiler.visit_bindparam, both key and shortname, that is, col._label
> and col.name are associated with this bindparam, but: shortname goes
> as is, while the key is being uniquied by appending some _%d count to
> it.

shortname stays the same, the long name gets mangled, but *both* are  
available for usage (in un-mangled form) as a name you can use in the  
parameter dict sent to execute().

>
> And i have another plain bindparam using the that same column name as
> its key, and this conflicts with above.

yeah, as of yet, this isnt supported (making your own bindparams with  
the same shortnames as the auto-genertaed ones).  the names assigned  
to "shortname", a very long time ago, were intended to be "well  
defined" such that you can override the auto-generated bindparams  
using parameters sent to execute().  in the case of inserts and  
updates, this is still very important.  in the case of WHERE  
criterion in update/delete as well as selects, its not clear how  
useful this feature really is.  but its been there since pre-0.1.0,  
so, might be tricky to change now.

>
> i know i can rename all me-made bindparams, or prefix or something,
> but why is the (longer) key being mangled with count, while (shorter)
> shortname is directly put as is and not mangled too?

the longer name is the one that gets generated into the SQL  
statement.  however, the non-mangled longer name (as well as the  
short name) is still usable from within the execute() parameters.



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