MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / ExplainOutput

Class ExplainOutput

misc/python/materialize/optbench/sql.py:59–72  ·  view source on GitHub ↗

An API for manipulating 'EXPLAIN ... PLAN FOR' results.

Source from the content-addressed store, hash-verified

57
58
59class ExplainOutput:
60 """An API for manipulating 'EXPLAIN ... PLAN FOR' results."""
61
62 def __init__(self, output: str) -> None:
63 self.output = output
64
65 def __str__(self) -> str:
66 return self.output
67
68 def optimization_time(self) -> np.timedelta64 | None:
69 """Optionally, returns the optimization_time time for an 'EXPLAIN' output."""
70 p = r"(Optimization time|Planning Time)\: (?P<time>[0-9]+(\.[0-9]+)?\s?\S+)"
71 m = re.search(p, self.output, re.MULTILINE)
72 return util.duration_to_timedelta(m["time"]) if m else None
73
74
75class Database:

Callers 1

explainMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected