Fix analyze function for PostgreSQL 9.4
This commit is contained in:
@@ -4,6 +4,12 @@ Changelog
|
|||||||
Here you can see the full list of changes between each SQLAlchemy-Utils release.
|
Here you can see the full list of changes between each SQLAlchemy-Utils release.
|
||||||
|
|
||||||
|
|
||||||
|
0.29.3 (2015-xx-xx)
|
||||||
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
- Fixed analyze function runtime property handling for PostgreSQL >= 9.4
|
||||||
|
|
||||||
|
|
||||||
0.29.2 (2015-01-08)
|
0.29.2 (2015-01-08)
|
||||||
^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@@ -26,7 +26,15 @@ class PlanAnalysis(object):
|
|||||||
class QueryAnalysis(object):
|
class QueryAnalysis(object):
|
||||||
def __init__(self, result_set):
|
def __init__(self, result_set):
|
||||||
self.plan = result_set[0]['Plan']
|
self.plan = result_set[0]['Plan']
|
||||||
|
if 'Total Runtime' in result_set[0]:
|
||||||
|
# PostgreSQL versions < 9.4
|
||||||
self.runtime = result_set[0]['Total Runtime']
|
self.runtime = result_set[0]['Total Runtime']
|
||||||
|
else:
|
||||||
|
# PostgreSQL versions >= 9.4
|
||||||
|
self.runtime = (
|
||||||
|
result_set[0]['Execution Time'] +
|
||||||
|
result_set[0]['Planning Time']
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def node_types(self):
|
def node_types(self):
|
||||||
|
Reference in New Issue
Block a user