mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-19 06:54:25 +02:00
db.table() only returns tables, added db.view()
* db.table() only returns tables, added db.view(), closes #657 * Massive documentation update for db.table() Refs #656
This commit is contained in:
parent
d892d2ae49
commit
094b010fd8
6 changed files with 276 additions and 229 deletions
|
|
@ -129,7 +129,7 @@ def test_uses_counts_after_enable_counts(counts_db_path):
|
|||
db = Database(counts_db_path)
|
||||
logged = []
|
||||
with db.tracer(lambda sql, parameters: logged.append((sql, parameters))):
|
||||
assert db["foo"].count == 1
|
||||
assert db.table("foo").count == 1
|
||||
assert logged == [
|
||||
("select name from sqlite_master where type = 'view'", None),
|
||||
("select count(*) from [foo]", []),
|
||||
|
|
@ -138,7 +138,7 @@ def test_uses_counts_after_enable_counts(counts_db_path):
|
|||
assert not db.use_counts_table
|
||||
db.enable_counts()
|
||||
assert db.use_counts_table
|
||||
assert db["foo"].count == 1
|
||||
assert db.table("foo").count == 1
|
||||
assert logged == [
|
||||
(
|
||||
"CREATE TABLE IF NOT EXISTS [_counts](\n [table] TEXT PRIMARY KEY,\n count INTEGER DEFAULT 0\n);",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue