On Jan 16, 2010, at 12:08 PM, PauloS wrote:

> On 15 jan, 14:47, "Michael Bayer" <[email protected]> wrote:
>> 
>>> How can I circunvent this?
>> 
>> use db.ahr_relat.c.query ?
>> 
> 
> Yes, Mike, how can I access the column called "query" in the table
> ahr_relat?

OK SQLSoup is using the Session.extension which adds a ".query" attribute 
unconditionally.   this bug is fixed in trunk.   I can't do it in 0.5 since 
.query is a public API that people might be relying upon.   To work around in 
0.5 do:

sqlsoup = SqlSoup(engine)
my_table = Table("my_table", Column("query", String, key="query_col"), 
autoload=True, autoload_with=engine)
MyClass = sqlsoup.map(my_table)

# use MyClass.query_col 



> 
> Calling db.ahr_relat.c.query will raise "AttributeError: query" as
> expected, given that db.ahr_relat.c.has_key('query') is False (as
> demonstrated in the previous example I sent).
> 
> Look:
> 
>>>> r = db.ahr_relat.first()
>>>> r.c.query
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.5.5-
> py2.6.egg/sqlalchemy/util.py", line 649, in __getattr__
>    raise AttributeError(key)
> AttributeError: query
>>>> r._table.c.query
> Column(u'query', PGText(length=None, convert_unicode=False,
> assert_unicode=None), table=<ahr_relat>)
> 
> Thanks in advance,
> --
> Paulo
> -- 
> 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.
> 
> 

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