MCPcopy Index your code
hub / github.com/tanelpoder/0xtools / build_with_clause

Method build_with_clause

xtop/sql/fragment_manager.py:68–89  ·  view source on GitHub ↗

Build a WITH clause with required CTEs Args: required_ctes: List of CTE names needed Returns: Complete WITH clause

(self, required_ctes: List[str])

Source from the content-addressed store, hash-verified

66 return self._fragments_cache.get(name, f"-- Fragment {name} not found")
67
68 def build_with_clause(self, required_ctes: List[str]) -> str:
69 """Build a WITH clause with required CTEs
70
71 Args:
72 required_ctes: List of CTE names needed
73
74 Returns:
75 Complete WITH clause
76 """
77 if not required_ctes:
78 return ""
79
80 cte_parts = []
81 for cte_name in required_ctes:
82 fragment = self.get_fragment(f"cte_{cte_name}")
83 if fragment and not fragment.startswith("--"):
84 cte_parts.append(f"{cte_name} AS (\n{fragment}\n)")
85
86 if not cte_parts:
87 return ""
88
89 return "WITH " + ",\n".join(cte_parts)
90
91 def build_enriched_samples(self,
92 use_materialized: bool = False,

Callers

nothing calls this directly

Calls 1

get_fragmentMethod · 0.95

Tested by

no test coverage detected