diff options
Diffstat (limited to 'docs/sqlglot/dialects/tableau.html')
-rw-r--r-- | docs/sqlglot/dialects/tableau.html | 275 |
1 files changed, 191 insertions, 84 deletions
diff --git a/docs/sqlglot/dialects/tableau.html b/docs/sqlglot/dialects/tableau.html index bce76c0..a3fdde4 100644 --- a/docs/sqlglot/dialects/tableau.html +++ b/docs/sqlglot/dialects/tableau.html @@ -36,6 +36,15 @@ <li> <a class="class" href="#Tableau.Generator">Tableau.Generator</a> <ul class="memberlist"> + <li> + <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> </li> @@ -77,44 +86,41 @@ </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-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">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><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"IF </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"> THEN </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">'true'</span><span class="p">)</span><span class="si">}</span><span class="s2"> ELSE </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">'false'</span><span class="p">)</span><span class="si">}</span><span class="s2"> END"</span> -</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> -</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a> -</span><span id="L-11"><a href="#L-11"><span class="linenos">11</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><span id="L-12"><a href="#L-12"><span class="linenos">12</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-13"><a href="#L-13"><span class="linenos">13</span></a> -</span><span id="L-14"><a href="#L-14"><span class="linenos">14</span></a> -</span><span id="L-15"><a href="#L-15"><span class="linenos">15</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><span id="L-16"><a href="#L-16"><span class="linenos">16</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-17"><a href="#L-17"><span class="linenos">17</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-18"><a href="#L-18"><span class="linenos">18</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-19"><a href="#L-19"><span class="linenos">19</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-20"><a href="#L-20"><span class="linenos">20</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> +</span><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-10"><a href="#L-10"><span class="linenos">10</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</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">class</span> <span class="nc">Tableau</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span> -</span><span id="L-23"><a href="#L-23"><span class="linenos">23</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> -</span><span id="L-24"><a href="#L-24"><span class="linenos">24</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-25"><a href="#L-25"><span class="linenos">25</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-26"><a href="#L-26"><span class="linenos">26</span></a> -</span><span id="L-27"><a href="#L-27"><span class="linenos">27</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-28"><a href="#L-28"><span class="linenos">28</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 class="c1"># type: ignore</span> -</span><span id="L-29"><a href="#L-29"><span class="linenos">29</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">_if_sql</span><span class="p">,</span> -</span><span id="L-30"><a href="#L-30"><span class="linenos">30</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">:</span> <span class="n">_coalesce_sql</span><span class="p">,</span> -</span><span id="L-31"><a href="#L-31"><span class="linenos">31</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">:</span> <span class="n">_count_sql</span><span class="p">,</span> -</span><span id="L-32"><a href="#L-32"><span class="linenos">32</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-33"><a href="#L-33"><span class="linenos">33</span></a> <span class="p">}</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="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-36"><a href="#L-36"><span class="linenos">36</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 class="c1"># type: ignore</span> -</span><span id="L-37"><a href="#L-37"><span class="linenos">37</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-38"><a href="#L-38"><span class="linenos">38</span></a> <span class="p">}</span> -</span><span id="L-39"><a href="#L-39"><span class="linenos">39</span></a> -</span><span id="L-40"><a href="#L-40"><span class="linenos">40</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-41"><a href="#L-41"><span class="linenos">41</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-42"><a href="#L-42"><span class="linenos">42</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 class="c1"># type: ignore</span> -</span><span id="L-43"><a href="#L-43"><span class="linenos">43</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-44"><a href="#L-44"><span class="linenos">44</span></a> <span class="p">}</span> +</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></pre></div> @@ -130,29 +136,41 @@ </div> <a class="headerlink" href="#Tableau"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau-23"><a href="#Tableau-23"><span class="linenos">23</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> -</span><span id="Tableau-24"><a href="#Tableau-24"><span class="linenos">24</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> -</span><span id="Tableau-25"><a href="#Tableau-25"><span class="linenos">25</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Tableau-26"><a href="#Tableau-26"><span class="linenos">26</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Tableau-27"><a href="#Tableau-27"><span class="linenos">27</span></a> -</span><span id="Tableau-28"><a href="#Tableau-28"><span class="linenos">28</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Tableau-29"><a href="#Tableau-29"><span class="linenos">29</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 class="c1"># type: ignore</span> -</span><span id="Tableau-30"><a href="#Tableau-30"><span class="linenos">30</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">_if_sql</span><span class="p">,</span> -</span><span id="Tableau-31"><a href="#Tableau-31"><span class="linenos">31</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">:</span> <span class="n">_coalesce_sql</span><span class="p">,</span> -</span><span id="Tableau-32"><a href="#Tableau-32"><span class="linenos">32</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">:</span> <span class="n">_count_sql</span><span class="p">,</span> -</span><span id="Tableau-33"><a href="#Tableau-33"><span class="linenos">33</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-34"><a href="#Tableau-34"><span class="linenos">34</span></a> <span class="p">}</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="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Tableau-37"><a href="#Tableau-37"><span class="linenos">37</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 class="c1"># type: ignore</span> -</span><span id="Tableau-38"><a href="#Tableau-38"><span class="linenos">38</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-39"><a href="#Tableau-39"><span class="linenos">39</span></a> <span class="p">}</span> -</span><span id="Tableau-40"><a href="#Tableau-40"><span class="linenos">40</span></a> -</span><span id="Tableau-41"><a href="#Tableau-41"><span class="linenos">41</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-42"><a href="#Tableau-42"><span class="linenos">42</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Tableau-43"><a href="#Tableau-43"><span class="linenos">43</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 class="c1"># type: ignore</span> -</span><span id="Tableau-44"><a href="#Tableau-44"><span class="linenos">44</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-45"><a href="#Tableau-45"><span class="linenos">45</span></a> <span class="p">}</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau-8"><a href="#Tableau-8"><span class="linenos"> 8</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> +</span><span id="Tableau-9"><a href="#Tableau-9"><span class="linenos"> 9</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Tableau-10"><a href="#Tableau-10"><span class="linenos">10</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Tableau-11"><a href="#Tableau-11"><span class="linenos">11</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</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></pre></div> @@ -187,22 +205,34 @@ </div> <a class="headerlink" href="#Tableau.Generator"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau.Generator-24"><a href="#Tableau.Generator-24"><span class="linenos">24</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</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">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Tableau.Generator-26"><a href="#Tableau.Generator-26"><span class="linenos">26</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Tableau.Generator-27"><a href="#Tableau.Generator-27"><span class="linenos">27</span></a> -</span><span id="Tableau.Generator-28"><a href="#Tableau.Generator-28"><span class="linenos">28</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Tableau.Generator-29"><a href="#Tableau.Generator-29"><span class="linenos">29</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 class="c1"># type: ignore</span> -</span><span id="Tableau.Generator-30"><a href="#Tableau.Generator-30"><span class="linenos">30</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">If</span><span class="p">:</span> <span class="n">_if_sql</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">exp</span><span class="o">.</span><span class="n">Coalesce</span><span class="p">:</span> <span class="n">_coalesce_sql</span><span class="p">,</span> -</span><span id="Tableau.Generator-32"><a href="#Tableau.Generator-32"><span class="linenos">32</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">:</span> <span class="n">_count_sql</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">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-34"><a href="#Tableau.Generator-34"><span class="linenos">34</span></a> <span class="p">}</span> -</span><span id="Tableau.Generator-35"><a href="#Tableau.Generator-35"><span class="linenos">35</span></a> -</span><span id="Tableau.Generator-36"><a href="#Tableau.Generator-36"><span class="linenos">36</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Tableau.Generator-37"><a href="#Tableau.Generator-37"><span class="linenos">37</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 class="c1"># type: ignore</span> -</span><span id="Tableau.Generator-38"><a href="#Tableau.Generator-38"><span class="linenos">38</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-39"><a href="#Tableau.Generator-39"><span class="linenos">39</span></a> <span class="p">}</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau.Generator-9"><a href="#Tableau.Generator-9"><span class="linenos"> 9</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">generator</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Tableau.Generator-10"><a href="#Tableau.Generator-10"><span class="linenos">10</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Tableau.Generator-11"><a href="#Tableau.Generator-11"><span class="linenos">11</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</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></pre></div> @@ -219,6 +249,14 @@ represents a python time format and the output the target time format</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> @@ -250,6 +288,69 @@ Default: True</li> </div> + <div id="Tableau.Generator.if_sql" class="classattr"> + <input id="Tableau.Generator.if_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">if_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#If">sqlglot.expressions.If</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Tableau.Generator.if_sql-view-source"><span>View Source</span></label> + + </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> +</span></pre></div> + + + + + </div> + <div id="Tableau.Generator.count_sql" class="classattr"> + <input id="Tableau.Generator.count_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">count_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#Count">sqlglot.expressions.Count</a></span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span> + + <label class="view-source-button" for="Tableau.Generator.count_sql-view-source"><span>View Source</span></label> + + </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> +</span></pre></div> + + + + + </div> <div class="inherited"> <h5>Inherited Members</h5> <dl> @@ -280,6 +381,7 @@ Default: True</li> <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.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> <dd id="Tableau.Generator.prepend_ctes" class="function"><a href="../generator.html#Generator.prepend_ctes">prepend_ctes</a></dd> <dd id="Tableau.Generator.with_sql" class="function"><a href="../generator.html#Generator.with_sql">with_sql</a></dd> @@ -288,6 +390,8 @@ Default: True</li> <dd id="Tableau.Generator.bitstring_sql" class="function"><a href="../generator.html#Generator.bitstring_sql">bitstring_sql</a></dd> <dd id="Tableau.Generator.hexstring_sql" class="function"><a href="../generator.html#Generator.hexstring_sql">hexstring_sql</a></dd> <dd id="Tableau.Generator.bytestring_sql" class="function"><a href="../generator.html#Generator.bytestring_sql">bytestring_sql</a></dd> + <dd id="Tableau.Generator.rawstring_sql" class="function"><a href="../generator.html#Generator.rawstring_sql">rawstring_sql</a></dd> + <dd id="Tableau.Generator.datatypesize_sql" class="function"><a href="../generator.html#Generator.datatypesize_sql">datatypesize_sql</a></dd> <dd id="Tableau.Generator.datatype_sql" class="function"><a href="../generator.html#Generator.datatype_sql">datatype_sql</a></dd> <dd id="Tableau.Generator.directory_sql" class="function"><a href="../generator.html#Generator.directory_sql">directory_sql</a></dd> <dd id="Tableau.Generator.delete_sql" class="function"><a href="../generator.html#Generator.delete_sql">delete_sql</a></dd> @@ -312,7 +416,6 @@ Default: True</li> <dd id="Tableau.Generator.fallbackproperty_sql" class="function"><a href="../generator.html#Generator.fallbackproperty_sql">fallbackproperty_sql</a></dd> <dd id="Tableau.Generator.journalproperty_sql" class="function"><a href="../generator.html#Generator.journalproperty_sql">journalproperty_sql</a></dd> <dd id="Tableau.Generator.freespaceproperty_sql" class="function"><a href="../generator.html#Generator.freespaceproperty_sql">freespaceproperty_sql</a></dd> - <dd id="Tableau.Generator.afterjournalproperty_sql" class="function"><a href="../generator.html#Generator.afterjournalproperty_sql">afterjournalproperty_sql</a></dd> <dd id="Tableau.Generator.checksumproperty_sql" class="function"><a href="../generator.html#Generator.checksumproperty_sql">checksumproperty_sql</a></dd> <dd id="Tableau.Generator.mergeblockratioproperty_sql" class="function"><a href="../generator.html#Generator.mergeblockratioproperty_sql">mergeblockratioproperty_sql</a></dd> <dd id="Tableau.Generator.datablocksizeproperty_sql" class="function"><a href="../generator.html#Generator.datablocksizeproperty_sql">datablocksizeproperty_sql</a></dd> @@ -359,10 +462,11 @@ 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.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.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd> - <dd id="Tableau.Generator.structkwarg_sql" class="function"><a href="../generator.html#Generator.structkwarg_sql">structkwarg_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> <dd id="Tableau.Generator.placeholder_sql" class="function"><a href="../generator.html#Generator.placeholder_sql">placeholder_sql</a></dd> @@ -391,10 +495,11 @@ Default: True</li> <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> <dd id="Tableau.Generator.unique_sql" class="function"><a href="../generator.html#Generator.unique_sql">unique_sql</a></dd> - <dd id="Tableau.Generator.if_sql" class="function"><a href="../generator.html#Generator.if_sql">if_sql</a></dd> <dd id="Tableau.Generator.matchagainst_sql" class="function"><a href="../generator.html#Generator.matchagainst_sql">matchagainst_sql</a></dd> <dd id="Tableau.Generator.jsonkeyvalue_sql" class="function"><a href="../generator.html#Generator.jsonkeyvalue_sql">jsonkeyvalue_sql</a></dd> <dd id="Tableau.Generator.jsonobject_sql" class="function"><a href="../generator.html#Generator.jsonobject_sql">jsonobject_sql</a></dd> + <dd id="Tableau.Generator.openjsoncolumndef_sql" class="function"><a href="../generator.html#Generator.openjsoncolumndef_sql">openjsoncolumndef_sql</a></dd> + <dd id="Tableau.Generator.openjson_sql" class="function"><a href="../generator.html#Generator.openjson_sql">openjson_sql</a></dd> <dd id="Tableau.Generator.in_sql" class="function"><a href="../generator.html#Generator.in_sql">in_sql</a></dd> <dd id="Tableau.Generator.in_unnest_op" class="function"><a href="../generator.html#Generator.in_unnest_op">in_unnest_op</a></dd> <dd id="Tableau.Generator.interval_sql" class="function"><a href="../generator.html#Generator.interval_sql">interval_sql</a></dd> @@ -421,6 +526,8 @@ Default: True</li> <dd id="Tableau.Generator.collate_sql" class="function"><a href="../generator.html#Generator.collate_sql">collate_sql</a></dd> <dd id="Tableau.Generator.command_sql" class="function"><a href="../generator.html#Generator.command_sql">command_sql</a></dd> <dd id="Tableau.Generator.comment_sql" class="function"><a href="../generator.html#Generator.comment_sql">comment_sql</a></dd> + <dd id="Tableau.Generator.mergetreettlaction_sql" class="function"><a href="../generator.html#Generator.mergetreettlaction_sql">mergetreettlaction_sql</a></dd> + <dd id="Tableau.Generator.mergetreettl_sql" class="function"><a href="../generator.html#Generator.mergetreettl_sql">mergetreettl_sql</a></dd> <dd id="Tableau.Generator.transaction_sql" class="function"><a href="../generator.html#Generator.transaction_sql">transaction_sql</a></dd> <dd id="Tableau.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> <dd id="Tableau.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> @@ -495,11 +602,11 @@ Default: True</li> </div> <a class="headerlink" href="#Tableau.Parser"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Tableau.Parser-41"><a href="#Tableau.Parser-41"><span class="linenos">41</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-42"><a href="#Tableau.Parser-42"><span class="linenos">42</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Tableau.Parser-43"><a href="#Tableau.Parser-43"><span class="linenos">43</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 class="c1"># type: ignore</span> -</span><span id="Tableau.Parser-44"><a href="#Tableau.Parser-44"><span class="linenos">44</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-45"><a href="#Tableau.Parser-45"><span class="linenos">45</span></a> <span class="p">}</span> + <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> </span></pre></div> |