Ability to introspect and run queries against views (#55)

* db.views_names() method and and db.views property
* Separate View and Table classes, both subclassing new Queryable class
* view.drop() method
* Updated documentation
This commit is contained in:
Simon Willison 2019-08-23 15:19:41 +03:00 committed by GitHub
commit 9faa982226
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 142 additions and 56 deletions

View file

@ -782,3 +782,10 @@ def test_drop(fresh_db):
assert ["t"] == fresh_db.table_names()
assert None is fresh_db["t"].drop()
assert [] == fresh_db.table_names()
def test_drop_view(fresh_db):
fresh_db.create_view("foo_view", "select 1")
assert ["foo_view"] == fresh_db.view_names()
assert None is fresh_db["foo_view"].drop()
assert [] == fresh_db.view_names()