On Apr 17, 2013, at 9:59 AM, James Hartley <jjhart...@gmail.com> wrote:

> On Wed, Apr 17, 2013 at 6:20 AM, Lele Gaifax <l...@metapensiero.it> wrote:
> James Hartley <jjhart...@gmail.com> writes:
> > Is it possible to map Table instances back to classes defined through
> > declarative_base()?
> 
> ...I assume you are asking whether you can map a "view" onto a
> Python class using the declarative layer. If so, yes, SQLAlchemy does
> not care about how the underlying table is implemented, it will issue
> the same SQL in either cases.
> 
> 
> Thanks for your reply.  Any hints on how to tie a class inheriting from Base 
> to a Table?  I have been unsuccessful in bridging the two.

the typical form is:

Base = declarative_base()

some_table = Table('some_table', Base.metadata, Column('id', Integer, 
primary_key=True))

class SomeClass(Base):
   __table__ = some_table


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to