Ok, so here's what I'm trying to do:

    for col, msg in cols:
        if not f[col].value == '':
            stmt = tbl.select(tbl.__getattribute__(col) == f[col].value)
            res = stmt.execute()
            if res.fetchone():
                f[col].note = msg
    return f

``cols`` is a list of 2-tuples containing column names and validation
error messages. I'm trying to check tables for uniqueness. ``f`` is a
subscriptable object whose each property has associated ``value``
property, which in turn contains the value I want to check.

The above gives me an UnbountExecutionError exception. What do I need
to do to make this work? Or is there a better way of doing this?

The reason I am trying to do it like this is I need this to be generic
so I can do it for all the models I have without repeating code or
messing with circular import issues (Model classes reside in different
modules).

On Tue, Oct 12, 2010 at 10:00 PM, Branko Vukelic <bg.bra...@gmail.com> wrote:
> Failing to find any answer, and not understanding the SQLAlchemy code
> base very well yet, I've resorted to using table names instead of
> class names.
>
> On Tue, Oct 12, 2010 at 8:16 PM, Branko Vukelic <bg.bra...@gmail.com> wrote:
>> Hi, list,
>>
>> Given all models used the declarative syntax (and I assume they are
>> now all somehow known to the base), and given a class name in string
>> form, can I somehow retrieve the actual class?
>>
>> Regards,
>>
>> --
>> Branko Vukelić
>>
>> bg.bra...@gmail.com
>> stu...@brankovukelic.com
>>
>> Check out my blog: http://www.brankovukelic.com/
>> Check out my portfolio: http://www.flickr.com/photos/foxbunny/
>> Registered Linux user #438078 (http://counter.li.org/)
>> I hang out on identi.ca: http://identi.ca/foxbunny
>>
>> Gimp Brushmakers Guild
>> http://bit.ly/gbg-group
>>
>
>
>
> --
> Branko Vukelić
>
> bg.bra...@gmail.com
> stu...@brankovukelic.com
>
> Check out my blog: http://www.brankovukelic.com/
> Check out my portfolio: http://www.flickr.com/photos/foxbunny/
> Registered Linux user #438078 (http://counter.li.org/)
> I hang out on identi.ca: http://identi.ca/foxbunny
>
> Gimp Brushmakers Guild
> http://bit.ly/gbg-group
>



-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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