mirror of
https://github.com/simonw/datasette.git
synced 2026-09-16 21:44:07 +02:00
Expanded analysis of SQL operations, refs #2748
This commit is contained in:
parent
9f66cf72c1
commit
737ff03efb
9 changed files with 740 additions and 120 deletions
|
|
@ -698,14 +698,17 @@ async def test_analyze_sql():
|
|||
|
||||
assert [
|
||||
(
|
||||
access.operation,
|
||||
access.database,
|
||||
access.sqlite_schema,
|
||||
access.table,
|
||||
access.columns,
|
||||
access.source,
|
||||
operation.operation,
|
||||
operation.database,
|
||||
operation.sqlite_schema,
|
||||
operation.table,
|
||||
operation.columns,
|
||||
operation.source,
|
||||
)
|
||||
for access in analysis.table_accesses
|
||||
for operation in analysis.operations
|
||||
if operation.target_type == "table"
|
||||
and operation.operation in {"read", "insert", "update", "delete"}
|
||||
and not operation.internal
|
||||
] == [
|
||||
("read", "data", "main", "dogs", ("id", "name"), None),
|
||||
]
|
||||
|
|
@ -722,14 +725,17 @@ async def test_analyze_sql_insert_select():
|
|||
|
||||
assert {
|
||||
(
|
||||
access.operation,
|
||||
access.database,
|
||||
access.sqlite_schema,
|
||||
access.table,
|
||||
access.columns,
|
||||
access.source,
|
||||
operation.operation,
|
||||
operation.database,
|
||||
operation.sqlite_schema,
|
||||
operation.table,
|
||||
operation.columns,
|
||||
operation.source,
|
||||
)
|
||||
for access in analysis.table_accesses
|
||||
for operation in analysis.operations
|
||||
if operation.target_type == "table"
|
||||
and operation.operation in {"read", "insert", "update", "delete"}
|
||||
and not operation.internal
|
||||
} == {
|
||||
("insert", "data", "main", "dogs", (), None),
|
||||
("read", "data", "main", "cats", ("name",), None),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue