On 7.5.2012, at 20:27, Michael Bayer wrote:

> 
> On May 7, 2012, at 2:03 PM, Stefan Urbanek wrote:
> 
>> Thanks, this is partially helpful. However, in the example there is:
>> 
>> stuff_view = view("stuff_view"...
>> 
>> and not:
>> 
>> stuff_view = Table("stuff_view"...
>> 
>> My problem is, that I get just a name and expect TABLE or VIEW and I am 
>> replacing TABLE or VIEW with TABLE or VIEW. To be able to replace something, 
>> I need to drop the something. To be able to drop the something, I need to 
>> know how to drop it, therefore I need to know whether it is a table (DROP 
>> TABLE) or a view (DROP VIEW). All I have is just a name.
> 
> normally, whenever you got the name "stuff_view", it would be defined at that 
> moment if that name represents a table or view.
> 
> is this reflection you're talking about ?    yeah I was never a huge fan of 
> how view reflection got implemented.   you'd need run 
> inspector.get_view_names() for now to get those names that represent views:
> 
> from sqlalchemy.engine.reflection import Inspector
> 
> view_names = Inspector.from_engine(someengine).get_view_names()


My fault: Yes, I apologize for not mentioning that. I was thinking about 
reflection.

Thank you, the inspector (from description and docs) seems to be sufficient for 
the time being. I will try that.

Stefan

p.s.: On the other hand, Table.is_view might be a good flag - to maintain 
consistency with the fact that Table() can reflect a view. However, I am not 
sure how does that fit into overall design of the library.



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