sqlalchemy-views
                                
                                 sqlalchemy-views copied to clipboard
                                
                                    sqlalchemy-views copied to clipboard
                            
                            
                            
                        ORM Support?
I'm confused as to if this adds view support to the SQLAlchemy ORM? As in, how would I go about defining a view model with this (that would be created/dropped automatically when the create_all/drop_all commands are used)?
Ideally one would be able to do something like:
class MyView(ModelView):
    definition = 'SELECT * FROM mytable'
    # column declaration that reflects the SQL
But I'm not sure if this addon allows for anything remotely like that.
Was looking at an old recipe (https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/Views) but it's using the deprecated execute_at. Tried replicating it using the new DDL events, which went alright I think, however, it still (obviously) emits the normal create and drop statements. Which means it's creating a table, then tries to create a view. Maybe we're supposed to override the create and drop functions instead?
I haven't personally used the ORM much, so the use cases there aren't immediately obvious to me. I'll try to take more of a look at your suggestions later this week.
No worries. After a ton of researching and experimenting, I successfully came up with a solution that works (so far): https://stackoverflow.com/a/49894177/998919.