Table is not meant for subclassing, so you would need to read the source code 
to understand these issues.   The issue below cannot be reproduced:

from sqlalchemy import *

class MyTable(Table):

    def __init__(self, name, metadata, *args, **kwargs):
        super(MyTable, self).__init__(name, metadata, *args, **kwargs)


    def bar(self):
         return "hi"

m = MetaData()
mt = MyTable('foo', m, Column('id', Integer))

print mt.bar()


0.7 output:
hi

0.6 output:
hi

0.5 output:
hi



On Feb 22, 2011, at 8:30 AM, bool wrote:

> I wrote a simple subclass of Table
> 
> ====================================================
> class MyTable(Table):
> 
>    def __init__(self, name, metadata, *args, **kwargs):
>        """
>        """
>        super(MyTable, self).__init__(name, metadata, *args, **kwargs)
> 
> 
>    def select(self, whereclause=None):
>        return super(BitemporalTable, self).select(self.c.z > 1)
> ==================================================
> 
> select(t) where t is an object of MyTable is giving this error. What
> is the solution...
> 
> Traceback (most recent call last):
>  File "t.py", line 16, in <module>
>    select(t)
>  File "/prod/tools/infra/SQLAlchemy-0.5.5-py2.5.egg/sqlalchemy/sql/
> expression.py", line 246, in select
>    s = Select(columns, whereclause=whereclause, from_obj=from_obj,
> **kwargs)
>  File "/prod/tools/infra/SQLAlchemy-0.5.5-py2.5.egg/sqlalchemy/sql/
> expression.py", line 3239, in __init__
>    [_literal_as_column(c) for c in columns]
> TypeError: 'MyTable' object is not iterable
> 
> -- 
> 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 
> sqlalchemy+unsubscr...@googlegroups.com.
> 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 sqlalchemy@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