[sqlalchemy] Re: views declarative?
James Hartley jjhart...@gmail.com writes: Starting with the Wiki article on implementing views: http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Views Is it possible to map Table instances back to classes defined through declarative_base()? I'm not sure I understand the question, but given the reference to the recipe, 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. ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- 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.
Re: [sqlalchemy] Re: views declarative?
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. -- 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.
Re: [sqlalchemy] Re: views declarative?
On Wed, Apr 17, 2013 at 2:59 PM, 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. Set __table__ to your Table instance: http://docs.sqlalchemy.org/en/rel_0_8/orm/extensions/declarative.html#using-a-hybrid-approach-with-table Simon -- 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.