Re: [sqlalchemy] Mapping views as Table/ORM

2013-08-13 Thread temp4746
Seems like a reasonable way to do this until maybe one day proper support 
is added to sqlalchemy.
 
I'm still missing one thing though, it seems like there is a feature that 
allows you to reflect views, but it reflects them as a Table and as such 
when you later on try to create_all(), it will recreate the view as a table 
in the database, is there any way to use reflection while avoiding this 
side effect?
בתאריך יום שישי, 9 באוגוסט 2013 13:11:59 UTC+3, מאת werner:

 On 09/08/2013 10:55, temp...@gmail.com javascript: wrote: 
  It seems that SQLAlchemy has no support for creating views by a View 
  construct or something like that but you can map them as a Table or 
  even an ORM class when applicable, and query from them, the problem is 
  that SQLAlchemy will than try to create them as a new table when you 
  issue metadata.create_all(), is there a convenient way around this, 
  without having to pass a list of tables to create_all? 
 Maybe this recipe will help. 

 http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Views 

 Werner 


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sqlalchemy] Mapping views as Table/ORM

2013-08-13 Thread Michael Bayer
maybe use a separate MetaData collection when reflecting your views, so that 
create_all() isn't impacted.  The View recipe could also be enhanced to support 
reflection, you can use the inspector to get at lists of columns individually: 
http://docs.sqlalchemy.org/en/rel_0_8/core/schema.html?highlight=inspector.get_columns#sqlalchemy.engine.reflection.Inspector.get_columns


On Aug 13, 2013, at 2:45 PM, temp4...@gmail.com wrote:

 Seems like a reasonable way to do this until maybe one day proper support is 
 added to sqlalchemy.
  
 I'm still missing one thing though, it seems like there is a feature that 
 allows you to reflect views, but it reflects them as a Table and as such 
 when you later on try to create_all(), it will recreate the view as a table 
 in the database, is there any way to use reflection while avoiding this side 
 effect?
 בתאריך יום שישי, 9 באוגוסט 2013 13:11:59 UTC+3, מאת werner:
 On 09/08/2013 10:55, temp...@gmail.com wrote: 
  It seems that SQLAlchemy has no support for creating views by a View 
  construct or something like that but you can map them as a Table or 
  even an ORM class when applicable, and query from them, the problem is 
  that SQLAlchemy will than try to create them as a new table when you 
  issue metadata.create_all(), is there a convenient way around this, 
  without having to pass a list of tables to create_all? 
 Maybe this recipe will help. 
 
 http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Views 
 
 Werner 
 
 -- 
 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.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [sqlalchemy] Mapping views as Table/ORM

2013-08-09 Thread Werner

On 09/08/2013 10:55, temp4...@gmail.com wrote:
It seems that SQLAlchemy has no support for creating views by a View 
construct or something like that but you can map them as a Table or 
even an ORM class when applicable, and query from them, the problem is 
that SQLAlchemy will than try to create them as a new table when you 
issue metadata.create_all(), is there a convenient way around this, 
without having to pass a list of tables to create_all?

Maybe this recipe will help.

http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Views

Werner

--
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.
For more options, visit https://groups.google.com/groups/opt_out.