Add method explain which shows explain query plan.
This commit is contained in:
parent
1fe6de793c
commit
6b26a4bd93
1 changed files with 4 additions and 0 deletions
|
@ -337,6 +337,10 @@ class Database(metaclass=abc.ABCMeta):
|
||||||
row = self.select_one(query, bindings)
|
row = self.select_one(query, bindings)
|
||||||
return (row is not None)
|
return (row is not None)
|
||||||
|
|
||||||
|
def explain(self, query, bindings=None) -> str:
|
||||||
|
exp = self.execute('EXPLAIN QUERY PLAN ' + query, bindings)
|
||||||
|
return '\n'.join(str(tuple(x)) for x in exp.fetchall())
|
||||||
|
|
||||||
def get_object_by_id(self, object_class, object_id):
|
def get_object_by_id(self, object_class, object_id):
|
||||||
'''
|
'''
|
||||||
Select an object by its ID.
|
Select an object by its ID.
|
||||||
|
|
Loading…
Reference in a new issue