mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-10 18:44:20 +02:00
Added db.create_view(name, sql) method
This commit is contained in:
parent
741e8f7fe5
commit
a86c3ee832
2 changed files with 16 additions and 0 deletions
|
|
@ -133,3 +133,10 @@ def test_insert_dictionaries_and_lists_as_json(fresh_db, data_structure):
|
|||
row = fresh_db.conn.execute("select id, data from test").fetchone()
|
||||
assert row[0] == 1
|
||||
assert data_structure == json.loads(row[1])
|
||||
|
||||
|
||||
def test_create_view(fresh_db):
|
||||
fresh_db["data"].insert({"foo": "foo", "bar": "bar"})
|
||||
fresh_db.create_view("bar", "select bar from data")
|
||||
rows = fresh_db.conn.execute("select * from bar").fetchall()
|
||||
assert [("bar",)] == rows
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue