diff options
Diffstat (limited to 'docs/sqlglot/dialects/tableau.html')
-rw-r--r-- | docs/sqlglot/dialects/tableau.html | 286 |
1 files changed, 120 insertions, 166 deletions
diff --git a/docs/sqlglot/dialects/tableau.html b/docs/sqlglot/dialects/tableau.html index 0e99348..b30f96d 100644 --- a/docs/sqlglot/dialects/tableau.html +++ b/docs/sqlglot/dialects/tableau.html @@ -40,9 +40,6 @@ <a class="function" href="#Tableau.Generator.if_sql">if_sql</a> </li> <li> - <a class="function" href="#Tableau.Generator.coalesce_sql">coalesce_sql</a> - </li> - <li> <a class="function" href="#Tableau.Generator.count_sql">count_sql</a> </li> </ul> @@ -83,7 +80,7 @@ <div class="pdoc-code codehilite"><pre><span></span><span id="L-1"><a href="#L-1"><span class="linenos"> 1</span></a><span class="kn">from</span> <span class="nn">__future__</span> <span class="kn">import</span> <span class="n">annotations</span> </span><span id="L-2"><a href="#L-2"><span class="linenos"> 2</span></a> </span><span id="L-3"><a href="#L-3"><span class="linenos"> 3</span></a><span class="kn">from</span> <span class="nn">sqlglot</span> <span class="kn">import</span> <span class="n">exp</span><span class="p">,</span> <span class="n">generator</span><span class="p">,</span> <span class="n">parser</span><span class="p">,</span> <span class="n">transforms</span> -</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">Dialect</span> +</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="n">Dialect</span><span class="p">,</span> <span class="n">rename_func</span> </span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a> </span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a> </span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a><span class="k">class</span> <span class="nc">Tableau</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> @@ -93,34 +90,32 @@ </span><span id="L-11"><a href="#L-11"><span class="linenos">11</span></a> </span><span id="L-12"><a href="#L-12"><span class="linenos">12</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> </span><span id="L-13"><a href="#L-13"><span class="linenos">13</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> -</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">]),</span> -</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> <span class="p">}</span> -</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> -</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> -</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatileProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> -</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> <span class="p">}</span> -</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> -</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> <span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> -</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="n">true</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">)</span> -</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="n">false</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">)</span> -</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> THEN </span><span class="si">{</span><span class="n">true</span><span class="si">}</span><span class="s2"> ELSE </span><span class="si">{</span><span class="n">false</span><span class="si">}</span><span class="s2"> END"</span> -</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> -</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> <span class="k">def</span> <span class="nf">coalesce_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IFNULL(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> -</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> -</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="k">def</span> <span class="nf">count_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> -</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> -</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNTD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> -</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> -</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a> -</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> -</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> -</span><span id="L-40"><a href="#L-40"><span class="linenos">40</span></a> <span class="s2">"COUNTD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)),</span> -</span><span id="L-41"><a href="#L-41"><span class="linenos">41</span></a> <span class="p">}</span> +</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"IFNULL"</span><span class="p">),</span> +</span><span id="L-15"><a href="#L-15"><span class="linenos">15</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">]),</span> +</span><span id="L-16"><a href="#L-16"><span class="linenos">16</span></a> <span class="p">}</span> +</span><span id="L-17"><a href="#L-17"><span class="linenos">17</span></a> +</span><span id="L-18"><a href="#L-18"><span class="linenos">18</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-19"><a href="#L-19"><span class="linenos">19</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> +</span><span id="L-20"><a href="#L-20"><span class="linenos">20</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatileProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="L-21"><a href="#L-21"><span class="linenos">21</span></a> <span class="p">}</span> +</span><span id="L-22"><a href="#L-22"><span class="linenos">22</span></a> +</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="n">true</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">)</span> +</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> <span class="n">false</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">)</span> +</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> THEN </span><span class="si">{</span><span class="n">true</span><span class="si">}</span><span class="s2"> ELSE </span><span class="si">{</span><span class="n">false</span><span class="si">}</span><span class="s2"> END"</span> +</span><span id="L-28"><a href="#L-28"><span class="linenos">28</span></a> +</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="k">def</span> <span class="nf">count_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> +</span><span id="L-32"><a href="#L-32"><span class="linenos">32</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNTD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="L-34"><a href="#L-34"><span class="linenos">34</span></a> +</span><span id="L-35"><a href="#L-35"><span class="linenos">35</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-36"><a href="#L-36"><span class="linenos">36</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-37"><a href="#L-37"><span class="linenos">37</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="L-38"><a href="#L-38"><span class="linenos">38</span></a> <span class="s2">"COUNTD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)),</span> +</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a> <span class="p">}</span> </span></pre></div> @@ -143,34 +138,32 @@ </span><span id="Tableau-12"><a href="#Tableau-12"><span class="linenos">12</span></a> </span><span id="Tableau-13"><a href="#Tableau-13"><span class="linenos">13</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> </span><span id="Tableau-14"><a href="#Tableau-14"><span class="linenos">14</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> -</span><span id="Tableau-15"><a href="#Tableau-15"><span class="linenos">15</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">]),</span> -</span><span id="Tableau-16"><a href="#Tableau-16"><span class="linenos">16</span></a> <span class="p">}</span> -</span><span id="Tableau-17"><a href="#Tableau-17"><span class="linenos">17</span></a> -</span><span id="Tableau-18"><a href="#Tableau-18"><span class="linenos">18</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Tableau-19"><a href="#Tableau-19"><span class="linenos">19</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> -</span><span id="Tableau-20"><a href="#Tableau-20"><span class="linenos">20</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatileProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> -</span><span id="Tableau-21"><a href="#Tableau-21"><span class="linenos">21</span></a> <span class="p">}</span> -</span><span id="Tableau-22"><a href="#Tableau-22"><span class="linenos">22</span></a> -</span><span id="Tableau-23"><a href="#Tableau-23"><span class="linenos">23</span></a> <span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Tableau-24"><a href="#Tableau-24"><span class="linenos">24</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> -</span><span id="Tableau-25"><a href="#Tableau-25"><span class="linenos">25</span></a> <span class="n">true</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">)</span> -</span><span id="Tableau-26"><a href="#Tableau-26"><span class="linenos">26</span></a> <span class="n">false</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">)</span> -</span><span id="Tableau-27"><a href="#Tableau-27"><span class="linenos">27</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> THEN </span><span class="si">{</span><span class="n">true</span><span class="si">}</span><span class="s2"> ELSE </span><span class="si">{</span><span class="n">false</span><span class="si">}</span><span class="s2"> END"</span> -</span><span id="Tableau-28"><a href="#Tableau-28"><span class="linenos">28</span></a> -</span><span id="Tableau-29"><a href="#Tableau-29"><span class="linenos">29</span></a> <span class="k">def</span> <span class="nf">coalesce_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Tableau-30"><a href="#Tableau-30"><span class="linenos">30</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IFNULL(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> -</span><span id="Tableau-31"><a href="#Tableau-31"><span class="linenos">31</span></a> -</span><span id="Tableau-32"><a href="#Tableau-32"><span class="linenos">32</span></a> <span class="k">def</span> <span class="nf">count_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Tableau-33"><a href="#Tableau-33"><span class="linenos">33</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> -</span><span id="Tableau-34"><a href="#Tableau-34"><span class="linenos">34</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> -</span><span id="Tableau-35"><a href="#Tableau-35"><span class="linenos">35</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNTD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> -</span><span id="Tableau-36"><a href="#Tableau-36"><span class="linenos">36</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> -</span><span id="Tableau-37"><a href="#Tableau-37"><span class="linenos">37</span></a> -</span><span id="Tableau-38"><a href="#Tableau-38"><span class="linenos">38</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> -</span><span id="Tableau-39"><a href="#Tableau-39"><span class="linenos">39</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Tableau-40"><a href="#Tableau-40"><span class="linenos">40</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> -</span><span id="Tableau-41"><a href="#Tableau-41"><span class="linenos">41</span></a> <span class="s2">"COUNTD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)),</span> -</span><span id="Tableau-42"><a href="#Tableau-42"><span class="linenos">42</span></a> <span class="p">}</span> +</span><span id="Tableau-15"><a href="#Tableau-15"><span class="linenos">15</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"IFNULL"</span><span class="p">),</span> +</span><span id="Tableau-16"><a href="#Tableau-16"><span class="linenos">16</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">]),</span> +</span><span id="Tableau-17"><a href="#Tableau-17"><span class="linenos">17</span></a> <span class="p">}</span> +</span><span id="Tableau-18"><a href="#Tableau-18"><span class="linenos">18</span></a> +</span><span id="Tableau-19"><a href="#Tableau-19"><span class="linenos">19</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tableau-20"><a href="#Tableau-20"><span class="linenos">20</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> +</span><span id="Tableau-21"><a href="#Tableau-21"><span class="linenos">21</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatileProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Tableau-22"><a href="#Tableau-22"><span class="linenos">22</span></a> <span class="p">}</span> +</span><span id="Tableau-23"><a href="#Tableau-23"><span class="linenos">23</span></a> +</span><span id="Tableau-24"><a href="#Tableau-24"><span class="linenos">24</span></a> <span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Tableau-25"><a href="#Tableau-25"><span class="linenos">25</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Tableau-26"><a href="#Tableau-26"><span class="linenos">26</span></a> <span class="n">true</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">)</span> +</span><span id="Tableau-27"><a href="#Tableau-27"><span class="linenos">27</span></a> <span class="n">false</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">)</span> +</span><span id="Tableau-28"><a href="#Tableau-28"><span class="linenos">28</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> THEN </span><span class="si">{</span><span class="n">true</span><span class="si">}</span><span class="s2"> ELSE </span><span class="si">{</span><span class="n">false</span><span class="si">}</span><span class="s2"> END"</span> +</span><span id="Tableau-29"><a href="#Tableau-29"><span class="linenos">29</span></a> +</span><span id="Tableau-30"><a href="#Tableau-30"><span class="linenos">30</span></a> <span class="k">def</span> <span class="nf">count_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Tableau-31"><a href="#Tableau-31"><span class="linenos">31</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Tableau-32"><a href="#Tableau-32"><span class="linenos">32</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> +</span><span id="Tableau-33"><a href="#Tableau-33"><span class="linenos">33</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNTD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Tableau-34"><a href="#Tableau-34"><span class="linenos">34</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Tableau-35"><a href="#Tableau-35"><span class="linenos">35</span></a> +</span><span id="Tableau-36"><a href="#Tableau-36"><span class="linenos">36</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Tableau-37"><a href="#Tableau-37"><span class="linenos">37</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tableau-38"><a href="#Tableau-38"><span class="linenos">38</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="Tableau-39"><a href="#Tableau-39"><span class="linenos">39</span></a> <span class="s2">"COUNTD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)),</span> +</span><span id="Tableau-40"><a href="#Tableau-40"><span class="linenos">40</span></a> <span class="p">}</span> </span></pre></div> @@ -211,74 +204,57 @@ </span><span id="Tableau.Generator-12"><a href="#Tableau.Generator-12"><span class="linenos">12</span></a> </span><span id="Tableau.Generator-13"><a href="#Tableau.Generator-13"><span class="linenos">13</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> </span><span id="Tableau.Generator-14"><a href="#Tableau.Generator-14"><span class="linenos">14</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">TRANSFORMS</span><span class="p">,</span> -</span><span id="Tableau.Generator-15"><a href="#Tableau.Generator-15"><span class="linenos">15</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">]),</span> -</span><span id="Tableau.Generator-16"><a href="#Tableau.Generator-16"><span class="linenos">16</span></a> <span class="p">}</span> -</span><span id="Tableau.Generator-17"><a href="#Tableau.Generator-17"><span class="linenos">17</span></a> -</span><span id="Tableau.Generator-18"><a href="#Tableau.Generator-18"><span class="linenos">18</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Tableau.Generator-19"><a href="#Tableau.Generator-19"><span class="linenos">19</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> -</span><span id="Tableau.Generator-20"><a href="#Tableau.Generator-20"><span class="linenos">20</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatileProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> -</span><span id="Tableau.Generator-21"><a href="#Tableau.Generator-21"><span class="linenos">21</span></a> <span class="p">}</span> -</span><span id="Tableau.Generator-22"><a href="#Tableau.Generator-22"><span class="linenos">22</span></a> -</span><span id="Tableau.Generator-23"><a href="#Tableau.Generator-23"><span class="linenos">23</span></a> <span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Tableau.Generator-24"><a href="#Tableau.Generator-24"><span class="linenos">24</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> -</span><span id="Tableau.Generator-25"><a href="#Tableau.Generator-25"><span class="linenos">25</span></a> <span class="n">true</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">)</span> -</span><span id="Tableau.Generator-26"><a href="#Tableau.Generator-26"><span class="linenos">26</span></a> <span class="n">false</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">)</span> -</span><span id="Tableau.Generator-27"><a href="#Tableau.Generator-27"><span class="linenos">27</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> THEN </span><span class="si">{</span><span class="n">true</span><span class="si">}</span><span class="s2"> ELSE </span><span class="si">{</span><span class="n">false</span><span class="si">}</span><span class="s2"> END"</span> -</span><span id="Tableau.Generator-28"><a href="#Tableau.Generator-28"><span class="linenos">28</span></a> -</span><span id="Tableau.Generator-29"><a href="#Tableau.Generator-29"><span class="linenos">29</span></a> <span class="k">def</span> <span class="nf">coalesce_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Tableau.Generator-30"><a href="#Tableau.Generator-30"><span class="linenos">30</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IFNULL(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> -</span><span id="Tableau.Generator-31"><a href="#Tableau.Generator-31"><span class="linenos">31</span></a> -</span><span id="Tableau.Generator-32"><a href="#Tableau.Generator-32"><span class="linenos">32</span></a> <span class="k">def</span> <span class="nf">count_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Tableau.Generator-33"><a href="#Tableau.Generator-33"><span class="linenos">33</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> -</span><span id="Tableau.Generator-34"><a href="#Tableau.Generator-34"><span class="linenos">34</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> -</span><span id="Tableau.Generator-35"><a href="#Tableau.Generator-35"><span class="linenos">35</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNTD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> -</span><span id="Tableau.Generator-36"><a href="#Tableau.Generator-36"><span class="linenos">36</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Tableau.Generator-15"><a href="#Tableau.Generator-15"><span class="linenos">15</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"IFNULL"</span><span class="p">),</span> +</span><span id="Tableau.Generator-16"><a href="#Tableau.Generator-16"><span class="linenos">16</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Select</span><span class="p">:</span> <span class="n">transforms</span><span class="o">.</span><span class="n">preprocess</span><span class="p">([</span><span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">]),</span> +</span><span id="Tableau.Generator-17"><a href="#Tableau.Generator-17"><span class="linenos">17</span></a> <span class="p">}</span> +</span><span id="Tableau.Generator-18"><a href="#Tableau.Generator-18"><span class="linenos">18</span></a> +</span><span id="Tableau.Generator-19"><a href="#Tableau.Generator-19"><span class="linenos">19</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tableau.Generator-20"><a href="#Tableau.Generator-20"><span class="linenos">20</span></a> <span class="o">**</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="o">.</span><span class="n">PROPERTIES_LOCATION</span><span class="p">,</span> +</span><span id="Tableau.Generator-21"><a href="#Tableau.Generator-21"><span class="linenos">21</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">VolatileProperty</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="o">.</span><span class="n">Location</span><span class="o">.</span><span class="n">UNSUPPORTED</span><span class="p">,</span> +</span><span id="Tableau.Generator-22"><a href="#Tableau.Generator-22"><span class="linenos">22</span></a> <span class="p">}</span> +</span><span id="Tableau.Generator-23"><a href="#Tableau.Generator-23"><span class="linenos">23</span></a> +</span><span id="Tableau.Generator-24"><a href="#Tableau.Generator-24"><span class="linenos">24</span></a> <span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Tableau.Generator-25"><a href="#Tableau.Generator-25"><span class="linenos">25</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Tableau.Generator-26"><a href="#Tableau.Generator-26"><span class="linenos">26</span></a> <span class="n">true</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">)</span> +</span><span id="Tableau.Generator-27"><a href="#Tableau.Generator-27"><span class="linenos">27</span></a> <span class="n">false</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">)</span> +</span><span id="Tableau.Generator-28"><a href="#Tableau.Generator-28"><span class="linenos">28</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> THEN </span><span class="si">{</span><span class="n">true</span><span class="si">}</span><span class="s2"> ELSE </span><span class="si">{</span><span class="n">false</span><span class="si">}</span><span class="s2"> END"</span> +</span><span id="Tableau.Generator-29"><a href="#Tableau.Generator-29"><span class="linenos">29</span></a> +</span><span id="Tableau.Generator-30"><a href="#Tableau.Generator-30"><span class="linenos">30</span></a> <span class="k">def</span> <span class="nf">count_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Tableau.Generator-31"><a href="#Tableau.Generator-31"><span class="linenos">31</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Tableau.Generator-32"><a href="#Tableau.Generator-32"><span class="linenos">32</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> +</span><span id="Tableau.Generator-33"><a href="#Tableau.Generator-33"><span class="linenos">33</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNTD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Tableau.Generator-34"><a href="#Tableau.Generator-34"><span class="linenos">34</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> </span></pre></div> - <div class="docstring"><p>Generator interprets the given syntax tree and produces a SQL string as an output.</p> + <div class="docstring"><p>Generator converts a given syntax tree to the corresponding SQL string.</p> <h6 id="arguments">Arguments:</h6> <ul> -<li><strong>time_mapping (dict):</strong> the dictionary of custom time mappings in which the key -represents a python time format and the output the target time format</li> -<li><strong>time_trie (trie):</strong> a trie of the time_mapping keys</li> -<li><strong>pretty (bool):</strong> if set to True the returned string will be formatted. Default: False.</li> -<li><strong>quote_start (str):</strong> specifies which starting character to use to delimit quotes. Default: '.</li> -<li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> -<li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> -<li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> -<li><strong>bit_start (str):</strong> specifies which starting character to use to delimit bit literals. Default: None.</li> -<li><strong>bit_end (str):</strong> specifies which ending character to use to delimit bit literals. Default: None.</li> -<li><strong>hex_start (str):</strong> specifies which starting character to use to delimit hex literals. Default: None.</li> -<li><strong>hex_end (str):</strong> specifies which ending character to use to delimit hex literals. Default: None.</li> -<li><strong>byte_start (str):</strong> specifies which starting character to use to delimit byte literals. Default: None.</li> -<li><strong>byte_end (str):</strong> specifies which ending character to use to delimit byte literals. Default: None.</li> -<li><strong>raw_start (str):</strong> specifies which starting character to use to delimit raw literals. Default: None.</li> -<li><strong>raw_end (str):</strong> specifies which ending character to use to delimit raw literals. Default: None.</li> -<li><strong>identify (bool | str):</strong> 'always': always quote, 'safe': quote identifiers if they don't contain an upcase, True defaults to always.</li> -<li><strong>normalize (bool):</strong> if set to True all identifiers will lower cased</li> -<li><strong>string_escape (str):</strong> specifies a string escape character. Default: '.</li> -<li><strong>identifier_escape (str):</strong> specifies an identifier escape character. Default: ".</li> -<li><strong>pad (int):</strong> determines padding in a formatted string. Default: 2.</li> -<li><strong>indent (int):</strong> determines the size of indentation in a formatted string. Default: 4.</li> -<li><strong>unnest_column_only (bool):</strong> if true unnest table aliases are considered only as column aliases</li> -<li><strong>normalize_functions (str):</strong> normalize function names, "upper", "lower", or None -Default: "upper"</li> -<li><strong>alias_post_tablesample (bool):</strong> if the table alias comes after tablesample -Default: False</li> -<li><strong>identifiers_can_start_with_digit (bool):</strong> if an unquoted identifier can start with digit -Default: False</li> -<li><strong>unsupported_level (ErrorLevel):</strong> determines the generator's behavior when it encounters -unsupported expressions. Default ErrorLevel.WARN.</li> -<li><strong>null_ordering (str):</strong> Indicates the default null ordering method to use if not explicitly set. -Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". -Default: "nulls_are_small"</li> -<li><strong>max_unsupported (int):</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. +<li><strong>pretty:</strong> Whether or not to format the produced SQL string. +Default: False.</li> +<li><strong>identify:</strong> Determines when an identifier should be quoted. Possible values are: +False (default): Never quote, except in cases where it's mandatory by the dialect. +True or 'always': Always quote. +'safe': Only quote identifiers that are case insensitive.</li> +<li><strong>normalize:</strong> Whether or not to normalize identifiers to lowercase. +Default: False.</li> +<li><strong>pad:</strong> Determines the pad size in a formatted string. +Default: 2.</li> +<li><strong>indent:</strong> Determines the indentation size in a formatted string. +Default: 2.</li> +<li><strong>normalize_functions:</strong> Whether or not to normalize all function names. Possible values are: +"upper" or True (default): Convert names to uppercase. +"lower": Convert names to lowercase. +False: Disables function name normalization.</li> +<li><strong>unsupported_level:</strong> Determines the generator's behavior when it encounters unsupported expressions. +Default ErrorLevel.WARN.</li> +<li><strong>max_unsupported:</strong> Maximum number of unsupported messages to include in a raised UnsupportedError. This is only relevant if unsupported_level is ErrorLevel.RAISE. Default: 3</li> -<li><strong>leading_comma (bool):</strong> if the the comma is leading or trailing in select statements +<li><strong>leading_comma:</strong> Determines whether or not the comma is leading or trailing in select expressions. +This is only relevant when generating in pretty mode. Default: False</li> <li><strong>max_text_width:</strong> The max number of characters in a segment before creating new lines in pretty mode. The default is on the smaller end because the length only represents a segment and not the true @@ -301,30 +277,11 @@ Default: True</li> </div> <a class="headerlink" href="#Tableau.Generator.if_sql"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau.Generator.if_sql-23"><a href="#Tableau.Generator.if_sql-23"><span class="linenos">23</span></a> <span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Tableau.Generator.if_sql-24"><a href="#Tableau.Generator.if_sql-24"><span class="linenos">24</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> -</span><span id="Tableau.Generator.if_sql-25"><a href="#Tableau.Generator.if_sql-25"><span class="linenos">25</span></a> <span class="n">true</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">)</span> -</span><span id="Tableau.Generator.if_sql-26"><a href="#Tableau.Generator.if_sql-26"><span class="linenos">26</span></a> <span class="n">false</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">)</span> -</span><span id="Tableau.Generator.if_sql-27"><a href="#Tableau.Generator.if_sql-27"><span class="linenos">27</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> THEN </span><span class="si">{</span><span class="n">true</span><span class="si">}</span><span class="s2"> ELSE </span><span class="si">{</span><span class="n">false</span><span class="si">}</span><span class="s2"> END"</span> -</span></pre></div> - - - - - </div> - <div id="Tableau.Generator.coalesce_sql" class="classattr"> - <input id="Tableau.Generator.coalesce_sql-view-source" class="view-source-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> -<div class="attr function"> - - <span class="def">def</span> - <span class="name">coalesce_sql</span><span class="signature pdoc-code condensed">(<span class="param"><span class="bp">self</span>, </span><span class="param"><span class="n">expression</span><span class="p">:</span> <span class="n"><a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> - - <label class="view-source-button" for="Tableau.Generator.coalesce_sql-view-source"><span>View Source</span></label> - - </div> - <a class="headerlink" href="#Tableau.Generator.coalesce_sql"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau.Generator.coalesce_sql-29"><a href="#Tableau.Generator.coalesce_sql-29"><span class="linenos">29</span></a> <span class="k">def</span> <span class="nf">coalesce_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Tableau.Generator.coalesce_sql-30"><a href="#Tableau.Generator.coalesce_sql-30"><span class="linenos">30</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IFNULL(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">, </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau.Generator.if_sql-24"><a href="#Tableau.Generator.if_sql-24"><span class="linenos">24</span></a> <span class="k">def</span> <span class="nf">if_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Tableau.Generator.if_sql-25"><a href="#Tableau.Generator.if_sql-25"><span class="linenos">25</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Tableau.Generator.if_sql-26"><a href="#Tableau.Generator.if_sql-26"><span class="linenos">26</span></a> <span class="n">true</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"true"</span><span class="p">)</span> +</span><span id="Tableau.Generator.if_sql-27"><a href="#Tableau.Generator.if_sql-27"><span class="linenos">27</span></a> <span class="n">false</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"false"</span><span class="p">)</span> +</span><span id="Tableau.Generator.if_sql-28"><a href="#Tableau.Generator.if_sql-28"><span class="linenos">28</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF </span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> THEN </span><span class="si">{</span><span class="n">true</span><span class="si">}</span><span class="s2"> ELSE </span><span class="si">{</span><span class="n">false</span><span class="si">}</span><span class="s2"> END"</span> </span></pre></div> @@ -342,11 +299,11 @@ Default: True</li> </div> <a class="headerlink" href="#Tableau.Generator.count_sql"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau.Generator.count_sql-32"><a href="#Tableau.Generator.count_sql-32"><span class="linenos">32</span></a> <span class="k">def</span> <span class="nf">count_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Tableau.Generator.count_sql-33"><a href="#Tableau.Generator.count_sql-33"><span class="linenos">33</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> -</span><span id="Tableau.Generator.count_sql-34"><a href="#Tableau.Generator.count_sql-34"><span class="linenos">34</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> -</span><span id="Tableau.Generator.count_sql-35"><a href="#Tableau.Generator.count_sql-35"><span class="linenos">35</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNTD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> -</span><span id="Tableau.Generator.count_sql-36"><a href="#Tableau.Generator.count_sql-36"><span class="linenos">36</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau.Generator.count_sql-30"><a href="#Tableau.Generator.count_sql-30"><span class="linenos">30</span></a> <span class="k">def</span> <span class="nf">count_sql</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Tableau.Generator.count_sql-31"><a href="#Tableau.Generator.count_sql-31"><span class="linenos">31</span></a> <span class="n">this</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">this</span> +</span><span id="Tableau.Generator.count_sql-32"><a href="#Tableau.Generator.count_sql-32"><span class="linenos">32</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> +</span><span id="Tableau.Generator.count_sql-33"><a href="#Tableau.Generator.count_sql-33"><span class="linenos">33</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNTD(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">expressions</span><span class="p">(</span><span class="n">this</span><span class="p">,</span><span class="w"> </span><span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> +</span><span id="Tableau.Generator.count_sql-34"><a href="#Tableau.Generator.count_sql-34"><span class="linenos">34</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"COUNT(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span><span class="w"> </span><span class="s1">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span> </span></pre></div> @@ -382,6 +339,7 @@ Default: True</li> <dd id="Tableau.Generator.notnullcolumnconstraint_sql" class="function"><a href="../generator.html#Generator.notnullcolumnconstraint_sql">notnullcolumnconstraint_sql</a></dd> <dd id="Tableau.Generator.primarykeycolumnconstraint_sql" class="function"><a href="../generator.html#Generator.primarykeycolumnconstraint_sql">primarykeycolumnconstraint_sql</a></dd> <dd id="Tableau.Generator.uniquecolumnconstraint_sql" class="function"><a href="../generator.html#Generator.uniquecolumnconstraint_sql">uniquecolumnconstraint_sql</a></dd> + <dd id="Tableau.Generator.createable_sql" class="function"><a href="../generator.html#Generator.createable_sql">createable_sql</a></dd> <dd id="Tableau.Generator.create_sql" class="function"><a href="../generator.html#Generator.create_sql">create_sql</a></dd> <dd id="Tableau.Generator.clone_sql" class="function"><a href="../generator.html#Generator.clone_sql">clone_sql</a></dd> <dd id="Tableau.Generator.describe_sql" class="function"><a href="../generator.html#Generator.describe_sql">describe_sql</a></dd> @@ -464,10 +422,12 @@ Default: True</li> <dd id="Tableau.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd> <dd id="Tableau.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd> <dd id="Tableau.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd> + <dd id="Tableau.Generator.offset_limit_modifiers" class="function"><a href="../generator.html#Generator.offset_limit_modifiers">offset_limit_modifiers</a></dd> <dd id="Tableau.Generator.after_having_modifiers" class="function"><a href="../generator.html#Generator.after_having_modifiers">after_having_modifiers</a></dd> <dd id="Tableau.Generator.after_limit_modifiers" class="function"><a href="../generator.html#Generator.after_limit_modifiers">after_limit_modifiers</a></dd> <dd id="Tableau.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd> <dd id="Tableau.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd> + <dd id="Tableau.Generator.schema_columns_sql" class="function"><a href="../generator.html#Generator.schema_columns_sql">schema_columns_sql</a></dd> <dd id="Tableau.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> <dd id="Tableau.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd> <dd id="Tableau.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd> @@ -492,7 +452,7 @@ Default: True</li> <dd id="Tableau.Generator.nextvaluefor_sql" class="function"><a href="../generator.html#Generator.nextvaluefor_sql">nextvaluefor_sql</a></dd> <dd id="Tableau.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd> <dd id="Tableau.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd> - <dd id="Tableau.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd> + <dd id="Tableau.Generator.safeconcat_sql" class="function"><a href="../generator.html#Generator.safeconcat_sql">safeconcat_sql</a></dd> <dd id="Tableau.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd> <dd id="Tableau.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd> <dd id="Tableau.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd> @@ -542,6 +502,7 @@ Default: True</li> <dd id="Tableau.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd> <dd id="Tableau.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd> <dd id="Tableau.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd> + <dd id="Tableau.Generator.safedpipe_sql" class="function"><a href="../generator.html#Generator.safedpipe_sql">safedpipe_sql</a></dd> <dd id="Tableau.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> <dd id="Tableau.Generator.overlaps_sql" class="function"><a href="../generator.html#Generator.overlaps_sql">overlaps_sql</a></dd> <dd id="Tableau.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd> @@ -590,6 +551,7 @@ Default: True</li> <dd id="Tableau.Generator.dictproperty_sql" class="function"><a href="../generator.html#Generator.dictproperty_sql">dictproperty_sql</a></dd> <dd id="Tableau.Generator.dictrange_sql" class="function"><a href="../generator.html#Generator.dictrange_sql">dictrange_sql</a></dd> <dd id="Tableau.Generator.dictsubproperty_sql" class="function"><a href="../generator.html#Generator.dictsubproperty_sql">dictsubproperty_sql</a></dd> + <dd id="Tableau.Generator.oncluster_sql" class="function"><a href="../generator.html#Generator.oncluster_sql">oncluster_sql</a></dd> </div> </dl> @@ -606,35 +568,27 @@ Default: True</li> </div> <a class="headerlink" href="#Tableau.Parser"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau.Parser-38"><a href="#Tableau.Parser-38"><span class="linenos">38</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> -</span><span id="Tableau.Parser-39"><a href="#Tableau.Parser-39"><span class="linenos">39</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Tableau.Parser-40"><a href="#Tableau.Parser-40"><span class="linenos">40</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> -</span><span id="Tableau.Parser-41"><a href="#Tableau.Parser-41"><span class="linenos">41</span></a> <span class="s2">"COUNTD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)),</span> -</span><span id="Tableau.Parser-42"><a href="#Tableau.Parser-42"><span class="linenos">42</span></a> <span class="p">}</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau.Parser-36"><a href="#Tableau.Parser-36"><span class="linenos">36</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Tableau.Parser-37"><a href="#Tableau.Parser-37"><span class="linenos">37</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Tableau.Parser-38"><a href="#Tableau.Parser-38"><span class="linenos">38</span></a> <span class="o">**</span><span class="n">parser</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="Tableau.Parser-39"><a href="#Tableau.Parser-39"><span class="linenos">39</span></a> <span class="s2">"COUNTD"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">(</span><span class="n">this</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">args</span><span class="p">)),</span> +</span><span id="Tableau.Parser-40"><a href="#Tableau.Parser-40"><span class="linenos">40</span></a> <span class="p">}</span> </span></pre></div> - <div class="docstring"><p>Parser consumes a list of tokens produced by the <code><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></code> and produces -a parsed syntax tree.</p> + <div class="docstring"><p>Parser consumes a list of tokens produced by the Tokenizer and produces a parsed syntax tree.</p> <h6 id="arguments">Arguments:</h6> <ul> -<li><strong>error_level:</strong> the desired error level. +<li><strong>error_level:</strong> The desired error level. Default: ErrorLevel.IMMEDIATE</li> -<li><strong>error_message_context:</strong> determines the amount of context to capture from a +<li><strong>error_message_context:</strong> Determines the amount of context to capture from a query string when displaying the error message (in number of characters). -Default: 50.</li> -<li><strong>index_offset:</strong> Index offset for arrays eg ARRAY[0] vs ARRAY[1] as the head of a list. -Default: 0</li> -<li><strong>alias_post_tablesample:</strong> If the table alias comes after tablesample. -Default: False</li> +Default: 100</li> <li><strong>max_errors:</strong> Maximum number of error messages to include in a raised ParseError. This is only relevant if error_level is ErrorLevel.RAISE. Default: 3</li> -<li><strong>null_ordering:</strong> Indicates the default null ordering method to use if not explicitly set. -Options are "nulls_are_small", "nulls_are_large", "nulls_are_last". -Default: "nulls_are_small"</li> </ul> </div> |