diff options
Diffstat (limited to 'docs/sqlglot/lineage.html')
-rw-r--r-- | docs/sqlglot/lineage.html | 590 |
1 files changed, 299 insertions, 291 deletions
diff --git a/docs/sqlglot/lineage.html b/docs/sqlglot/lineage.html index 702d7aa..8b1063e 100644 --- a/docs/sqlglot/lineage.html +++ b/docs/sqlglot/lineage.html @@ -347,136 +347,140 @@ </span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="k">for</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> </span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> </span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span> -</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Node</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">select</span><span class="o">.</span><span class="n">sql</span><span class="p">(),</span> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">source</span><span class="p">))</span> -</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> -</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="c1"># Find all columns that went into creating this one to list their lineage nodes.</span> -</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="n">source_columns</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">find_all_in_scope</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">))</span> -</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> -</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="c1"># If the source is a UDTF find columns used in the UTDF to generate the table</span> -</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> -</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="n">source_columns</span> <span class="o">|=</span> <span class="nb">set</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">))</span> -</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="n">derived_tables</span> <span class="o">=</span> <span class="p">[</span> -</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span> -</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="k">for</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> -</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">)</span> <span class="ow">and</span> <span class="n">source</span><span class="o">.</span><span class="n">is_derived_table</span> -</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="p">]</span> -</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="k">else</span><span class="p">:</span> -</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="n">derived_tables</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">derived_tables</span> -</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> -</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="n">source_names</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="n">dt</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> <span class="n">dt</span><span class="o">.</span><span class="n">comments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">()[</span><span class="mi">1</span><span class="p">]</span> -</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="k">for</span> <span class="n">dt</span> <span class="ow">in</span> <span class="n">derived_tables</span> -</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="k">if</span> <span class="n">dt</span><span class="o">.</span><span class="n">comments</span> <span class="ow">and</span> <span class="n">dt</span><span class="o">.</span><span class="n">comments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"source: "</span><span class="p">)</span> -</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="p">}</span> -</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> -</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">source_columns</span><span class="p">:</span> -</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">table</span> -</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> -</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> -</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> -</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="n">reference_node_name</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="n">source</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">DERIVED_TABLE</span> <span class="ow">and</span> <span class="n">table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">source_names</span><span class="p">:</span> -</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="n">reference_node_name</span> <span class="o">=</span> <span class="n">table</span> -</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="k">elif</span> <span class="n">source</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">CTE</span><span class="p">:</span> -</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="n">selected_node</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">))</span> -</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="n">reference_node_name</span> <span class="o">=</span> <span class="n">selected_node</span><span class="o">.</span><span class="n">name</span> <span class="k">if</span> <span class="n">selected_node</span> <span class="k">else</span> <span class="kc">None</span> -</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="c1"># The table itself came from a more specific scope. Recurse into that one using the unaliased column name.</span> -</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="n">to_node</span><span class="p">(</span> -</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="n">c</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> -</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="n">scope</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> -</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> -</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="n">scope_name</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> -</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="n">upstream</span><span class="o">=</span><span class="n">node</span><span class="p">,</span> -</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="n">source_name</span><span class="o">=</span><span class="n">source_names</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> <span class="ow">or</span> <span class="n">source_name</span><span class="p">,</span> -</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="n">reference_node_name</span><span class="o">=</span><span class="n">reference_node_name</span><span class="p">,</span> -</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="n">trim_selects</span><span class="o">=</span><span class="n">trim_selects</span><span class="p">,</span> -</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="p">)</span> -</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="k">else</span><span class="p">:</span> -</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="c1"># The source is not a scope - we've reached the end of the line. At this point, if a source is not found</span> -</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="c1"># it means this column's lineage is unknown. This can happen if the definition of a source used in a query</span> -</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="c1"># is not passed into the `sources` map.</span> -</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">source</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Placeholder</span><span class="p">()</span> -</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Node</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">c</span><span class="o">.</span><span class="n">sql</span><span class="p">(),</span> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">source</span><span class="p">))</span> -</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> -</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="k">return</span> <span class="n">node</span> -</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> -</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> -</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a><span class="k">class</span> <span class="nc">GraphHTML</span><span class="p">:</span> -</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a><span class="w"> </span><span class="sd">"""Node to HTML generator using vis.js.</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="n">Node</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">select</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">comments</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">source</span><span class="p">)</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="p">)</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="c1"># Find all columns that went into creating this one to list their lineage nodes.</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="n">source_columns</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">find_all_in_scope</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">))</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="c1"># If the source is a UDTF find columns used in the UTDF to generate the table</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="n">source_columns</span> <span class="o">|=</span> <span class="nb">set</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">))</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="n">derived_tables</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="k">for</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">)</span> <span class="ow">and</span> <span class="n">source</span><span class="o">.</span><span class="n">is_derived_table</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="p">]</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="n">derived_tables</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">derived_tables</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="n">source_names</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="n">dt</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> <span class="n">dt</span><span class="o">.</span><span class="n">comments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">()[</span><span class="mi">1</span><span class="p">]</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="k">for</span> <span class="n">dt</span> <span class="ow">in</span> <span class="n">derived_tables</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="k">if</span> <span class="n">dt</span><span class="o">.</span><span class="n">comments</span> <span class="ow">and</span> <span class="n">dt</span><span class="o">.</span><span class="n">comments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"source: "</span><span class="p">)</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="p">}</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">source_columns</span><span class="p">:</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">table</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="n">reference_node_name</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="k">if</span> <span class="n">source</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">DERIVED_TABLE</span> <span class="ow">and</span> <span class="n">table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">source_names</span><span class="p">:</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="n">reference_node_name</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="k">elif</span> <span class="n">source</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">CTE</span><span class="p">:</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="n">selected_node</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">))</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="n">reference_node_name</span> <span class="o">=</span> <span class="n">selected_node</span><span class="o">.</span><span class="n">name</span> <span class="k">if</span> <span class="n">selected_node</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="c1"># The table itself came from a more specific scope. Recurse into that one using the unaliased column name.</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="n">to_node</span><span class="p">(</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="n">c</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="n">scope</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="n">scope_name</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="n">upstream</span><span class="o">=</span><span class="n">node</span><span class="p">,</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="n">source_name</span><span class="o">=</span><span class="n">source_names</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> <span class="ow">or</span> <span class="n">source_name</span><span class="p">,</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="n">reference_node_name</span><span class="o">=</span><span class="n">reference_node_name</span><span class="p">,</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="n">trim_selects</span><span class="o">=</span><span class="n">trim_selects</span><span class="p">,</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="p">)</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="c1"># The source is not a scope - we've reached the end of the line. At this point, if a source is not found</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="c1"># it means this column's lineage is unknown. This can happen if the definition of a source used in a query</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="c1"># is not passed into the `sources` map.</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">source</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Placeholder</span><span class="p">()</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="n">Node</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">c</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">comments</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">source</span><span class="p">)</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="p">)</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="k">return</span> <span class="n">node</span> </span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> -</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a><span class="sd"> https://visjs.github.io/vis-network/docs/network/</span> -</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a><span class="sd"> """</span> -</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> -</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> -</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">nodes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="n">edges</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">,</span> <span class="n">imports</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> <span class="n">options</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="p">):</span> -</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> <span class="o">=</span> <span class="n">imports</span> -</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> -</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="s2">"height"</span><span class="p">:</span> <span class="s2">"500px"</span><span class="p">,</span> -</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="s2">"width"</span><span class="p">:</span> <span class="s2">"100%"</span><span class="p">,</span> -</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="s2">"layout"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="s2">"hierarchical"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> -</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="s2">"nodeSpacing"</span><span class="p">:</span> <span class="mi">200</span><span class="p">,</span> -</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="s2">"sortMethod"</span><span class="p">:</span> <span class="s2">"directed"</span><span class="p">,</span> -</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="p">},</span> -</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="p">},</span> -</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <span class="s2">"interaction"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="s2">"dragNodes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="s2">"selectable"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a><span class="k">class</span> <span class="nc">GraphHTML</span><span class="p">:</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a><span class="w"> </span><span class="sd">"""Node to HTML generator using vis.js.</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a><span class="sd"> https://visjs.github.io/vis-network/docs/network/</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a><span class="sd"> """</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">nodes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="n">edges</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">,</span> <span class="n">imports</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> <span class="n">options</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="p">):</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> <span class="o">=</span> <span class="n">imports</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="s2">"height"</span><span class="p">:</span> <span class="s2">"500px"</span><span class="p">,</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="s2">"width"</span><span class="p">:</span> <span class="s2">"100%"</span><span class="p">,</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="s2">"layout"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="s2">"hierarchical"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <span class="s2">"nodeSpacing"</span><span class="p">:</span> <span class="mi">200</span><span class="p">,</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="s2">"sortMethod"</span><span class="p">:</span> <span class="s2">"directed"</span><span class="p">,</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="p">},</span> </span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="p">},</span> -</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="s2">"physics"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="p">},</span> -</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="s2">"edges"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="s2">"arrows"</span><span class="p">:</span> <span class="s2">"to"</span><span class="p">,</span> -</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="p">},</span> -</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="s2">"nodes"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="s2">"font"</span><span class="p">:</span> <span class="s2">"20px monaco"</span><span class="p">,</span> -</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="s2">"shape"</span><span class="p">:</span> <span class="s2">"box"</span><span class="p">,</span> -</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="s2">"widthConstraint"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="s2">"maximum"</span><span class="p">:</span> <span class="mi">300</span><span class="p">,</span> -</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="p">},</span> -</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="p">},</span> -</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="o">**</span><span class="p">(</span><span class="n">options</span> <span class="ow">or</span> <span class="p">{}),</span> -</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="p">}</span> -</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> -</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span> <span class="o">=</span> <span class="n">nodes</span> -</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span> <span class="o">=</span> <span class="n">edges</span> -</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> -</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> <span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> -</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="n">nodes</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">values</span><span class="p">()))</span> -</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="n">edges</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> <span class="n">options</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="p">)</span> -</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="n">imports</span> <span class="o">=</span> <span class="p">(</span> -</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a><span class="w"> </span><span class="sd">"""<script type="text/javascript" src="https://unpkg.com/vis-data@latest/peer/umd/vis-data.min.js"></script></span> -</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a><span class="sd"> <script type="text/javascript" src="https://unpkg.com/vis-network@latest/peer/umd/vis-network.min.js"></script></span> -</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a><span class="sd"> <link rel="stylesheet" type="text/css" href="https://unpkg.com/vis-network/styles/vis-network.min.css" />"""</span> -</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> -</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="k">else</span> <span class="s2">""</span> -</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="p">)</span> -</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> -</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"""<div></span> -</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a><span class="s2"> <div id="sqlglot-lineage"></div></span> -</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a><span class="s2"> </span><span class="si">{</span><span class="n">imports</span><span class="si">}</span> -</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a><span class="s2"> <script type="text/javascript"></span> -</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a><span class="s2"> var nodes = new vis.DataSet(</span><span class="si">{</span><span class="n">nodes</span><span class="si">}</span><span class="s2">)</span> -</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a><span class="s2"> nodes.forEach(row => row["title"] = new DOMParser().parseFromString(row["title"], "text/html").body.childNodes[0])</span> -</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> -</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a><span class="s2"> new vis.Network(</span> -</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a><span class="s2"> document.getElementById("sqlglot-lineage"),</span> -</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a><span class="s2"> </span><span class="se">{{</span> -</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a><span class="s2"> nodes: nodes,</span> -</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a><span class="s2"> edges: new vis.DataSet(</span><span class="si">{</span><span class="n">edges</span><span class="si">}</span><span class="s2">)</span> -</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a><span class="s2"> </span><span class="se">}}</span><span class="s2">,</span> -</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a><span class="s2"> </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">,</span> -</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a><span class="s2"> )</span> -</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a><span class="s2"> </script></span> -</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a><span class="s2"></div>"""</span> -</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> -</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> <span class="k">def</span> <span class="nf">_repr_html_</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="fm">__str__</span><span class="p">()</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="s2">"interaction"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="s2">"dragNodes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="s2">"selectable"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="p">},</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="s2">"physics"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="p">},</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="s2">"edges"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="s2">"arrows"</span><span class="p">:</span> <span class="s2">"to"</span><span class="p">,</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="p">},</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="s2">"nodes"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="s2">"font"</span><span class="p">:</span> <span class="s2">"20px monaco"</span><span class="p">,</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="s2">"shape"</span><span class="p">:</span> <span class="s2">"box"</span><span class="p">,</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="s2">"widthConstraint"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="s2">"maximum"</span><span class="p">:</span> <span class="mi">300</span><span class="p">,</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> <span class="p">},</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="p">},</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="o">**</span><span class="p">(</span><span class="n">options</span> <span class="ow">or</span> <span class="p">{}),</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="p">}</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span> <span class="o">=</span> <span class="n">nodes</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span> <span class="o">=</span> <span class="n">edges</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> <span class="n">nodes</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">values</span><span class="p">()))</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> <span class="n">edges</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> <span class="n">options</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="p">)</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="n">imports</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a><span class="w"> </span><span class="sd">"""<script type="text/javascript" src="https://unpkg.com/vis-data@latest/peer/umd/vis-data.min.js"></script></span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a><span class="sd"> <script type="text/javascript" src="https://unpkg.com/vis-network@latest/peer/umd/vis-network.min.js"></script></span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a><span class="sd"> <link rel="stylesheet" type="text/css" href="https://unpkg.com/vis-network/styles/vis-network.min.css" />"""</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="p">)</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"""<div></span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a><span class="s2"> <div id="sqlglot-lineage"></div></span> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a><span class="s2"> </span><span class="si">{</span><span class="n">imports</span><span class="si">}</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a><span class="s2"> <script type="text/javascript"></span> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a><span class="s2"> var nodes = new vis.DataSet(</span><span class="si">{</span><span class="n">nodes</span><span class="si">}</span><span class="s2">)</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a><span class="s2"> nodes.forEach(row => row["title"] = new DOMParser().parseFromString(row["title"], "text/html").body.childNodes[0])</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a><span class="s2"> new vis.Network(</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a><span class="s2"> document.getElementById("sqlglot-lineage"),</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a><span class="s2"> </span><span class="se">{{</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a><span class="s2"> nodes: nodes,</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a><span class="s2"> edges: new vis.DataSet(</span><span class="si">{</span><span class="n">edges</span><span class="si">}</span><span class="s2">)</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a><span class="s2"> </span><span class="se">}}</span><span class="s2">,</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a><span class="s2"> </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">,</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a><span class="s2"> )</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a><span class="s2"> </script></span> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a><span class="s2"></div>"""</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="k">def</span> <span class="nf">_repr_html_</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="fm">__str__</span><span class="p">()</span> </span></pre></div> @@ -920,58 +924,62 @@ </span><span id="to_node-230"><a href="#to_node-230"><span class="linenos">230</span></a> <span class="k">for</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> </span><span id="to_node-231"><a href="#to_node-231"><span class="linenos">231</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> </span><span id="to_node-232"><a href="#to_node-232"><span class="linenos">232</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">source</span><span class="o">.</span><span class="n">expression</span> -</span><span id="to_node-233"><a href="#to_node-233"><span class="linenos">233</span></a> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Node</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">select</span><span class="o">.</span><span class="n">sql</span><span class="p">(),</span> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">source</span><span class="p">))</span> -</span><span id="to_node-234"><a href="#to_node-234"><span class="linenos">234</span></a> -</span><span id="to_node-235"><a href="#to_node-235"><span class="linenos">235</span></a> <span class="c1"># Find all columns that went into creating this one to list their lineage nodes.</span> -</span><span id="to_node-236"><a href="#to_node-236"><span class="linenos">236</span></a> <span class="n">source_columns</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">find_all_in_scope</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">))</span> -</span><span id="to_node-237"><a href="#to_node-237"><span class="linenos">237</span></a> -</span><span id="to_node-238"><a href="#to_node-238"><span class="linenos">238</span></a> <span class="c1"># If the source is a UDTF find columns used in the UTDF to generate the table</span> -</span><span id="to_node-239"><a href="#to_node-239"><span class="linenos">239</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> -</span><span id="to_node-240"><a href="#to_node-240"><span class="linenos">240</span></a> <span class="n">source_columns</span> <span class="o">|=</span> <span class="nb">set</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">))</span> -</span><span id="to_node-241"><a href="#to_node-241"><span class="linenos">241</span></a> <span class="n">derived_tables</span> <span class="o">=</span> <span class="p">[</span> -</span><span id="to_node-242"><a href="#to_node-242"><span class="linenos">242</span></a> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span> -</span><span id="to_node-243"><a href="#to_node-243"><span class="linenos">243</span></a> <span class="k">for</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> -</span><span id="to_node-244"><a href="#to_node-244"><span class="linenos">244</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">)</span> <span class="ow">and</span> <span class="n">source</span><span class="o">.</span><span class="n">is_derived_table</span> -</span><span id="to_node-245"><a href="#to_node-245"><span class="linenos">245</span></a> <span class="p">]</span> -</span><span id="to_node-246"><a href="#to_node-246"><span class="linenos">246</span></a> <span class="k">else</span><span class="p">:</span> -</span><span id="to_node-247"><a href="#to_node-247"><span class="linenos">247</span></a> <span class="n">derived_tables</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">derived_tables</span> -</span><span id="to_node-248"><a href="#to_node-248"><span class="linenos">248</span></a> -</span><span id="to_node-249"><a href="#to_node-249"><span class="linenos">249</span></a> <span class="n">source_names</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="to_node-250"><a href="#to_node-250"><span class="linenos">250</span></a> <span class="n">dt</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> <span class="n">dt</span><span class="o">.</span><span class="n">comments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">()[</span><span class="mi">1</span><span class="p">]</span> -</span><span id="to_node-251"><a href="#to_node-251"><span class="linenos">251</span></a> <span class="k">for</span> <span class="n">dt</span> <span class="ow">in</span> <span class="n">derived_tables</span> -</span><span id="to_node-252"><a href="#to_node-252"><span class="linenos">252</span></a> <span class="k">if</span> <span class="n">dt</span><span class="o">.</span><span class="n">comments</span> <span class="ow">and</span> <span class="n">dt</span><span class="o">.</span><span class="n">comments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"source: "</span><span class="p">)</span> -</span><span id="to_node-253"><a href="#to_node-253"><span class="linenos">253</span></a> <span class="p">}</span> -</span><span id="to_node-254"><a href="#to_node-254"><span class="linenos">254</span></a> -</span><span id="to_node-255"><a href="#to_node-255"><span class="linenos">255</span></a> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">source_columns</span><span class="p">:</span> -</span><span id="to_node-256"><a href="#to_node-256"><span class="linenos">256</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">table</span> -</span><span id="to_node-257"><a href="#to_node-257"><span class="linenos">257</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> -</span><span id="to_node-258"><a href="#to_node-258"><span class="linenos">258</span></a> -</span><span id="to_node-259"><a href="#to_node-259"><span class="linenos">259</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> -</span><span id="to_node-260"><a href="#to_node-260"><span class="linenos">260</span></a> <span class="n">reference_node_name</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="to_node-261"><a href="#to_node-261"><span class="linenos">261</span></a> <span class="k">if</span> <span class="n">source</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">DERIVED_TABLE</span> <span class="ow">and</span> <span class="n">table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">source_names</span><span class="p">:</span> -</span><span id="to_node-262"><a href="#to_node-262"><span class="linenos">262</span></a> <span class="n">reference_node_name</span> <span class="o">=</span> <span class="n">table</span> -</span><span id="to_node-263"><a href="#to_node-263"><span class="linenos">263</span></a> <span class="k">elif</span> <span class="n">source</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">CTE</span><span class="p">:</span> -</span><span id="to_node-264"><a href="#to_node-264"><span class="linenos">264</span></a> <span class="n">selected_node</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">))</span> -</span><span id="to_node-265"><a href="#to_node-265"><span class="linenos">265</span></a> <span class="n">reference_node_name</span> <span class="o">=</span> <span class="n">selected_node</span><span class="o">.</span><span class="n">name</span> <span class="k">if</span> <span class="n">selected_node</span> <span class="k">else</span> <span class="kc">None</span> -</span><span id="to_node-266"><a href="#to_node-266"><span class="linenos">266</span></a> <span class="c1"># The table itself came from a more specific scope. Recurse into that one using the unaliased column name.</span> -</span><span id="to_node-267"><a href="#to_node-267"><span class="linenos">267</span></a> <span class="n">to_node</span><span class="p">(</span> -</span><span id="to_node-268"><a href="#to_node-268"><span class="linenos">268</span></a> <span class="n">c</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> -</span><span id="to_node-269"><a href="#to_node-269"><span class="linenos">269</span></a> <span class="n">scope</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> -</span><span id="to_node-270"><a href="#to_node-270"><span class="linenos">270</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> -</span><span id="to_node-271"><a href="#to_node-271"><span class="linenos">271</span></a> <span class="n">scope_name</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> -</span><span id="to_node-272"><a href="#to_node-272"><span class="linenos">272</span></a> <span class="n">upstream</span><span class="o">=</span><span class="n">node</span><span class="p">,</span> -</span><span id="to_node-273"><a href="#to_node-273"><span class="linenos">273</span></a> <span class="n">source_name</span><span class="o">=</span><span class="n">source_names</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> <span class="ow">or</span> <span class="n">source_name</span><span class="p">,</span> -</span><span id="to_node-274"><a href="#to_node-274"><span class="linenos">274</span></a> <span class="n">reference_node_name</span><span class="o">=</span><span class="n">reference_node_name</span><span class="p">,</span> -</span><span id="to_node-275"><a href="#to_node-275"><span class="linenos">275</span></a> <span class="n">trim_selects</span><span class="o">=</span><span class="n">trim_selects</span><span class="p">,</span> -</span><span id="to_node-276"><a href="#to_node-276"><span class="linenos">276</span></a> <span class="p">)</span> -</span><span id="to_node-277"><a href="#to_node-277"><span class="linenos">277</span></a> <span class="k">else</span><span class="p">:</span> -</span><span id="to_node-278"><a href="#to_node-278"><span class="linenos">278</span></a> <span class="c1"># The source is not a scope - we've reached the end of the line. At this point, if a source is not found</span> -</span><span id="to_node-279"><a href="#to_node-279"><span class="linenos">279</span></a> <span class="c1"># it means this column's lineage is unknown. This can happen if the definition of a source used in a query</span> -</span><span id="to_node-280"><a href="#to_node-280"><span class="linenos">280</span></a> <span class="c1"># is not passed into the `sources` map.</span> -</span><span id="to_node-281"><a href="#to_node-281"><span class="linenos">281</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">source</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Placeholder</span><span class="p">()</span> -</span><span id="to_node-282"><a href="#to_node-282"><span class="linenos">282</span></a> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Node</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">c</span><span class="o">.</span><span class="n">sql</span><span class="p">(),</span> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">source</span><span class="p">))</span> -</span><span id="to_node-283"><a href="#to_node-283"><span class="linenos">283</span></a> -</span><span id="to_node-284"><a href="#to_node-284"><span class="linenos">284</span></a> <span class="k">return</span> <span class="n">node</span> +</span><span id="to_node-233"><a href="#to_node-233"><span class="linenos">233</span></a> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="to_node-234"><a href="#to_node-234"><span class="linenos">234</span></a> <span class="n">Node</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">select</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">comments</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">source</span><span class="p">)</span> +</span><span id="to_node-235"><a href="#to_node-235"><span class="linenos">235</span></a> <span class="p">)</span> +</span><span id="to_node-236"><a href="#to_node-236"><span class="linenos">236</span></a> +</span><span id="to_node-237"><a href="#to_node-237"><span class="linenos">237</span></a> <span class="c1"># Find all columns that went into creating this one to list their lineage nodes.</span> +</span><span id="to_node-238"><a href="#to_node-238"><span class="linenos">238</span></a> <span class="n">source_columns</span> <span class="o">=</span> <span class="nb">set</span><span class="p">(</span><span class="n">find_all_in_scope</span><span class="p">(</span><span class="n">select</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">))</span> +</span><span id="to_node-239"><a href="#to_node-239"><span class="linenos">239</span></a> +</span><span id="to_node-240"><a href="#to_node-240"><span class="linenos">240</span></a> <span class="c1"># If the source is a UDTF find columns used in the UTDF to generate the table</span> +</span><span id="to_node-241"><a href="#to_node-241"><span class="linenos">241</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">UDTF</span><span class="p">):</span> +</span><span id="to_node-242"><a href="#to_node-242"><span class="linenos">242</span></a> <span class="n">source_columns</span> <span class="o">|=</span> <span class="nb">set</span><span class="p">(</span><span class="n">source</span><span class="o">.</span><span class="n">find_all</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Column</span><span class="p">))</span> +</span><span id="to_node-243"><a href="#to_node-243"><span class="linenos">243</span></a> <span class="n">derived_tables</span> <span class="o">=</span> <span class="p">[</span> +</span><span id="to_node-244"><a href="#to_node-244"><span class="linenos">244</span></a> <span class="n">source</span><span class="o">.</span><span class="n">expression</span><span class="o">.</span><span class="n">parent</span> +</span><span id="to_node-245"><a href="#to_node-245"><span class="linenos">245</span></a> <span class="k">for</span> <span class="n">source</span> <span class="ow">in</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">values</span><span class="p">()</span> +</span><span id="to_node-246"><a href="#to_node-246"><span class="linenos">246</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">)</span> <span class="ow">and</span> <span class="n">source</span><span class="o">.</span><span class="n">is_derived_table</span> +</span><span id="to_node-247"><a href="#to_node-247"><span class="linenos">247</span></a> <span class="p">]</span> +</span><span id="to_node-248"><a href="#to_node-248"><span class="linenos">248</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="to_node-249"><a href="#to_node-249"><span class="linenos">249</span></a> <span class="n">derived_tables</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">derived_tables</span> +</span><span id="to_node-250"><a href="#to_node-250"><span class="linenos">250</span></a> +</span><span id="to_node-251"><a href="#to_node-251"><span class="linenos">251</span></a> <span class="n">source_names</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="to_node-252"><a href="#to_node-252"><span class="linenos">252</span></a> <span class="n">dt</span><span class="o">.</span><span class="n">alias</span><span class="p">:</span> <span class="n">dt</span><span class="o">.</span><span class="n">comments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">()[</span><span class="mi">1</span><span class="p">]</span> +</span><span id="to_node-253"><a href="#to_node-253"><span class="linenos">253</span></a> <span class="k">for</span> <span class="n">dt</span> <span class="ow">in</span> <span class="n">derived_tables</span> +</span><span id="to_node-254"><a href="#to_node-254"><span class="linenos">254</span></a> <span class="k">if</span> <span class="n">dt</span><span class="o">.</span><span class="n">comments</span> <span class="ow">and</span> <span class="n">dt</span><span class="o">.</span><span class="n">comments</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">"source: "</span><span class="p">)</span> +</span><span id="to_node-255"><a href="#to_node-255"><span class="linenos">255</span></a> <span class="p">}</span> +</span><span id="to_node-256"><a href="#to_node-256"><span class="linenos">256</span></a> +</span><span id="to_node-257"><a href="#to_node-257"><span class="linenos">257</span></a> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">source_columns</span><span class="p">:</span> +</span><span id="to_node-258"><a href="#to_node-258"><span class="linenos">258</span></a> <span class="n">table</span> <span class="o">=</span> <span class="n">c</span><span class="o">.</span><span class="n">table</span> +</span><span id="to_node-259"><a href="#to_node-259"><span class="linenos">259</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> +</span><span id="to_node-260"><a href="#to_node-260"><span class="linenos">260</span></a> +</span><span id="to_node-261"><a href="#to_node-261"><span class="linenos">261</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">Scope</span><span class="p">):</span> +</span><span id="to_node-262"><a href="#to_node-262"><span class="linenos">262</span></a> <span class="n">reference_node_name</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="to_node-263"><a href="#to_node-263"><span class="linenos">263</span></a> <span class="k">if</span> <span class="n">source</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">DERIVED_TABLE</span> <span class="ow">and</span> <span class="n">table</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">source_names</span><span class="p">:</span> +</span><span id="to_node-264"><a href="#to_node-264"><span class="linenos">264</span></a> <span class="n">reference_node_name</span> <span class="o">=</span> <span class="n">table</span> +</span><span id="to_node-265"><a href="#to_node-265"><span class="linenos">265</span></a> <span class="k">elif</span> <span class="n">source</span><span class="o">.</span><span class="n">scope_type</span> <span class="o">==</span> <span class="n">ScopeType</span><span class="o">.</span><span class="n">CTE</span><span class="p">:</span> +</span><span id="to_node-266"><a href="#to_node-266"><span class="linenos">266</span></a> <span class="n">selected_node</span><span class="p">,</span> <span class="n">_</span> <span class="o">=</span> <span class="n">scope</span><span class="o">.</span><span class="n">selected_sources</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="kc">None</span><span class="p">))</span> +</span><span id="to_node-267"><a href="#to_node-267"><span class="linenos">267</span></a> <span class="n">reference_node_name</span> <span class="o">=</span> <span class="n">selected_node</span><span class="o">.</span><span class="n">name</span> <span class="k">if</span> <span class="n">selected_node</span> <span class="k">else</span> <span class="kc">None</span> +</span><span id="to_node-268"><a href="#to_node-268"><span class="linenos">268</span></a> <span class="c1"># The table itself came from a more specific scope. Recurse into that one using the unaliased column name.</span> +</span><span id="to_node-269"><a href="#to_node-269"><span class="linenos">269</span></a> <span class="n">to_node</span><span class="p">(</span> +</span><span id="to_node-270"><a href="#to_node-270"><span class="linenos">270</span></a> <span class="n">c</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> +</span><span id="to_node-271"><a href="#to_node-271"><span class="linenos">271</span></a> <span class="n">scope</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> +</span><span id="to_node-272"><a href="#to_node-272"><span class="linenos">272</span></a> <span class="n">dialect</span><span class="o">=</span><span class="n">dialect</span><span class="p">,</span> +</span><span id="to_node-273"><a href="#to_node-273"><span class="linenos">273</span></a> <span class="n">scope_name</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> +</span><span id="to_node-274"><a href="#to_node-274"><span class="linenos">274</span></a> <span class="n">upstream</span><span class="o">=</span><span class="n">node</span><span class="p">,</span> +</span><span id="to_node-275"><a href="#to_node-275"><span class="linenos">275</span></a> <span class="n">source_name</span><span class="o">=</span><span class="n">source_names</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">table</span><span class="p">)</span> <span class="ow">or</span> <span class="n">source_name</span><span class="p">,</span> +</span><span id="to_node-276"><a href="#to_node-276"><span class="linenos">276</span></a> <span class="n">reference_node_name</span><span class="o">=</span><span class="n">reference_node_name</span><span class="p">,</span> +</span><span id="to_node-277"><a href="#to_node-277"><span class="linenos">277</span></a> <span class="n">trim_selects</span><span class="o">=</span><span class="n">trim_selects</span><span class="p">,</span> +</span><span id="to_node-278"><a href="#to_node-278"><span class="linenos">278</span></a> <span class="p">)</span> +</span><span id="to_node-279"><a href="#to_node-279"><span class="linenos">279</span></a> <span class="k">else</span><span class="p">:</span> +</span><span id="to_node-280"><a href="#to_node-280"><span class="linenos">280</span></a> <span class="c1"># The source is not a scope - we've reached the end of the line. At this point, if a source is not found</span> +</span><span id="to_node-281"><a href="#to_node-281"><span class="linenos">281</span></a> <span class="c1"># it means this column's lineage is unknown. This can happen if the definition of a source used in a query</span> +</span><span id="to_node-282"><a href="#to_node-282"><span class="linenos">282</span></a> <span class="c1"># is not passed into the `sources` map.</span> +</span><span id="to_node-283"><a href="#to_node-283"><span class="linenos">283</span></a> <span class="n">source</span> <span class="o">=</span> <span class="n">source</span> <span class="ow">or</span> <span class="n">exp</span><span class="o">.</span><span class="n">Placeholder</span><span class="p">()</span> +</span><span id="to_node-284"><a href="#to_node-284"><span class="linenos">284</span></a> <span class="n">node</span><span class="o">.</span><span class="n">downstream</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> +</span><span id="to_node-285"><a href="#to_node-285"><span class="linenos">285</span></a> <span class="n">Node</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">c</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">comments</span><span class="o">=</span><span class="kc">False</span><span class="p">),</span> <span class="n">source</span><span class="o">=</span><span class="n">source</span><span class="p">,</span> <span class="n">expression</span><span class="o">=</span><span class="n">source</span><span class="p">)</span> +</span><span id="to_node-286"><a href="#to_node-286"><span class="linenos">286</span></a> <span class="p">)</span> +</span><span id="to_node-287"><a href="#to_node-287"><span class="linenos">287</span></a> +</span><span id="to_node-288"><a href="#to_node-288"><span class="linenos">288</span></a> <span class="k">return</span> <span class="n">node</span> </span></pre></div> @@ -989,82 +997,82 @@ </div> <a class="headerlink" href="#GraphHTML"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="GraphHTML-287"><a href="#GraphHTML-287"><span class="linenos">287</span></a><span class="k">class</span> <span class="nc">GraphHTML</span><span class="p">:</span> -</span><span id="GraphHTML-288"><a href="#GraphHTML-288"><span class="linenos">288</span></a><span class="w"> </span><span class="sd">"""Node to HTML generator using vis.js.</span> -</span><span id="GraphHTML-289"><a href="#GraphHTML-289"><span class="linenos">289</span></a> -</span><span id="GraphHTML-290"><a href="#GraphHTML-290"><span class="linenos">290</span></a><span class="sd"> https://visjs.github.io/vis-network/docs/network/</span> -</span><span id="GraphHTML-291"><a href="#GraphHTML-291"><span class="linenos">291</span></a><span class="sd"> """</span> -</span><span id="GraphHTML-292"><a href="#GraphHTML-292"><span class="linenos">292</span></a> -</span><span id="GraphHTML-293"><a href="#GraphHTML-293"><span class="linenos">293</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> -</span><span id="GraphHTML-294"><a href="#GraphHTML-294"><span class="linenos">294</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">nodes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="n">edges</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">,</span> <span class="n">imports</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> <span class="n">options</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="GraphHTML-295"><a href="#GraphHTML-295"><span class="linenos">295</span></a> <span class="p">):</span> -</span><span id="GraphHTML-296"><a href="#GraphHTML-296"><span class="linenos">296</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> <span class="o">=</span> <span class="n">imports</span> -</span><span id="GraphHTML-297"><a href="#GraphHTML-297"><span class="linenos">297</span></a> -</span><span id="GraphHTML-298"><a href="#GraphHTML-298"><span class="linenos">298</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="GraphHTML-299"><a href="#GraphHTML-299"><span class="linenos">299</span></a> <span class="s2">"height"</span><span class="p">:</span> <span class="s2">"500px"</span><span class="p">,</span> -</span><span id="GraphHTML-300"><a href="#GraphHTML-300"><span class="linenos">300</span></a> <span class="s2">"width"</span><span class="p">:</span> <span class="s2">"100%"</span><span class="p">,</span> -</span><span id="GraphHTML-301"><a href="#GraphHTML-301"><span class="linenos">301</span></a> <span class="s2">"layout"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML-302"><a href="#GraphHTML-302"><span class="linenos">302</span></a> <span class="s2">"hierarchical"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML-303"><a href="#GraphHTML-303"><span class="linenos">303</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> -</span><span id="GraphHTML-304"><a href="#GraphHTML-304"><span class="linenos">304</span></a> <span class="s2">"nodeSpacing"</span><span class="p">:</span> <span class="mi">200</span><span class="p">,</span> -</span><span id="GraphHTML-305"><a href="#GraphHTML-305"><span class="linenos">305</span></a> <span class="s2">"sortMethod"</span><span class="p">:</span> <span class="s2">"directed"</span><span class="p">,</span> -</span><span id="GraphHTML-306"><a href="#GraphHTML-306"><span class="linenos">306</span></a> <span class="p">},</span> -</span><span id="GraphHTML-307"><a href="#GraphHTML-307"><span class="linenos">307</span></a> <span class="p">},</span> -</span><span id="GraphHTML-308"><a href="#GraphHTML-308"><span class="linenos">308</span></a> <span class="s2">"interaction"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML-309"><a href="#GraphHTML-309"><span class="linenos">309</span></a> <span class="s2">"dragNodes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="GraphHTML-310"><a href="#GraphHTML-310"><span class="linenos">310</span></a> <span class="s2">"selectable"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="GraphHTML-291"><a href="#GraphHTML-291"><span class="linenos">291</span></a><span class="k">class</span> <span class="nc">GraphHTML</span><span class="p">:</span> +</span><span id="GraphHTML-292"><a href="#GraphHTML-292"><span class="linenos">292</span></a><span class="w"> </span><span class="sd">"""Node to HTML generator using vis.js.</span> +</span><span id="GraphHTML-293"><a href="#GraphHTML-293"><span class="linenos">293</span></a> +</span><span id="GraphHTML-294"><a href="#GraphHTML-294"><span class="linenos">294</span></a><span class="sd"> https://visjs.github.io/vis-network/docs/network/</span> +</span><span id="GraphHTML-295"><a href="#GraphHTML-295"><span class="linenos">295</span></a><span class="sd"> """</span> +</span><span id="GraphHTML-296"><a href="#GraphHTML-296"><span class="linenos">296</span></a> +</span><span id="GraphHTML-297"><a href="#GraphHTML-297"><span class="linenos">297</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="GraphHTML-298"><a href="#GraphHTML-298"><span class="linenos">298</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">nodes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="n">edges</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">,</span> <span class="n">imports</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> <span class="n">options</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="GraphHTML-299"><a href="#GraphHTML-299"><span class="linenos">299</span></a> <span class="p">):</span> +</span><span id="GraphHTML-300"><a href="#GraphHTML-300"><span class="linenos">300</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> <span class="o">=</span> <span class="n">imports</span> +</span><span id="GraphHTML-301"><a href="#GraphHTML-301"><span class="linenos">301</span></a> +</span><span id="GraphHTML-302"><a href="#GraphHTML-302"><span class="linenos">302</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="GraphHTML-303"><a href="#GraphHTML-303"><span class="linenos">303</span></a> <span class="s2">"height"</span><span class="p">:</span> <span class="s2">"500px"</span><span class="p">,</span> +</span><span id="GraphHTML-304"><a href="#GraphHTML-304"><span class="linenos">304</span></a> <span class="s2">"width"</span><span class="p">:</span> <span class="s2">"100%"</span><span class="p">,</span> +</span><span id="GraphHTML-305"><a href="#GraphHTML-305"><span class="linenos">305</span></a> <span class="s2">"layout"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML-306"><a href="#GraphHTML-306"><span class="linenos">306</span></a> <span class="s2">"hierarchical"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML-307"><a href="#GraphHTML-307"><span class="linenos">307</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="GraphHTML-308"><a href="#GraphHTML-308"><span class="linenos">308</span></a> <span class="s2">"nodeSpacing"</span><span class="p">:</span> <span class="mi">200</span><span class="p">,</span> +</span><span id="GraphHTML-309"><a href="#GraphHTML-309"><span class="linenos">309</span></a> <span class="s2">"sortMethod"</span><span class="p">:</span> <span class="s2">"directed"</span><span class="p">,</span> +</span><span id="GraphHTML-310"><a href="#GraphHTML-310"><span class="linenos">310</span></a> <span class="p">},</span> </span><span id="GraphHTML-311"><a href="#GraphHTML-311"><span class="linenos">311</span></a> <span class="p">},</span> -</span><span id="GraphHTML-312"><a href="#GraphHTML-312"><span class="linenos">312</span></a> <span class="s2">"physics"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML-313"><a href="#GraphHTML-313"><span class="linenos">313</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="GraphHTML-314"><a href="#GraphHTML-314"><span class="linenos">314</span></a> <span class="p">},</span> -</span><span id="GraphHTML-315"><a href="#GraphHTML-315"><span class="linenos">315</span></a> <span class="s2">"edges"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML-316"><a href="#GraphHTML-316"><span class="linenos">316</span></a> <span class="s2">"arrows"</span><span class="p">:</span> <span class="s2">"to"</span><span class="p">,</span> -</span><span id="GraphHTML-317"><a href="#GraphHTML-317"><span class="linenos">317</span></a> <span class="p">},</span> -</span><span id="GraphHTML-318"><a href="#GraphHTML-318"><span class="linenos">318</span></a> <span class="s2">"nodes"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML-319"><a href="#GraphHTML-319"><span class="linenos">319</span></a> <span class="s2">"font"</span><span class="p">:</span> <span class="s2">"20px monaco"</span><span class="p">,</span> -</span><span id="GraphHTML-320"><a href="#GraphHTML-320"><span class="linenos">320</span></a> <span class="s2">"shape"</span><span class="p">:</span> <span class="s2">"box"</span><span class="p">,</span> -</span><span id="GraphHTML-321"><a href="#GraphHTML-321"><span class="linenos">321</span></a> <span class="s2">"widthConstraint"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML-322"><a href="#GraphHTML-322"><span class="linenos">322</span></a> <span class="s2">"maximum"</span><span class="p">:</span> <span class="mi">300</span><span class="p">,</span> -</span><span id="GraphHTML-323"><a href="#GraphHTML-323"><span class="linenos">323</span></a> <span class="p">},</span> -</span><span id="GraphHTML-324"><a href="#GraphHTML-324"><span class="linenos">324</span></a> <span class="p">},</span> -</span><span id="GraphHTML-325"><a href="#GraphHTML-325"><span class="linenos">325</span></a> <span class="o">**</span><span class="p">(</span><span class="n">options</span> <span class="ow">or</span> <span class="p">{}),</span> -</span><span id="GraphHTML-326"><a href="#GraphHTML-326"><span class="linenos">326</span></a> <span class="p">}</span> -</span><span id="GraphHTML-327"><a href="#GraphHTML-327"><span class="linenos">327</span></a> -</span><span id="GraphHTML-328"><a href="#GraphHTML-328"><span class="linenos">328</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span> <span class="o">=</span> <span class="n">nodes</span> -</span><span id="GraphHTML-329"><a href="#GraphHTML-329"><span class="linenos">329</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span> <span class="o">=</span> <span class="n">edges</span> -</span><span id="GraphHTML-330"><a href="#GraphHTML-330"><span class="linenos">330</span></a> -</span><span id="GraphHTML-331"><a href="#GraphHTML-331"><span class="linenos">331</span></a> <span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> -</span><span id="GraphHTML-332"><a href="#GraphHTML-332"><span class="linenos">332</span></a> <span class="n">nodes</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">values</span><span class="p">()))</span> -</span><span id="GraphHTML-333"><a href="#GraphHTML-333"><span class="linenos">333</span></a> <span class="n">edges</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> -</span><span id="GraphHTML-334"><a href="#GraphHTML-334"><span class="linenos">334</span></a> <span class="n">options</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="p">)</span> -</span><span id="GraphHTML-335"><a href="#GraphHTML-335"><span class="linenos">335</span></a> <span class="n">imports</span> <span class="o">=</span> <span class="p">(</span> -</span><span id="GraphHTML-336"><a href="#GraphHTML-336"><span class="linenos">336</span></a><span class="w"> </span><span class="sd">"""<script type="text/javascript" src="https://unpkg.com/vis-data@latest/peer/umd/vis-data.min.js"></script></span> -</span><span id="GraphHTML-337"><a href="#GraphHTML-337"><span class="linenos">337</span></a><span class="sd"> <script type="text/javascript" src="https://unpkg.com/vis-network@latest/peer/umd/vis-network.min.js"></script></span> -</span><span id="GraphHTML-338"><a href="#GraphHTML-338"><span class="linenos">338</span></a><span class="sd"> <link rel="stylesheet" type="text/css" href="https://unpkg.com/vis-network/styles/vis-network.min.css" />"""</span> -</span><span id="GraphHTML-339"><a href="#GraphHTML-339"><span class="linenos">339</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> -</span><span id="GraphHTML-340"><a href="#GraphHTML-340"><span class="linenos">340</span></a> <span class="k">else</span> <span class="s2">""</span> -</span><span id="GraphHTML-341"><a href="#GraphHTML-341"><span class="linenos">341</span></a> <span class="p">)</span> -</span><span id="GraphHTML-342"><a href="#GraphHTML-342"><span class="linenos">342</span></a> -</span><span id="GraphHTML-343"><a href="#GraphHTML-343"><span class="linenos">343</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"""<div></span> -</span><span id="GraphHTML-344"><a href="#GraphHTML-344"><span class="linenos">344</span></a><span class="s2"> <div id="sqlglot-lineage"></div></span> -</span><span id="GraphHTML-345"><a href="#GraphHTML-345"><span class="linenos">345</span></a><span class="s2"> </span><span class="si">{</span><span class="n">imports</span><span class="si">}</span> -</span><span id="GraphHTML-346"><a href="#GraphHTML-346"><span class="linenos">346</span></a><span class="s2"> <script type="text/javascript"></span> -</span><span id="GraphHTML-347"><a href="#GraphHTML-347"><span class="linenos">347</span></a><span class="s2"> var nodes = new vis.DataSet(</span><span class="si">{</span><span class="n">nodes</span><span class="si">}</span><span class="s2">)</span> -</span><span id="GraphHTML-348"><a href="#GraphHTML-348"><span class="linenos">348</span></a><span class="s2"> nodes.forEach(row => row["title"] = new DOMParser().parseFromString(row["title"], "text/html").body.childNodes[0])</span> -</span><span id="GraphHTML-349"><a href="#GraphHTML-349"><span class="linenos">349</span></a> -</span><span id="GraphHTML-350"><a href="#GraphHTML-350"><span class="linenos">350</span></a><span class="s2"> new vis.Network(</span> -</span><span id="GraphHTML-351"><a href="#GraphHTML-351"><span class="linenos">351</span></a><span class="s2"> document.getElementById("sqlglot-lineage"),</span> -</span><span id="GraphHTML-352"><a href="#GraphHTML-352"><span class="linenos">352</span></a><span class="s2"> </span><span class="se">{{</span> -</span><span id="GraphHTML-353"><a href="#GraphHTML-353"><span class="linenos">353</span></a><span class="s2"> nodes: nodes,</span> -</span><span id="GraphHTML-354"><a href="#GraphHTML-354"><span class="linenos">354</span></a><span class="s2"> edges: new vis.DataSet(</span><span class="si">{</span><span class="n">edges</span><span class="si">}</span><span class="s2">)</span> -</span><span id="GraphHTML-355"><a href="#GraphHTML-355"><span class="linenos">355</span></a><span class="s2"> </span><span class="se">}}</span><span class="s2">,</span> -</span><span id="GraphHTML-356"><a href="#GraphHTML-356"><span class="linenos">356</span></a><span class="s2"> </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">,</span> -</span><span id="GraphHTML-357"><a href="#GraphHTML-357"><span class="linenos">357</span></a><span class="s2"> )</span> -</span><span id="GraphHTML-358"><a href="#GraphHTML-358"><span class="linenos">358</span></a><span class="s2"> </script></span> -</span><span id="GraphHTML-359"><a href="#GraphHTML-359"><span class="linenos">359</span></a><span class="s2"></div>"""</span> -</span><span id="GraphHTML-360"><a href="#GraphHTML-360"><span class="linenos">360</span></a> -</span><span id="GraphHTML-361"><a href="#GraphHTML-361"><span class="linenos">361</span></a> <span class="k">def</span> <span class="nf">_repr_html_</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="GraphHTML-362"><a href="#GraphHTML-362"><span class="linenos">362</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="fm">__str__</span><span class="p">()</span> +</span><span id="GraphHTML-312"><a href="#GraphHTML-312"><span class="linenos">312</span></a> <span class="s2">"interaction"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML-313"><a href="#GraphHTML-313"><span class="linenos">313</span></a> <span class="s2">"dragNodes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="GraphHTML-314"><a href="#GraphHTML-314"><span class="linenos">314</span></a> <span class="s2">"selectable"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="GraphHTML-315"><a href="#GraphHTML-315"><span class="linenos">315</span></a> <span class="p">},</span> +</span><span id="GraphHTML-316"><a href="#GraphHTML-316"><span class="linenos">316</span></a> <span class="s2">"physics"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML-317"><a href="#GraphHTML-317"><span class="linenos">317</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="GraphHTML-318"><a href="#GraphHTML-318"><span class="linenos">318</span></a> <span class="p">},</span> +</span><span id="GraphHTML-319"><a href="#GraphHTML-319"><span class="linenos">319</span></a> <span class="s2">"edges"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML-320"><a href="#GraphHTML-320"><span class="linenos">320</span></a> <span class="s2">"arrows"</span><span class="p">:</span> <span class="s2">"to"</span><span class="p">,</span> +</span><span id="GraphHTML-321"><a href="#GraphHTML-321"><span class="linenos">321</span></a> <span class="p">},</span> +</span><span id="GraphHTML-322"><a href="#GraphHTML-322"><span class="linenos">322</span></a> <span class="s2">"nodes"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML-323"><a href="#GraphHTML-323"><span class="linenos">323</span></a> <span class="s2">"font"</span><span class="p">:</span> <span class="s2">"20px monaco"</span><span class="p">,</span> +</span><span id="GraphHTML-324"><a href="#GraphHTML-324"><span class="linenos">324</span></a> <span class="s2">"shape"</span><span class="p">:</span> <span class="s2">"box"</span><span class="p">,</span> +</span><span id="GraphHTML-325"><a href="#GraphHTML-325"><span class="linenos">325</span></a> <span class="s2">"widthConstraint"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML-326"><a href="#GraphHTML-326"><span class="linenos">326</span></a> <span class="s2">"maximum"</span><span class="p">:</span> <span class="mi">300</span><span class="p">,</span> +</span><span id="GraphHTML-327"><a href="#GraphHTML-327"><span class="linenos">327</span></a> <span class="p">},</span> +</span><span id="GraphHTML-328"><a href="#GraphHTML-328"><span class="linenos">328</span></a> <span class="p">},</span> +</span><span id="GraphHTML-329"><a href="#GraphHTML-329"><span class="linenos">329</span></a> <span class="o">**</span><span class="p">(</span><span class="n">options</span> <span class="ow">or</span> <span class="p">{}),</span> +</span><span id="GraphHTML-330"><a href="#GraphHTML-330"><span class="linenos">330</span></a> <span class="p">}</span> +</span><span id="GraphHTML-331"><a href="#GraphHTML-331"><span class="linenos">331</span></a> +</span><span id="GraphHTML-332"><a href="#GraphHTML-332"><span class="linenos">332</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span> <span class="o">=</span> <span class="n">nodes</span> +</span><span id="GraphHTML-333"><a href="#GraphHTML-333"><span class="linenos">333</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span> <span class="o">=</span> <span class="n">edges</span> +</span><span id="GraphHTML-334"><a href="#GraphHTML-334"><span class="linenos">334</span></a> +</span><span id="GraphHTML-335"><a href="#GraphHTML-335"><span class="linenos">335</span></a> <span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> +</span><span id="GraphHTML-336"><a href="#GraphHTML-336"><span class="linenos">336</span></a> <span class="n">nodes</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nodes</span><span class="o">.</span><span class="n">values</span><span class="p">()))</span> +</span><span id="GraphHTML-337"><a href="#GraphHTML-337"><span class="linenos">337</span></a> <span class="n">edges</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> +</span><span id="GraphHTML-338"><a href="#GraphHTML-338"><span class="linenos">338</span></a> <span class="n">options</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">options</span><span class="p">)</span> +</span><span id="GraphHTML-339"><a href="#GraphHTML-339"><span class="linenos">339</span></a> <span class="n">imports</span> <span class="o">=</span> <span class="p">(</span> +</span><span id="GraphHTML-340"><a href="#GraphHTML-340"><span class="linenos">340</span></a><span class="w"> </span><span class="sd">"""<script type="text/javascript" src="https://unpkg.com/vis-data@latest/peer/umd/vis-data.min.js"></script></span> +</span><span id="GraphHTML-341"><a href="#GraphHTML-341"><span class="linenos">341</span></a><span class="sd"> <script type="text/javascript" src="https://unpkg.com/vis-network@latest/peer/umd/vis-network.min.js"></script></span> +</span><span id="GraphHTML-342"><a href="#GraphHTML-342"><span class="linenos">342</span></a><span class="sd"> <link rel="stylesheet" type="text/css" href="https://unpkg.com/vis-network/styles/vis-network.min.css" />"""</span> +</span><span id="GraphHTML-343"><a href="#GraphHTML-343"><span class="linenos">343</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> +</span><span id="GraphHTML-344"><a href="#GraphHTML-344"><span class="linenos">344</span></a> <span class="k">else</span> <span class="s2">""</span> +</span><span id="GraphHTML-345"><a href="#GraphHTML-345"><span class="linenos">345</span></a> <span class="p">)</span> +</span><span id="GraphHTML-346"><a href="#GraphHTML-346"><span class="linenos">346</span></a> +</span><span id="GraphHTML-347"><a href="#GraphHTML-347"><span class="linenos">347</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"""<div></span> +</span><span id="GraphHTML-348"><a href="#GraphHTML-348"><span class="linenos">348</span></a><span class="s2"> <div id="sqlglot-lineage"></div></span> +</span><span id="GraphHTML-349"><a href="#GraphHTML-349"><span class="linenos">349</span></a><span class="s2"> </span><span class="si">{</span><span class="n">imports</span><span class="si">}</span> +</span><span id="GraphHTML-350"><a href="#GraphHTML-350"><span class="linenos">350</span></a><span class="s2"> <script type="text/javascript"></span> +</span><span id="GraphHTML-351"><a href="#GraphHTML-351"><span class="linenos">351</span></a><span class="s2"> var nodes = new vis.DataSet(</span><span class="si">{</span><span class="n">nodes</span><span class="si">}</span><span class="s2">)</span> +</span><span id="GraphHTML-352"><a href="#GraphHTML-352"><span class="linenos">352</span></a><span class="s2"> nodes.forEach(row => row["title"] = new DOMParser().parseFromString(row["title"], "text/html").body.childNodes[0])</span> +</span><span id="GraphHTML-353"><a href="#GraphHTML-353"><span class="linenos">353</span></a> +</span><span id="GraphHTML-354"><a href="#GraphHTML-354"><span class="linenos">354</span></a><span class="s2"> new vis.Network(</span> +</span><span id="GraphHTML-355"><a href="#GraphHTML-355"><span class="linenos">355</span></a><span class="s2"> document.getElementById("sqlglot-lineage"),</span> +</span><span id="GraphHTML-356"><a href="#GraphHTML-356"><span class="linenos">356</span></a><span class="s2"> </span><span class="se">{{</span> +</span><span id="GraphHTML-357"><a href="#GraphHTML-357"><span class="linenos">357</span></a><span class="s2"> nodes: nodes,</span> +</span><span id="GraphHTML-358"><a href="#GraphHTML-358"><span class="linenos">358</span></a><span class="s2"> edges: new vis.DataSet(</span><span class="si">{</span><span class="n">edges</span><span class="si">}</span><span class="s2">)</span> +</span><span id="GraphHTML-359"><a href="#GraphHTML-359"><span class="linenos">359</span></a><span class="s2"> </span><span class="se">}}</span><span class="s2">,</span> +</span><span id="GraphHTML-360"><a href="#GraphHTML-360"><span class="linenos">360</span></a><span class="s2"> </span><span class="si">{</span><span class="n">options</span><span class="si">}</span><span class="s2">,</span> +</span><span id="GraphHTML-361"><a href="#GraphHTML-361"><span class="linenos">361</span></a><span class="s2"> )</span> +</span><span id="GraphHTML-362"><a href="#GraphHTML-362"><span class="linenos">362</span></a><span class="s2"> </script></span> +</span><span id="GraphHTML-363"><a href="#GraphHTML-363"><span class="linenos">363</span></a><span class="s2"></div>"""</span> +</span><span id="GraphHTML-364"><a href="#GraphHTML-364"><span class="linenos">364</span></a> +</span><span id="GraphHTML-365"><a href="#GraphHTML-365"><span class="linenos">365</span></a> <span class="k">def</span> <span class="nf">_repr_html_</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="GraphHTML-366"><a href="#GraphHTML-366"><span class="linenos">366</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="fm">__str__</span><span class="p">()</span> </span></pre></div> @@ -1084,43 +1092,43 @@ </div> <a class="headerlink" href="#GraphHTML.__init__"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="GraphHTML.__init__-293"><a href="#GraphHTML.__init__-293"><span class="linenos">293</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> -</span><span id="GraphHTML.__init__-294"><a href="#GraphHTML.__init__-294"><span class="linenos">294</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">nodes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="n">edges</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">,</span> <span class="n">imports</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> <span class="n">options</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="GraphHTML.__init__-295"><a href="#GraphHTML.__init__-295"><span class="linenos">295</span></a> <span class="p">):</span> -</span><span id="GraphHTML.__init__-296"><a href="#GraphHTML.__init__-296"><span class="linenos">296</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> <span class="o">=</span> <span class="n">imports</span> -</span><span id="GraphHTML.__init__-297"><a href="#GraphHTML.__init__-297"><span class="linenos">297</span></a> -</span><span id="GraphHTML.__init__-298"><a href="#GraphHTML.__init__-298"><span class="linenos">298</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="GraphHTML.__init__-299"><a href="#GraphHTML.__init__-299"><span class="linenos">299</span></a> <span class="s2">"height"</span><span class="p">:</span> <span class="s2">"500px"</span><span class="p">,</span> -</span><span id="GraphHTML.__init__-300"><a href="#GraphHTML.__init__-300"><span class="linenos">300</span></a> <span class="s2">"width"</span><span class="p">:</span> <span class="s2">"100%"</span><span class="p">,</span> -</span><span id="GraphHTML.__init__-301"><a href="#GraphHTML.__init__-301"><span class="linenos">301</span></a> <span class="s2">"layout"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML.__init__-302"><a href="#GraphHTML.__init__-302"><span class="linenos">302</span></a> <span class="s2">"hierarchical"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML.__init__-303"><a href="#GraphHTML.__init__-303"><span class="linenos">303</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> -</span><span id="GraphHTML.__init__-304"><a href="#GraphHTML.__init__-304"><span class="linenos">304</span></a> <span class="s2">"nodeSpacing"</span><span class="p">:</span> <span class="mi">200</span><span class="p">,</span> -</span><span id="GraphHTML.__init__-305"><a href="#GraphHTML.__init__-305"><span class="linenos">305</span></a> <span class="s2">"sortMethod"</span><span class="p">:</span> <span class="s2">"directed"</span><span class="p">,</span> -</span><span id="GraphHTML.__init__-306"><a href="#GraphHTML.__init__-306"><span class="linenos">306</span></a> <span class="p">},</span> -</span><span id="GraphHTML.__init__-307"><a href="#GraphHTML.__init__-307"><span class="linenos">307</span></a> <span class="p">},</span> -</span><span id="GraphHTML.__init__-308"><a href="#GraphHTML.__init__-308"><span class="linenos">308</span></a> <span class="s2">"interaction"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML.__init__-309"><a href="#GraphHTML.__init__-309"><span class="linenos">309</span></a> <span class="s2">"dragNodes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="GraphHTML.__init__-310"><a href="#GraphHTML.__init__-310"><span class="linenos">310</span></a> <span class="s2">"selectable"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="GraphHTML.__init__-297"><a href="#GraphHTML.__init__-297"><span class="linenos">297</span></a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span> +</span><span id="GraphHTML.__init__-298"><a href="#GraphHTML.__init__-298"><span class="linenos">298</span></a> <span class="bp">self</span><span class="p">,</span> <span class="n">nodes</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">,</span> <span class="n">edges</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">List</span><span class="p">,</span> <span class="n">imports</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> <span class="n">options</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Dict</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="GraphHTML.__init__-299"><a href="#GraphHTML.__init__-299"><span class="linenos">299</span></a> <span class="p">):</span> +</span><span id="GraphHTML.__init__-300"><a href="#GraphHTML.__init__-300"><span class="linenos">300</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">imports</span> <span class="o">=</span> <span class="n">imports</span> +</span><span id="GraphHTML.__init__-301"><a href="#GraphHTML.__init__-301"><span class="linenos">301</span></a> +</span><span id="GraphHTML.__init__-302"><a href="#GraphHTML.__init__-302"><span class="linenos">302</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">options</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="GraphHTML.__init__-303"><a href="#GraphHTML.__init__-303"><span class="linenos">303</span></a> <span class="s2">"height"</span><span class="p">:</span> <span class="s2">"500px"</span><span class="p">,</span> +</span><span id="GraphHTML.__init__-304"><a href="#GraphHTML.__init__-304"><span class="linenos">304</span></a> <span class="s2">"width"</span><span class="p">:</span> <span class="s2">"100%"</span><span class="p">,</span> +</span><span id="GraphHTML.__init__-305"><a href="#GraphHTML.__init__-305"><span class="linenos">305</span></a> <span class="s2">"layout"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML.__init__-306"><a href="#GraphHTML.__init__-306"><span class="linenos">306</span></a> <span class="s2">"hierarchical"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML.__init__-307"><a href="#GraphHTML.__init__-307"><span class="linenos">307</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> +</span><span id="GraphHTML.__init__-308"><a href="#GraphHTML.__init__-308"><span class="linenos">308</span></a> <span class="s2">"nodeSpacing"</span><span class="p">:</span> <span class="mi">200</span><span class="p">,</span> +</span><span id="GraphHTML.__init__-309"><a href="#GraphHTML.__init__-309"><span class="linenos">309</span></a> <span class="s2">"sortMethod"</span><span class="p">:</span> <span class="s2">"directed"</span><span class="p">,</span> +</span><span id="GraphHTML.__init__-310"><a href="#GraphHTML.__init__-310"><span class="linenos">310</span></a> <span class="p">},</span> </span><span id="GraphHTML.__init__-311"><a href="#GraphHTML.__init__-311"><span class="linenos">311</span></a> <span class="p">},</span> -</span><span id="GraphHTML.__init__-312"><a href="#GraphHTML.__init__-312"><span class="linenos">312</span></a> <span class="s2">"physics"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML.__init__-313"><a href="#GraphHTML.__init__-313"><span class="linenos">313</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="GraphHTML.__init__-314"><a href="#GraphHTML.__init__-314"><span class="linenos">314</span></a> <span class="p">},</span> -</span><span id="GraphHTML.__init__-315"><a href="#GraphHTML.__init__-315"><span class="linenos">315</span></a> <span class="s2">"edges"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML.__init__-316"><a href="#GraphHTML.__init__-316"><span class="linenos">316</span></a> <span class="s2">"arrows"</span><span class="p">:</span> <span class="s2">"to"</span><span class="p">,</span> -</span><span id="GraphHTML.__init__-317"><a href="#GraphHTML.__init__-317"><span class="linenos">317</span></a> <span class="p">},</span> -</span><span id="GraphHTML.__init__-318"><a href="#GraphHTML.__init__-318"><span class="linenos">318</span></a> <span class="s2">"nodes"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML.__init__-319"><a href="#GraphHTML.__init__-319"><span class="linenos">319</span></a> <span class="s2">"font"</span><span class="p">:</span> <span class="s2">"20px monaco"</span><span class="p">,</span> -</span><span id="GraphHTML.__init__-320"><a href="#GraphHTML.__init__-320"><span class="linenos">320</span></a> <span class="s2">"shape"</span><span class="p">:</span> <span class="s2">"box"</span><span class="p">,</span> -</span><span id="GraphHTML.__init__-321"><a href="#GraphHTML.__init__-321"><span class="linenos">321</span></a> <span class="s2">"widthConstraint"</span><span class="p">:</span> <span class="p">{</span> -</span><span id="GraphHTML.__init__-322"><a href="#GraphHTML.__init__-322"><span class="linenos">322</span></a> <span class="s2">"maximum"</span><span class="p">:</span> <span class="mi">300</span><span class="p">,</span> -</span><span id="GraphHTML.__init__-323"><a href="#GraphHTML.__init__-323"><span class="linenos">323</span></a> <span class="p">},</span> -</span><span id="GraphHTML.__init__-324"><a href="#GraphHTML.__init__-324"><span class="linenos">324</span></a> <span class="p">},</span> -</span><span id="GraphHTML.__init__-325"><a href="#GraphHTML.__init__-325"><span class="linenos">325</span></a> <span class="o">**</span><span class="p">(</span><span class="n">options</span> <span class="ow">or</span> <span class="p">{}),</span> -</span><span id="GraphHTML.__init__-326"><a href="#GraphHTML.__init__-326"><span class="linenos">326</span></a> <span class="p">}</span> -</span><span id="GraphHTML.__init__-327"><a href="#GraphHTML.__init__-327"><span class="linenos">327</span></a> -</span><span id="GraphHTML.__init__-328"><a href="#GraphHTML.__init__-328"><span class="linenos">328</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span> <span class="o">=</span> <span class="n">nodes</span> -</span><span id="GraphHTML.__init__-329"><a href="#GraphHTML.__init__-329"><span class="linenos">329</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span> <span class="o">=</span> <span class="n">edges</span> +</span><span id="GraphHTML.__init__-312"><a href="#GraphHTML.__init__-312"><span class="linenos">312</span></a> <span class="s2">"interaction"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML.__init__-313"><a href="#GraphHTML.__init__-313"><span class="linenos">313</span></a> <span class="s2">"dragNodes"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="GraphHTML.__init__-314"><a href="#GraphHTML.__init__-314"><span class="linenos">314</span></a> <span class="s2">"selectable"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="GraphHTML.__init__-315"><a href="#GraphHTML.__init__-315"><span class="linenos">315</span></a> <span class="p">},</span> +</span><span id="GraphHTML.__init__-316"><a href="#GraphHTML.__init__-316"><span class="linenos">316</span></a> <span class="s2">"physics"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML.__init__-317"><a href="#GraphHTML.__init__-317"><span class="linenos">317</span></a> <span class="s2">"enabled"</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="GraphHTML.__init__-318"><a href="#GraphHTML.__init__-318"><span class="linenos">318</span></a> <span class="p">},</span> +</span><span id="GraphHTML.__init__-319"><a href="#GraphHTML.__init__-319"><span class="linenos">319</span></a> <span class="s2">"edges"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML.__init__-320"><a href="#GraphHTML.__init__-320"><span class="linenos">320</span></a> <span class="s2">"arrows"</span><span class="p">:</span> <span class="s2">"to"</span><span class="p">,</span> +</span><span id="GraphHTML.__init__-321"><a href="#GraphHTML.__init__-321"><span class="linenos">321</span></a> <span class="p">},</span> +</span><span id="GraphHTML.__init__-322"><a href="#GraphHTML.__init__-322"><span class="linenos">322</span></a> <span class="s2">"nodes"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML.__init__-323"><a href="#GraphHTML.__init__-323"><span class="linenos">323</span></a> <span class="s2">"font"</span><span class="p">:</span> <span class="s2">"20px monaco"</span><span class="p">,</span> +</span><span id="GraphHTML.__init__-324"><a href="#GraphHTML.__init__-324"><span class="linenos">324</span></a> <span class="s2">"shape"</span><span class="p">:</span> <span class="s2">"box"</span><span class="p">,</span> +</span><span id="GraphHTML.__init__-325"><a href="#GraphHTML.__init__-325"><span class="linenos">325</span></a> <span class="s2">"widthConstraint"</span><span class="p">:</span> <span class="p">{</span> +</span><span id="GraphHTML.__init__-326"><a href="#GraphHTML.__init__-326"><span class="linenos">326</span></a> <span class="s2">"maximum"</span><span class="p">:</span> <span class="mi">300</span><span class="p">,</span> +</span><span id="GraphHTML.__init__-327"><a href="#GraphHTML.__init__-327"><span class="linenos">327</span></a> <span class="p">},</span> +</span><span id="GraphHTML.__init__-328"><a href="#GraphHTML.__init__-328"><span class="linenos">328</span></a> <span class="p">},</span> +</span><span id="GraphHTML.__init__-329"><a href="#GraphHTML.__init__-329"><span class="linenos">329</span></a> <span class="o">**</span><span class="p">(</span><span class="n">options</span> <span class="ow">or</span> <span class="p">{}),</span> +</span><span id="GraphHTML.__init__-330"><a href="#GraphHTML.__init__-330"><span class="linenos">330</span></a> <span class="p">}</span> +</span><span id="GraphHTML.__init__-331"><a href="#GraphHTML.__init__-331"><span class="linenos">331</span></a> +</span><span id="GraphHTML.__init__-332"><a href="#GraphHTML.__init__-332"><span class="linenos">332</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">nodes</span> <span class="o">=</span> <span class="n">nodes</span> +</span><span id="GraphHTML.__init__-333"><a href="#GraphHTML.__init__-333"><span class="linenos">333</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">edges</span> <span class="o">=</span> <span class="n">edges</span> </span></pre></div> |