summaryrefslogtreecommitdiffstats
path: root/docs/sqlglot/dialects/teradata.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/sqlglot/dialects/teradata.html')
-rw-r--r--docs/sqlglot/dialects/teradata.html1228
1 files changed, 654 insertions, 574 deletions
diff --git a/docs/sqlglot/dialects/teradata.html b/docs/sqlglot/dialects/teradata.html
index e4f7333..3d0f933 100644
--- a/docs/sqlglot/dialects/teradata.html
+++ b/docs/sqlglot/dialects/teradata.html
@@ -63,6 +63,9 @@
<li>
<a class="function" href="#Teradata.Generator.rangen_sql">rangen_sql</a>
</li>
+ <li>
+ <a class="function" href="#Teradata.Generator.createable_sql">createable_sql</a>
+ </li>
</ul>
</li>
@@ -94,189 +97,212 @@
<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">import</span> <span class="nn">typing</span> <span class="k">as</span> <span class="nn">t</span>
-</span><span id="L-4"><a href="#L-4"><span class="linenos"> 4</span></a>
-</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</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">tokens</span><span class="p">,</span> <span class="n">transforms</span>
-</span><span id="L-6"><a href="#L-6"><span class="linenos"> 6</span></a><span class="kn">from</span> <span class="nn">sqlglot.dialects.dialect</span> <span class="kn">import</span> <span class="p">(</span>
-</span><span id="L-7"><a href="#L-7"><span class="linenos"> 7</span></a> <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="n">format_time_lambda</span><span class="p">,</span>
-</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">max_or_greatest</span><span class="p">,</span>
-</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="n">min_or_least</span><span class="p">,</span>
-</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a><span class="p">)</span>
-</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</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">class</span> <span class="nc">Teradata</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span>
-</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span>
-</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> <span class="c1"># https://docs.teradata.com/r/Teradata-Database-SQL-Functions-Operators-Expressions-and-Predicates/March-2017/Comparison-Operators-and-Functions/Comparison-Operators/ANSI-Compliance</span>
-</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="n">KEYWORDS</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">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span>
-</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> <span class="s2">&quot;BYTEINT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span>
-</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="s2">&quot;SEL&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">,</span>
-</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="s2">&quot;INS&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INSERT</span><span class="p">,</span>
-</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="s2">&quot;MOD&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MOD</span><span class="p">,</span>
-</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="s2">&quot;LT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span>
-</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="s2">&quot;LE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LTE</span><span class="p">,</span>
-</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="s2">&quot;GT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span>
-</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="s2">&quot;GE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GTE</span><span class="p">,</span>
-</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="s2">&quot;^=&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
-</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a> <span class="s2">&quot;NE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
-</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="s2">&quot;NOT=&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
-</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="s2">&quot;ST_GEOMETRY&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">,</span>
-</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="p">}</span>
-</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a>
-</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="c1"># teradata does not support % for modulus</span>
-</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">}</span>
-</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;%&quot;</span><span class="p">)</span>
-</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a>
-</span><span id="L-38"><a href="#L-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="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="n">CHARSET_TRANSLATORS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="s2">&quot;GRAPHIC_TO_KANJISJIS&quot;</span><span class="p">,</span>
-</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="s2">&quot;GRAPHIC_TO_LATIN&quot;</span><span class="p">,</span>
-</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="s2">&quot;GRAPHIC_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="s2">&quot;GRAPHIC_TO_UNICODE_PadSpace&quot;</span><span class="p">,</span>
-</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="s2">&quot;KANJI1_KanjiEBCDIC_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="s2">&quot;KANJI1_KanjiEUC_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="s2">&quot;KANJI1_KANJISJIS_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="s2">&quot;KANJI1_SBC_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="s2">&quot;KANJISJIS_TO_GRAPHIC&quot;</span><span class="p">,</span>
-</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="s2">&quot;KANJISJIS_TO_LATIN&quot;</span><span class="p">,</span>
-</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="s2">&quot;KANJISJIS_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="s2">&quot;LATIN_TO_GRAPHIC&quot;</span><span class="p">,</span>
-</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="s2">&quot;LATIN_TO_KANJISJIS&quot;</span><span class="p">,</span>
-</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="s2">&quot;LATIN_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="s2">&quot;LOCALE_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC&quot;</span><span class="p">,</span>
-</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC_PadGraphic&quot;</span><span class="p">,</span>
-</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC_VarGraphic&quot;</span><span class="p">,</span>
-</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KanjiEBCDIC&quot;</span><span class="p">,</span>
-</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KanjiEUC&quot;</span><span class="p">,</span>
-</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KANJISJIS&quot;</span><span class="p">,</span>
-</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_SBC&quot;</span><span class="p">,</span>
-</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="s2">&quot;UNICODE_TO_KANJISJIS&quot;</span><span class="p">,</span>
-</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="s2">&quot;UNICODE_TO_LATIN&quot;</span><span class="p">,</span>
-</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="s2">&quot;UNICODE_TO_LOCALE&quot;</span><span class="p">,</span>
-</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_FoldSpace&quot;</span><span class="p">,</span>
-</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_Fullwidth&quot;</span><span class="p">,</span>
-</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_Halfwidth&quot;</span><span class="p">,</span>
-</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFC&quot;</span><span class="p">,</span>
-</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFD&quot;</span><span class="p">,</span>
-</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFKC&quot;</span><span class="p">,</span>
-</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFKD&quot;</span><span class="p">,</span>
-</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="p">}</span>
-</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a>
-</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span><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">FUNC_TOKENS</span><span class="p">}</span>
-</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">FUNC_TOKENS</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">)</span>
-</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a>
-</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</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">STATEMENT_PARSERS</span><span class="p">,</span>
-</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create</span><span class="p">(),</span>
-</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="p">}</span>
-</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a>
-</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</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">FUNCTION_PARSERS</span><span class="p">,</span>
-</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="s2">&quot;RANGE_N&quot;</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_rangen</span><span class="p">(),</span>
-</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="s2">&quot;TRANSLATE&quot;</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span>
+</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">tokens</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 class="p">,</span> <span class="n">max_or_greatest</span><span class="p">,</span> <span class="n">min_or_least</span>
+</span><span id="L-5"><a href="#L-5"><span class="linenos"> 5</span></a><span class="kn">from</span> <span class="nn">sqlglot.tokens</span> <span class="kn">import</span> <span class="n">TokenType</span>
+</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><span id="L-8"><a href="#L-8"><span class="linenos"> 8</span></a><span class="k">class</span> <span class="nc">Teradata</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span>
+</span><span id="L-9"><a href="#L-9"><span class="linenos"> 9</span></a> <span class="n">TIME_MAPPING</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="L-10"><a href="#L-10"><span class="linenos"> 10</span></a> <span class="s2">&quot;Y&quot;</span><span class="p">:</span> <span class="s2">&quot;%Y&quot;</span><span class="p">,</span>
+</span><span id="L-11"><a href="#L-11"><span class="linenos"> 11</span></a> <span class="s2">&quot;YYYY&quot;</span><span class="p">:</span> <span class="s2">&quot;%Y&quot;</span><span class="p">,</span>
+</span><span id="L-12"><a href="#L-12"><span class="linenos"> 12</span></a> <span class="s2">&quot;YY&quot;</span><span class="p">:</span> <span class="s2">&quot;%y&quot;</span><span class="p">,</span>
+</span><span id="L-13"><a href="#L-13"><span class="linenos"> 13</span></a> <span class="s2">&quot;MMMM&quot;</span><span class="p">:</span> <span class="s2">&quot;%B&quot;</span><span class="p">,</span>
+</span><span id="L-14"><a href="#L-14"><span class="linenos"> 14</span></a> <span class="s2">&quot;MMM&quot;</span><span class="p">:</span> <span class="s2">&quot;%b&quot;</span><span class="p">,</span>
+</span><span id="L-15"><a href="#L-15"><span class="linenos"> 15</span></a> <span class="s2">&quot;DD&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%d</span><span class="s2">&quot;</span><span class="p">,</span>
+</span><span id="L-16"><a href="#L-16"><span class="linenos"> 16</span></a> <span class="s2">&quot;D&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%-d</span><span class="s2">&quot;</span><span class="p">,</span>
+</span><span id="L-17"><a href="#L-17"><span class="linenos"> 17</span></a> <span class="s2">&quot;HH&quot;</span><span class="p">:</span> <span class="s2">&quot;%H&quot;</span><span class="p">,</span>
+</span><span id="L-18"><a href="#L-18"><span class="linenos"> 18</span></a> <span class="s2">&quot;H&quot;</span><span class="p">:</span> <span class="s2">&quot;%-H&quot;</span><span class="p">,</span>
+</span><span id="L-19"><a href="#L-19"><span class="linenos"> 19</span></a> <span class="s2">&quot;MM&quot;</span><span class="p">:</span> <span class="s2">&quot;%M&quot;</span><span class="p">,</span>
+</span><span id="L-20"><a href="#L-20"><span class="linenos"> 20</span></a> <span class="s2">&quot;M&quot;</span><span class="p">:</span> <span class="s2">&quot;%-M&quot;</span><span class="p">,</span>
+</span><span id="L-21"><a href="#L-21"><span class="linenos"> 21</span></a> <span class="s2">&quot;SS&quot;</span><span class="p">:</span> <span class="s2">&quot;%S&quot;</span><span class="p">,</span>
+</span><span id="L-22"><a href="#L-22"><span class="linenos"> 22</span></a> <span class="s2">&quot;S&quot;</span><span class="p">:</span> <span class="s2">&quot;%-S&quot;</span><span class="p">,</span>
+</span><span id="L-23"><a href="#L-23"><span class="linenos"> 23</span></a> <span class="s2">&quot;SSSSSS&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%f</span><span class="s2">&quot;</span><span class="p">,</span>
+</span><span id="L-24"><a href="#L-24"><span class="linenos"> 24</span></a> <span class="s2">&quot;E&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%a</span><span class="s2">&quot;</span><span class="p">,</span>
+</span><span id="L-25"><a href="#L-25"><span class="linenos"> 25</span></a> <span class="s2">&quot;EE&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%a</span><span class="s2">&quot;</span><span class="p">,</span>
+</span><span id="L-26"><a href="#L-26"><span class="linenos"> 26</span></a> <span class="s2">&quot;EEE&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%a</span><span class="s2">&quot;</span><span class="p">,</span>
+</span><span id="L-27"><a href="#L-27"><span class="linenos"> 27</span></a> <span class="s2">&quot;EEEE&quot;</span><span class="p">:</span> <span class="s2">&quot;%A&quot;</span><span class="p">,</span>
+</span><span id="L-28"><a href="#L-28"><span class="linenos"> 28</span></a> <span class="p">}</span>
+</span><span id="L-29"><a href="#L-29"><span class="linenos"> 29</span></a>
+</span><span id="L-30"><a href="#L-30"><span class="linenos"> 30</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span>
+</span><span id="L-31"><a href="#L-31"><span class="linenos"> 31</span></a> <span class="c1"># https://docs.teradata.com/r/Teradata-Database-SQL-Functions-Operators-Expressions-and-Predicates/March-2017/Comparison-Operators-and-Functions/Comparison-Operators/ANSI-Compliance</span>
+</span><span id="L-32"><a href="#L-32"><span class="linenos"> 32</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="L-33"><a href="#L-33"><span class="linenos"> 33</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span>
+</span><span id="L-34"><a href="#L-34"><span class="linenos"> 34</span></a> <span class="s2">&quot;BYTEINT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span>
+</span><span id="L-35"><a href="#L-35"><span class="linenos"> 35</span></a> <span class="s2">&quot;SEL&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">,</span>
+</span><span id="L-36"><a href="#L-36"><span class="linenos"> 36</span></a> <span class="s2">&quot;INS&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INSERT</span><span class="p">,</span>
+</span><span id="L-37"><a href="#L-37"><span class="linenos"> 37</span></a> <span class="s2">&quot;MOD&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MOD</span><span class="p">,</span>
+</span><span id="L-38"><a href="#L-38"><span class="linenos"> 38</span></a> <span class="s2">&quot;LT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span>
+</span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="s2">&quot;LE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LTE</span><span class="p">,</span>
+</span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="s2">&quot;GT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span>
+</span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="s2">&quot;GE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GTE</span><span class="p">,</span>
+</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="s2">&quot;^=&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
+</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="s2">&quot;NE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
+</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="s2">&quot;NOT=&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
+</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="s2">&quot;ST_GEOMETRY&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">,</span>
+</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="p">}</span>
+</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a>
+</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="c1"># Teradata does not support % as a modulo operator</span>
+</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">}</span>
+</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;%&quot;</span><span class="p">)</span>
+</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a>
+</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</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-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="n">CHARSET_TRANSLATORS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="s2">&quot;GRAPHIC_TO_KANJISJIS&quot;</span><span class="p">,</span>
+</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="s2">&quot;GRAPHIC_TO_LATIN&quot;</span><span class="p">,</span>
+</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="s2">&quot;GRAPHIC_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="s2">&quot;GRAPHIC_TO_UNICODE_PadSpace&quot;</span><span class="p">,</span>
+</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="s2">&quot;KANJI1_KanjiEBCDIC_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="s2">&quot;KANJI1_KanjiEUC_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="s2">&quot;KANJI1_KANJISJIS_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="s2">&quot;KANJI1_SBC_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="s2">&quot;KANJISJIS_TO_GRAPHIC&quot;</span><span class="p">,</span>
+</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="s2">&quot;KANJISJIS_TO_LATIN&quot;</span><span class="p">,</span>
+</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="s2">&quot;KANJISJIS_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="s2">&quot;LATIN_TO_GRAPHIC&quot;</span><span class="p">,</span>
+</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="s2">&quot;LATIN_TO_KANJISJIS&quot;</span><span class="p">,</span>
+</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="s2">&quot;LATIN_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="s2">&quot;LOCALE_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC&quot;</span><span class="p">,</span>
+</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC_PadGraphic&quot;</span><span class="p">,</span>
+</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC_VarGraphic&quot;</span><span class="p">,</span>
+</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KanjiEBCDIC&quot;</span><span class="p">,</span>
+</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KanjiEUC&quot;</span><span class="p">,</span>
+</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KANJISJIS&quot;</span><span class="p">,</span>
+</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_SBC&quot;</span><span class="p">,</span>
+</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="s2">&quot;UNICODE_TO_KANJISJIS&quot;</span><span class="p">,</span>
+</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="s2">&quot;UNICODE_TO_LATIN&quot;</span><span class="p">,</span>
+</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="s2">&quot;UNICODE_TO_LOCALE&quot;</span><span class="p">,</span>
+</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_FoldSpace&quot;</span><span class="p">,</span>
+</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_Fullwidth&quot;</span><span class="p">,</span>
+</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_Halfwidth&quot;</span><span class="p">,</span>
+</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFC&quot;</span><span class="p">,</span>
+</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFD&quot;</span><span class="p">,</span>
+</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFKC&quot;</span><span class="p">,</span>
+</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFKD&quot;</span><span class="p">,</span>
</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="p">}</span>
</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a>
-</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="k">def</span> <span class="nf">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span>
-</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span>
+</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span><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">FUNC_TOKENS</span><span class="p">}</span>
+</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">FUNC_TOKENS</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">)</span>
</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a>
-</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span>
-</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">&quot;Expected USING in TRANSLATE&quot;</span><span class="p">)</span>
-</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a>
-</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CHARSET_TRANSLATORS</span><span class="p">):</span>
-</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a> <span class="n">charset_split</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;_TO_&quot;</span><span class="p">)</span>
-</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">charset_split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
-</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">&quot;Expected a character set translator after USING in TRANSLATE&quot;</span><span class="p">)</span>
-</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a>
-</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span>
+</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</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">STATEMENT_PARSERS</span><span class="p">,</span>
+</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create</span><span class="p">(),</span>
+</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> <span class="p">}</span>
+</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</span></a>
+</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</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">FUNCTION_PARSERS</span><span class="p">,</span>
+</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="s2">&quot;RANGE_N&quot;</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_rangen</span><span class="p">(),</span>
+</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="s2">&quot;TRANSLATE&quot;</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span>
+</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="p">}</span>
</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a>
-</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span>
-</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span>
-</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a> <span class="k">def</span> <span class="nf">_parse_update</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span>
-</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span>
-</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span>
-</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span>
-</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="s2">&quot;this&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">UPDATE_ALIAS_TOKENS</span><span class="p">),</span>
-</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="s2">&quot;from&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(</span><span class="n">modifiers</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span>
-</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="s2">&quot;expressions&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span>
-</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span>
-</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="s2">&quot;where&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span>
-</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="p">},</span>
-</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="p">)</span>
+</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="k">def</span> <span class="nf">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span>
+</span><span id="L-103"><a href="#L-103"><span class="linenos">103</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span>
+</span><span id="L-104"><a href="#L-104"><span class="linenos">104</span></a>
+</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span>
+</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">&quot;Expected USING in TRANSLATE&quot;</span><span class="p">)</span>
+</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a>
+</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CHARSET_TRANSLATORS</span><span class="p">):</span>
+</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="n">charset_split</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;_TO_&quot;</span><span class="p">)</span>
+</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">charset_split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">&quot;Expected a character set translator after USING in TRANSLATE&quot;</span><span class="p">)</span>
+</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a>
+</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span>
</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a>
-</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="k">def</span> <span class="nf">_parse_rangen</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
-</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span>
-</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)</span>
-</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a>
-</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span>
-</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="n">each</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">&quot;EACH&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span>
-</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a>
-</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RangeN</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">each</span><span class="o">=</span><span class="n">each</span><span class="p">)</span>
-</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a>
-</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="k">def</span> <span class="nf">_parse_cast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span>
-</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="n">cast</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">,</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_cast</span><span class="p">(</span><span class="n">strict</span><span class="p">))</span>
-</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="k">if</span> <span class="n">cast</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">):</span>
-</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="k">return</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">&quot;teradata&quot;</span><span class="p">)(</span>
-</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="p">[</span><span class="n">cast</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()]</span>
-</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="p">)</span>
-</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="k">return</span> <span class="n">cast</span>
-</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a>
-</span><span id="L-133"><a href="#L-133"><span class="linenos">133</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-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span>
-</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span>
+</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span>
+</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span>
+</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="k">def</span> <span class="nf">_parse_update</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">:</span>
+</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span>
+</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span>
+</span><span id="L-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span>
+</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="s2">&quot;this&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">UPDATE_ALIAS_TOKENS</span><span class="p">),</span>
+</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="s2">&quot;from&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(</span><span class="n">modifiers</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span>
+</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="s2">&quot;expressions&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span>
+</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span>
+</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="s2">&quot;where&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span>
+</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="p">},</span>
+</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> <span class="p">)</span>
+</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a>
+</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="k">def</span> <span class="nf">_parse_rangen</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span>
+</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)</span>
+</span><span id="L-133"><a href="#L-133"><span class="linenos">133</span></a>
+</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span>
+</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">each</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">&quot;EACH&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span>
</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a>
-</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="L-138"><a href="#L-138"><span class="linenos">138</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">TYPE_MAPPING</span><span class="p">,</span>
-</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">:</span> <span class="s2">&quot;ST_GEOMETRY&quot;</span><span class="p">,</span>
-</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="p">}</span>
-</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a>
-</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="L-143"><a href="#L-143"><span class="linenos">143</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-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">OnCommitProperty</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">POST_INDEX</span><span class="p">,</span>
-</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</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">POST_EXPRESSION</span><span class="p">,</span>
-</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StabilityProperty</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">POST_CREATE</span><span class="p">,</span>
-</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="p">}</span>
-</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a>
-</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="L-150"><a href="#L-150"><span class="linenos">150</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-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Max</span><span class="p">:</span> <span class="n">max_or_greatest</span><span class="p">,</span>
-</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Min</span><span class="p">:</span> <span class="n">min_or_least</span><span class="p">,</span>
-</span><span id="L-153"><a href="#L-153"><span class="linenos">153</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-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">&quot;CAST(</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">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE FORMAT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)&quot;</span><span class="p">,</span>
-</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ToChar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">e</span><span class="p">),</span>
-</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="p">}</span>
-</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a>
-</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="k">def</span> <span class="nf">partitionedbyproperty_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">PartitionedByProperty</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;PARTITION BY </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">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span>
-</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a>
-</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span>
-</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span>
-</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="k">def</span> <span class="nf">update_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">Update</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="L-164"><a href="#L-164"><span class="linenos">164</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">&quot;this&quot;</span><span class="p">)</span>
-</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="n">from_sql</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">&quot;from&quot;</span><span class="p">)</span>
-</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">set_sql</span> <span class="o">=</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="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
-</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="n">where_sql</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">&quot;where&quot;</span><span class="p">)</span>
-</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">&quot;</span>
-</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span>
-</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a>
-</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="k">def</span> <span class="nf">mod_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">Mod</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;MOD&quot;</span><span class="p">)</span>
-</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a>
-</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="k">def</span> <span class="nf">datatype_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">DataType</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">type_sql</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="n">prefix_sql</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;prefix&quot;</span><span class="p">)</span>
-</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">prefix_sql</span> <span class="k">else</span> <span class="n">type_sql</span>
-</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a>
-</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="k">def</span> <span class="nf">rangen_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">RangeN</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="L-180"><a href="#L-180"><span class="linenos">180</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">&quot;this&quot;</span><span class="p">)</span>
-</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="n">expressions_sql</span> <span class="o">=</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><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="n">each_sql</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">&quot;each&quot;</span><span class="p">)</span>
-</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
+</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RangeN</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">each</span><span class="o">=</span><span class="n">each</span><span class="p">)</span>
+</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a>
+</span><span id="L-139"><a href="#L-139"><span class="linenos">139</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-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span>
+</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span>
+</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a>
+</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="L-144"><a href="#L-144"><span class="linenos">144</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">TYPE_MAPPING</span><span class="p">,</span>
+</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">:</span> <span class="s2">&quot;ST_GEOMETRY&quot;</span><span class="p">,</span>
+</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="p">}</span>
+</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a>
+</span><span id="L-148"><a href="#L-148"><span class="linenos">148</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="L-149"><a href="#L-149"><span class="linenos">149</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-150"><a href="#L-150"><span class="linenos">150</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">OnCommitProperty</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">POST_INDEX</span><span class="p">,</span>
+</span><span id="L-151"><a href="#L-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</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">POST_EXPRESSION</span><span class="p">,</span>
+</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StabilityProperty</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">POST_CREATE</span><span class="p">,</span>
+</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="p">}</span>
+</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a>
+</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="L-156"><a href="#L-156"><span class="linenos">156</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-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Max</span><span class="p">:</span> <span class="n">max_or_greatest</span><span class="p">,</span>
+</span><span id="L-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Min</span><span class="p">:</span> <span class="n">min_or_least</span><span class="p">,</span>
+</span><span id="L-159"><a href="#L-159"><span class="linenos">159</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-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">&quot;CAST(</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">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE FORMAT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)&quot;</span><span class="p">,</span>
+</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ToChar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">e</span><span class="p">),</span>
+</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="p">}</span>
+</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a>
+</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="k">def</span> <span class="nf">partitionedbyproperty_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">PartitionedByProperty</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;PARTITION BY </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">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a>
+</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span>
+</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span>
+</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="k">def</span> <span class="nf">update_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">Update</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-170"><a href="#L-170"><span class="linenos">170</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">&quot;this&quot;</span><span class="p">)</span>
+</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="n">from_sql</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">&quot;from&quot;</span><span class="p">)</span>
+</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="n">set_sql</span> <span class="o">=</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="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
+</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="n">where_sql</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">&quot;where&quot;</span><span class="p">)</span>
+</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span>
+</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a>
+</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="k">def</span> <span class="nf">mod_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">Mod</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;MOD&quot;</span><span class="p">)</span>
+</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a>
+</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="k">def</span> <span class="nf">datatype_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">DataType</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="n">type_sql</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="n">prefix_sql</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;prefix&quot;</span><span class="p">)</span>
+</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">prefix_sql</span> <span class="k">else</span> <span class="n">type_sql</span>
</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a>
-</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;RANGE_N(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">)&quot;</span>
+</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="k">def</span> <span class="nf">rangen_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">RangeN</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-186"><a href="#L-186"><span class="linenos">186</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">&quot;this&quot;</span><span class="p">)</span>
+</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="n">expressions_sql</span> <span class="o">=</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><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="n">each_sql</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">&quot;each&quot;</span><span class="p">)</span>
+</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
+</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a>
+</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;RANGE_N(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">)&quot;</span>
+</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a>
+</span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> <span class="k">def</span> <span class="nf">createable_sql</span><span class="p">(</span>
+</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="bp">self</span><span class="p">,</span>
+</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">,</span>
+</span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> <span class="n">locations</span><span class="p">:</span> <span class="nb">dict</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="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">]],</span>
+</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="n">kind</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">&quot;kind&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span>
+</span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">&quot;TABLE&quot;</span> <span class="ow">and</span> <span class="n">locations</span><span class="o">.</span><span class="n">get</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">POST_NAME</span><span class="p">):</span>
+</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="n">this_name</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="o">.</span><span class="n">this</span><span class="p">,</span> <span class="s2">&quot;this&quot;</span><span class="p">)</span>
+</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="n">this_properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span>
+</span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">locations</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">POST_NAME</span><span class="p">]),</span>
+</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
+</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">&quot;,&quot;</span><span class="p">,</span>
+</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="p">)</span>
+</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="n">this_schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">schema_columns_sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span>
+</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">this_name</span><span class="si">}{</span><span class="n">this_properties</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this_schema</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">createable_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">locations</span><span class="p">)</span>
</span></pre></div>
@@ -292,177 +318,207 @@
</div>
<a class="headerlink" href="#Teradata"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata-16"><a href="#Teradata-16"><span class="linenos"> 16</span></a><span class="k">class</span> <span class="nc">Teradata</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span>
-</span><span id="Teradata-17"><a href="#Teradata-17"><span class="linenos"> 17</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span>
-</span><span id="Teradata-18"><a href="#Teradata-18"><span class="linenos"> 18</span></a> <span class="c1"># https://docs.teradata.com/r/Teradata-Database-SQL-Functions-Operators-Expressions-and-Predicates/March-2017/Comparison-Operators-and-Functions/Comparison-Operators/ANSI-Compliance</span>
-</span><span id="Teradata-19"><a href="#Teradata-19"><span class="linenos"> 19</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata-20"><a href="#Teradata-20"><span class="linenos"> 20</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span>
-</span><span id="Teradata-21"><a href="#Teradata-21"><span class="linenos"> 21</span></a> <span class="s2">&quot;BYTEINT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span>
-</span><span id="Teradata-22"><a href="#Teradata-22"><span class="linenos"> 22</span></a> <span class="s2">&quot;SEL&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">,</span>
-</span><span id="Teradata-23"><a href="#Teradata-23"><span class="linenos"> 23</span></a> <span class="s2">&quot;INS&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INSERT</span><span class="p">,</span>
-</span><span id="Teradata-24"><a href="#Teradata-24"><span class="linenos"> 24</span></a> <span class="s2">&quot;MOD&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MOD</span><span class="p">,</span>
-</span><span id="Teradata-25"><a href="#Teradata-25"><span class="linenos"> 25</span></a> <span class="s2">&quot;LT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span>
-</span><span id="Teradata-26"><a href="#Teradata-26"><span class="linenos"> 26</span></a> <span class="s2">&quot;LE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LTE</span><span class="p">,</span>
-</span><span id="Teradata-27"><a href="#Teradata-27"><span class="linenos"> 27</span></a> <span class="s2">&quot;GT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span>
-</span><span id="Teradata-28"><a href="#Teradata-28"><span class="linenos"> 28</span></a> <span class="s2">&quot;GE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GTE</span><span class="p">,</span>
-</span><span id="Teradata-29"><a href="#Teradata-29"><span class="linenos"> 29</span></a> <span class="s2">&quot;^=&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
-</span><span id="Teradata-30"><a href="#Teradata-30"><span class="linenos"> 30</span></a> <span class="s2">&quot;NE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
-</span><span id="Teradata-31"><a href="#Teradata-31"><span class="linenos"> 31</span></a> <span class="s2">&quot;NOT=&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
-</span><span id="Teradata-32"><a href="#Teradata-32"><span class="linenos"> 32</span></a> <span class="s2">&quot;ST_GEOMETRY&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">,</span>
-</span><span id="Teradata-33"><a href="#Teradata-33"><span class="linenos"> 33</span></a> <span class="p">}</span>
-</span><span id="Teradata-34"><a href="#Teradata-34"><span class="linenos"> 34</span></a>
-</span><span id="Teradata-35"><a href="#Teradata-35"><span class="linenos"> 35</span></a> <span class="c1"># teradata does not support % for modulus</span>
-</span><span id="Teradata-36"><a href="#Teradata-36"><span class="linenos"> 36</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">}</span>
-</span><span id="Teradata-37"><a href="#Teradata-37"><span class="linenos"> 37</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;%&quot;</span><span class="p">)</span>
-</span><span id="Teradata-38"><a href="#Teradata-38"><span class="linenos"> 38</span></a>
-</span><span id="Teradata-39"><a href="#Teradata-39"><span class="linenos"> 39</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="Teradata-40"><a href="#Teradata-40"><span class="linenos"> 40</span></a> <span class="n">CHARSET_TRANSLATORS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata-41"><a href="#Teradata-41"><span class="linenos"> 41</span></a> <span class="s2">&quot;GRAPHIC_TO_KANJISJIS&quot;</span><span class="p">,</span>
-</span><span id="Teradata-42"><a href="#Teradata-42"><span class="linenos"> 42</span></a> <span class="s2">&quot;GRAPHIC_TO_LATIN&quot;</span><span class="p">,</span>
-</span><span id="Teradata-43"><a href="#Teradata-43"><span class="linenos"> 43</span></a> <span class="s2">&quot;GRAPHIC_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata-44"><a href="#Teradata-44"><span class="linenos"> 44</span></a> <span class="s2">&quot;GRAPHIC_TO_UNICODE_PadSpace&quot;</span><span class="p">,</span>
-</span><span id="Teradata-45"><a href="#Teradata-45"><span class="linenos"> 45</span></a> <span class="s2">&quot;KANJI1_KanjiEBCDIC_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata-46"><a href="#Teradata-46"><span class="linenos"> 46</span></a> <span class="s2">&quot;KANJI1_KanjiEUC_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata-47"><a href="#Teradata-47"><span class="linenos"> 47</span></a> <span class="s2">&quot;KANJI1_KANJISJIS_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata-48"><a href="#Teradata-48"><span class="linenos"> 48</span></a> <span class="s2">&quot;KANJI1_SBC_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata-49"><a href="#Teradata-49"><span class="linenos"> 49</span></a> <span class="s2">&quot;KANJISJIS_TO_GRAPHIC&quot;</span><span class="p">,</span>
-</span><span id="Teradata-50"><a href="#Teradata-50"><span class="linenos"> 50</span></a> <span class="s2">&quot;KANJISJIS_TO_LATIN&quot;</span><span class="p">,</span>
-</span><span id="Teradata-51"><a href="#Teradata-51"><span class="linenos"> 51</span></a> <span class="s2">&quot;KANJISJIS_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata-52"><a href="#Teradata-52"><span class="linenos"> 52</span></a> <span class="s2">&quot;LATIN_TO_GRAPHIC&quot;</span><span class="p">,</span>
-</span><span id="Teradata-53"><a href="#Teradata-53"><span class="linenos"> 53</span></a> <span class="s2">&quot;LATIN_TO_KANJISJIS&quot;</span><span class="p">,</span>
-</span><span id="Teradata-54"><a href="#Teradata-54"><span class="linenos"> 54</span></a> <span class="s2">&quot;LATIN_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata-55"><a href="#Teradata-55"><span class="linenos"> 55</span></a> <span class="s2">&quot;LOCALE_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata-56"><a href="#Teradata-56"><span class="linenos"> 56</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC&quot;</span><span class="p">,</span>
-</span><span id="Teradata-57"><a href="#Teradata-57"><span class="linenos"> 57</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC_PadGraphic&quot;</span><span class="p">,</span>
-</span><span id="Teradata-58"><a href="#Teradata-58"><span class="linenos"> 58</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC_VarGraphic&quot;</span><span class="p">,</span>
-</span><span id="Teradata-59"><a href="#Teradata-59"><span class="linenos"> 59</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KanjiEBCDIC&quot;</span><span class="p">,</span>
-</span><span id="Teradata-60"><a href="#Teradata-60"><span class="linenos"> 60</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KanjiEUC&quot;</span><span class="p">,</span>
-</span><span id="Teradata-61"><a href="#Teradata-61"><span class="linenos"> 61</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KANJISJIS&quot;</span><span class="p">,</span>
-</span><span id="Teradata-62"><a href="#Teradata-62"><span class="linenos"> 62</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_SBC&quot;</span><span class="p">,</span>
-</span><span id="Teradata-63"><a href="#Teradata-63"><span class="linenos"> 63</span></a> <span class="s2">&quot;UNICODE_TO_KANJISJIS&quot;</span><span class="p">,</span>
-</span><span id="Teradata-64"><a href="#Teradata-64"><span class="linenos"> 64</span></a> <span class="s2">&quot;UNICODE_TO_LATIN&quot;</span><span class="p">,</span>
-</span><span id="Teradata-65"><a href="#Teradata-65"><span class="linenos"> 65</span></a> <span class="s2">&quot;UNICODE_TO_LOCALE&quot;</span><span class="p">,</span>
-</span><span id="Teradata-66"><a href="#Teradata-66"><span class="linenos"> 66</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_FoldSpace&quot;</span><span class="p">,</span>
-</span><span id="Teradata-67"><a href="#Teradata-67"><span class="linenos"> 67</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_Fullwidth&quot;</span><span class="p">,</span>
-</span><span id="Teradata-68"><a href="#Teradata-68"><span class="linenos"> 68</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_Halfwidth&quot;</span><span class="p">,</span>
-</span><span id="Teradata-69"><a href="#Teradata-69"><span class="linenos"> 69</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFC&quot;</span><span class="p">,</span>
-</span><span id="Teradata-70"><a href="#Teradata-70"><span class="linenos"> 70</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFD&quot;</span><span class="p">,</span>
-</span><span id="Teradata-71"><a href="#Teradata-71"><span class="linenos"> 71</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFKC&quot;</span><span class="p">,</span>
-</span><span id="Teradata-72"><a href="#Teradata-72"><span class="linenos"> 72</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFKD&quot;</span><span class="p">,</span>
-</span><span id="Teradata-73"><a href="#Teradata-73"><span class="linenos"> 73</span></a> <span class="p">}</span>
-</span><span id="Teradata-74"><a href="#Teradata-74"><span class="linenos"> 74</span></a>
-</span><span id="Teradata-75"><a href="#Teradata-75"><span class="linenos"> 75</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span><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">FUNC_TOKENS</span><span class="p">}</span>
-</span><span id="Teradata-76"><a href="#Teradata-76"><span class="linenos"> 76</span></a> <span class="n">FUNC_TOKENS</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">)</span>
-</span><span id="Teradata-77"><a href="#Teradata-77"><span class="linenos"> 77</span></a>
-</span><span id="Teradata-78"><a href="#Teradata-78"><span class="linenos"> 78</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata-79"><a href="#Teradata-79"><span class="linenos"> 79</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">STATEMENT_PARSERS</span><span class="p">,</span>
-</span><span id="Teradata-80"><a href="#Teradata-80"><span class="linenos"> 80</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create</span><span class="p">(),</span>
-</span><span id="Teradata-81"><a href="#Teradata-81"><span class="linenos"> 81</span></a> <span class="p">}</span>
-</span><span id="Teradata-82"><a href="#Teradata-82"><span class="linenos"> 82</span></a>
-</span><span id="Teradata-83"><a href="#Teradata-83"><span class="linenos"> 83</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata-84"><a href="#Teradata-84"><span class="linenos"> 84</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">FUNCTION_PARSERS</span><span class="p">,</span>
-</span><span id="Teradata-85"><a href="#Teradata-85"><span class="linenos"> 85</span></a> <span class="s2">&quot;RANGE_N&quot;</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_rangen</span><span class="p">(),</span>
-</span><span id="Teradata-86"><a href="#Teradata-86"><span class="linenos"> 86</span></a> <span class="s2">&quot;TRANSLATE&quot;</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata-9"><a href="#Teradata-9"><span class="linenos"> 9</span></a><span class="k">class</span> <span class="nc">Teradata</span><span class="p">(</span><span class="n">Dialect</span><span class="p">):</span>
+</span><span id="Teradata-10"><a href="#Teradata-10"><span class="linenos"> 10</span></a> <span class="n">TIME_MAPPING</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata-11"><a href="#Teradata-11"><span class="linenos"> 11</span></a> <span class="s2">&quot;Y&quot;</span><span class="p">:</span> <span class="s2">&quot;%Y&quot;</span><span class="p">,</span>
+</span><span id="Teradata-12"><a href="#Teradata-12"><span class="linenos"> 12</span></a> <span class="s2">&quot;YYYY&quot;</span><span class="p">:</span> <span class="s2">&quot;%Y&quot;</span><span class="p">,</span>
+</span><span id="Teradata-13"><a href="#Teradata-13"><span class="linenos"> 13</span></a> <span class="s2">&quot;YY&quot;</span><span class="p">:</span> <span class="s2">&quot;%y&quot;</span><span class="p">,</span>
+</span><span id="Teradata-14"><a href="#Teradata-14"><span class="linenos"> 14</span></a> <span class="s2">&quot;MMMM&quot;</span><span class="p">:</span> <span class="s2">&quot;%B&quot;</span><span class="p">,</span>
+</span><span id="Teradata-15"><a href="#Teradata-15"><span class="linenos"> 15</span></a> <span class="s2">&quot;MMM&quot;</span><span class="p">:</span> <span class="s2">&quot;%b&quot;</span><span class="p">,</span>
+</span><span id="Teradata-16"><a href="#Teradata-16"><span class="linenos"> 16</span></a> <span class="s2">&quot;DD&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%d</span><span class="s2">&quot;</span><span class="p">,</span>
+</span><span id="Teradata-17"><a href="#Teradata-17"><span class="linenos"> 17</span></a> <span class="s2">&quot;D&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%-d</span><span class="s2">&quot;</span><span class="p">,</span>
+</span><span id="Teradata-18"><a href="#Teradata-18"><span class="linenos"> 18</span></a> <span class="s2">&quot;HH&quot;</span><span class="p">:</span> <span class="s2">&quot;%H&quot;</span><span class="p">,</span>
+</span><span id="Teradata-19"><a href="#Teradata-19"><span class="linenos"> 19</span></a> <span class="s2">&quot;H&quot;</span><span class="p">:</span> <span class="s2">&quot;%-H&quot;</span><span class="p">,</span>
+</span><span id="Teradata-20"><a href="#Teradata-20"><span class="linenos"> 20</span></a> <span class="s2">&quot;MM&quot;</span><span class="p">:</span> <span class="s2">&quot;%M&quot;</span><span class="p">,</span>
+</span><span id="Teradata-21"><a href="#Teradata-21"><span class="linenos"> 21</span></a> <span class="s2">&quot;M&quot;</span><span class="p">:</span> <span class="s2">&quot;%-M&quot;</span><span class="p">,</span>
+</span><span id="Teradata-22"><a href="#Teradata-22"><span class="linenos"> 22</span></a> <span class="s2">&quot;SS&quot;</span><span class="p">:</span> <span class="s2">&quot;%S&quot;</span><span class="p">,</span>
+</span><span id="Teradata-23"><a href="#Teradata-23"><span class="linenos"> 23</span></a> <span class="s2">&quot;S&quot;</span><span class="p">:</span> <span class="s2">&quot;%-S&quot;</span><span class="p">,</span>
+</span><span id="Teradata-24"><a href="#Teradata-24"><span class="linenos"> 24</span></a> <span class="s2">&quot;SSSSSS&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%f</span><span class="s2">&quot;</span><span class="p">,</span>
+</span><span id="Teradata-25"><a href="#Teradata-25"><span class="linenos"> 25</span></a> <span class="s2">&quot;E&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%a</span><span class="s2">&quot;</span><span class="p">,</span>
+</span><span id="Teradata-26"><a href="#Teradata-26"><span class="linenos"> 26</span></a> <span class="s2">&quot;EE&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%a</span><span class="s2">&quot;</span><span class="p">,</span>
+</span><span id="Teradata-27"><a href="#Teradata-27"><span class="linenos"> 27</span></a> <span class="s2">&quot;EEE&quot;</span><span class="p">:</span> <span class="s2">&quot;</span><span class="si">%a</span><span class="s2">&quot;</span><span class="p">,</span>
+</span><span id="Teradata-28"><a href="#Teradata-28"><span class="linenos"> 28</span></a> <span class="s2">&quot;EEEE&quot;</span><span class="p">:</span> <span class="s2">&quot;%A&quot;</span><span class="p">,</span>
+</span><span id="Teradata-29"><a href="#Teradata-29"><span class="linenos"> 29</span></a> <span class="p">}</span>
+</span><span id="Teradata-30"><a href="#Teradata-30"><span class="linenos"> 30</span></a>
+</span><span id="Teradata-31"><a href="#Teradata-31"><span class="linenos"> 31</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span>
+</span><span id="Teradata-32"><a href="#Teradata-32"><span class="linenos"> 32</span></a> <span class="c1"># https://docs.teradata.com/r/Teradata-Database-SQL-Functions-Operators-Expressions-and-Predicates/March-2017/Comparison-Operators-and-Functions/Comparison-Operators/ANSI-Compliance</span>
+</span><span id="Teradata-33"><a href="#Teradata-33"><span class="linenos"> 33</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata-34"><a href="#Teradata-34"><span class="linenos"> 34</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span>
+</span><span id="Teradata-35"><a href="#Teradata-35"><span class="linenos"> 35</span></a> <span class="s2">&quot;BYTEINT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span>
+</span><span id="Teradata-36"><a href="#Teradata-36"><span class="linenos"> 36</span></a> <span class="s2">&quot;SEL&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">,</span>
+</span><span id="Teradata-37"><a href="#Teradata-37"><span class="linenos"> 37</span></a> <span class="s2">&quot;INS&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INSERT</span><span class="p">,</span>
+</span><span id="Teradata-38"><a href="#Teradata-38"><span class="linenos"> 38</span></a> <span class="s2">&quot;MOD&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MOD</span><span class="p">,</span>
+</span><span id="Teradata-39"><a href="#Teradata-39"><span class="linenos"> 39</span></a> <span class="s2">&quot;LT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span>
+</span><span id="Teradata-40"><a href="#Teradata-40"><span class="linenos"> 40</span></a> <span class="s2">&quot;LE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LTE</span><span class="p">,</span>
+</span><span id="Teradata-41"><a href="#Teradata-41"><span class="linenos"> 41</span></a> <span class="s2">&quot;GT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span>
+</span><span id="Teradata-42"><a href="#Teradata-42"><span class="linenos"> 42</span></a> <span class="s2">&quot;GE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GTE</span><span class="p">,</span>
+</span><span id="Teradata-43"><a href="#Teradata-43"><span class="linenos"> 43</span></a> <span class="s2">&quot;^=&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
+</span><span id="Teradata-44"><a href="#Teradata-44"><span class="linenos"> 44</span></a> <span class="s2">&quot;NE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
+</span><span id="Teradata-45"><a href="#Teradata-45"><span class="linenos"> 45</span></a> <span class="s2">&quot;NOT=&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
+</span><span id="Teradata-46"><a href="#Teradata-46"><span class="linenos"> 46</span></a> <span class="s2">&quot;ST_GEOMETRY&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">,</span>
+</span><span id="Teradata-47"><a href="#Teradata-47"><span class="linenos"> 47</span></a> <span class="p">}</span>
+</span><span id="Teradata-48"><a href="#Teradata-48"><span class="linenos"> 48</span></a>
+</span><span id="Teradata-49"><a href="#Teradata-49"><span class="linenos"> 49</span></a> <span class="c1"># Teradata does not support % as a modulo operator</span>
+</span><span id="Teradata-50"><a href="#Teradata-50"><span class="linenos"> 50</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">}</span>
+</span><span id="Teradata-51"><a href="#Teradata-51"><span class="linenos"> 51</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;%&quot;</span><span class="p">)</span>
+</span><span id="Teradata-52"><a href="#Teradata-52"><span class="linenos"> 52</span></a>
+</span><span id="Teradata-53"><a href="#Teradata-53"><span class="linenos"> 53</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="Teradata-54"><a href="#Teradata-54"><span class="linenos"> 54</span></a> <span class="n">CHARSET_TRANSLATORS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata-55"><a href="#Teradata-55"><span class="linenos"> 55</span></a> <span class="s2">&quot;GRAPHIC_TO_KANJISJIS&quot;</span><span class="p">,</span>
+</span><span id="Teradata-56"><a href="#Teradata-56"><span class="linenos"> 56</span></a> <span class="s2">&quot;GRAPHIC_TO_LATIN&quot;</span><span class="p">,</span>
+</span><span id="Teradata-57"><a href="#Teradata-57"><span class="linenos"> 57</span></a> <span class="s2">&quot;GRAPHIC_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata-58"><a href="#Teradata-58"><span class="linenos"> 58</span></a> <span class="s2">&quot;GRAPHIC_TO_UNICODE_PadSpace&quot;</span><span class="p">,</span>
+</span><span id="Teradata-59"><a href="#Teradata-59"><span class="linenos"> 59</span></a> <span class="s2">&quot;KANJI1_KanjiEBCDIC_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata-60"><a href="#Teradata-60"><span class="linenos"> 60</span></a> <span class="s2">&quot;KANJI1_KanjiEUC_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata-61"><a href="#Teradata-61"><span class="linenos"> 61</span></a> <span class="s2">&quot;KANJI1_KANJISJIS_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata-62"><a href="#Teradata-62"><span class="linenos"> 62</span></a> <span class="s2">&quot;KANJI1_SBC_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata-63"><a href="#Teradata-63"><span class="linenos"> 63</span></a> <span class="s2">&quot;KANJISJIS_TO_GRAPHIC&quot;</span><span class="p">,</span>
+</span><span id="Teradata-64"><a href="#Teradata-64"><span class="linenos"> 64</span></a> <span class="s2">&quot;KANJISJIS_TO_LATIN&quot;</span><span class="p">,</span>
+</span><span id="Teradata-65"><a href="#Teradata-65"><span class="linenos"> 65</span></a> <span class="s2">&quot;KANJISJIS_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata-66"><a href="#Teradata-66"><span class="linenos"> 66</span></a> <span class="s2">&quot;LATIN_TO_GRAPHIC&quot;</span><span class="p">,</span>
+</span><span id="Teradata-67"><a href="#Teradata-67"><span class="linenos"> 67</span></a> <span class="s2">&quot;LATIN_TO_KANJISJIS&quot;</span><span class="p">,</span>
+</span><span id="Teradata-68"><a href="#Teradata-68"><span class="linenos"> 68</span></a> <span class="s2">&quot;LATIN_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata-69"><a href="#Teradata-69"><span class="linenos"> 69</span></a> <span class="s2">&quot;LOCALE_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata-70"><a href="#Teradata-70"><span class="linenos"> 70</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC&quot;</span><span class="p">,</span>
+</span><span id="Teradata-71"><a href="#Teradata-71"><span class="linenos"> 71</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC_PadGraphic&quot;</span><span class="p">,</span>
+</span><span id="Teradata-72"><a href="#Teradata-72"><span class="linenos"> 72</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC_VarGraphic&quot;</span><span class="p">,</span>
+</span><span id="Teradata-73"><a href="#Teradata-73"><span class="linenos"> 73</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KanjiEBCDIC&quot;</span><span class="p">,</span>
+</span><span id="Teradata-74"><a href="#Teradata-74"><span class="linenos"> 74</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KanjiEUC&quot;</span><span class="p">,</span>
+</span><span id="Teradata-75"><a href="#Teradata-75"><span class="linenos"> 75</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KANJISJIS&quot;</span><span class="p">,</span>
+</span><span id="Teradata-76"><a href="#Teradata-76"><span class="linenos"> 76</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_SBC&quot;</span><span class="p">,</span>
+</span><span id="Teradata-77"><a href="#Teradata-77"><span class="linenos"> 77</span></a> <span class="s2">&quot;UNICODE_TO_KANJISJIS&quot;</span><span class="p">,</span>
+</span><span id="Teradata-78"><a href="#Teradata-78"><span class="linenos"> 78</span></a> <span class="s2">&quot;UNICODE_TO_LATIN&quot;</span><span class="p">,</span>
+</span><span id="Teradata-79"><a href="#Teradata-79"><span class="linenos"> 79</span></a> <span class="s2">&quot;UNICODE_TO_LOCALE&quot;</span><span class="p">,</span>
+</span><span id="Teradata-80"><a href="#Teradata-80"><span class="linenos"> 80</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_FoldSpace&quot;</span><span class="p">,</span>
+</span><span id="Teradata-81"><a href="#Teradata-81"><span class="linenos"> 81</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_Fullwidth&quot;</span><span class="p">,</span>
+</span><span id="Teradata-82"><a href="#Teradata-82"><span class="linenos"> 82</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_Halfwidth&quot;</span><span class="p">,</span>
+</span><span id="Teradata-83"><a href="#Teradata-83"><span class="linenos"> 83</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFC&quot;</span><span class="p">,</span>
+</span><span id="Teradata-84"><a href="#Teradata-84"><span class="linenos"> 84</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFD&quot;</span><span class="p">,</span>
+</span><span id="Teradata-85"><a href="#Teradata-85"><span class="linenos"> 85</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFKC&quot;</span><span class="p">,</span>
+</span><span id="Teradata-86"><a href="#Teradata-86"><span class="linenos"> 86</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFKD&quot;</span><span class="p">,</span>
</span><span id="Teradata-87"><a href="#Teradata-87"><span class="linenos"> 87</span></a> <span class="p">}</span>
</span><span id="Teradata-88"><a href="#Teradata-88"><span class="linenos"> 88</span></a>
-</span><span id="Teradata-89"><a href="#Teradata-89"><span class="linenos"> 89</span></a> <span class="k">def</span> <span class="nf">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span>
-</span><span id="Teradata-90"><a href="#Teradata-90"><span class="linenos"> 90</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span>
+</span><span id="Teradata-89"><a href="#Teradata-89"><span class="linenos"> 89</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span><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">FUNC_TOKENS</span><span class="p">}</span>
+</span><span id="Teradata-90"><a href="#Teradata-90"><span class="linenos"> 90</span></a> <span class="n">FUNC_TOKENS</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">)</span>
</span><span id="Teradata-91"><a href="#Teradata-91"><span class="linenos"> 91</span></a>
-</span><span id="Teradata-92"><a href="#Teradata-92"><span class="linenos"> 92</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span>
-</span><span id="Teradata-93"><a href="#Teradata-93"><span class="linenos"> 93</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">&quot;Expected USING in TRANSLATE&quot;</span><span class="p">)</span>
-</span><span id="Teradata-94"><a href="#Teradata-94"><span class="linenos"> 94</span></a>
-</span><span id="Teradata-95"><a href="#Teradata-95"><span class="linenos"> 95</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CHARSET_TRANSLATORS</span><span class="p">):</span>
-</span><span id="Teradata-96"><a href="#Teradata-96"><span class="linenos"> 96</span></a> <span class="n">charset_split</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;_TO_&quot;</span><span class="p">)</span>
-</span><span id="Teradata-97"><a href="#Teradata-97"><span class="linenos"> 97</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">charset_split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
-</span><span id="Teradata-98"><a href="#Teradata-98"><span class="linenos"> 98</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Teradata-99"><a href="#Teradata-99"><span class="linenos"> 99</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">&quot;Expected a character set translator after USING in TRANSLATE&quot;</span><span class="p">)</span>
-</span><span id="Teradata-100"><a href="#Teradata-100"><span class="linenos">100</span></a>
-</span><span id="Teradata-101"><a href="#Teradata-101"><span class="linenos">101</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span>
+</span><span id="Teradata-92"><a href="#Teradata-92"><span class="linenos"> 92</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata-93"><a href="#Teradata-93"><span class="linenos"> 93</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">STATEMENT_PARSERS</span><span class="p">,</span>
+</span><span id="Teradata-94"><a href="#Teradata-94"><span class="linenos"> 94</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create</span><span class="p">(),</span>
+</span><span id="Teradata-95"><a href="#Teradata-95"><span class="linenos"> 95</span></a> <span class="p">}</span>
+</span><span id="Teradata-96"><a href="#Teradata-96"><span class="linenos"> 96</span></a>
+</span><span id="Teradata-97"><a href="#Teradata-97"><span class="linenos"> 97</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata-98"><a href="#Teradata-98"><span class="linenos"> 98</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">FUNCTION_PARSERS</span><span class="p">,</span>
+</span><span id="Teradata-99"><a href="#Teradata-99"><span class="linenos"> 99</span></a> <span class="s2">&quot;RANGE_N&quot;</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_rangen</span><span class="p">(),</span>
+</span><span id="Teradata-100"><a href="#Teradata-100"><span class="linenos">100</span></a> <span class="s2">&quot;TRANSLATE&quot;</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span>
+</span><span id="Teradata-101"><a href="#Teradata-101"><span class="linenos">101</span></a> <span class="p">}</span>
</span><span id="Teradata-102"><a href="#Teradata-102"><span class="linenos">102</span></a>
-</span><span id="Teradata-103"><a href="#Teradata-103"><span class="linenos">103</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span>
-</span><span id="Teradata-104"><a href="#Teradata-104"><span class="linenos">104</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span>
-</span><span id="Teradata-105"><a href="#Teradata-105"><span class="linenos">105</span></a> <span class="k">def</span> <span class="nf">_parse_update</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span>
-</span><span id="Teradata-106"><a href="#Teradata-106"><span class="linenos">106</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span>
-</span><span id="Teradata-107"><a href="#Teradata-107"><span class="linenos">107</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span>
-</span><span id="Teradata-108"><a href="#Teradata-108"><span class="linenos">108</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span>
-</span><span id="Teradata-109"><a href="#Teradata-109"><span class="linenos">109</span></a> <span class="s2">&quot;this&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">UPDATE_ALIAS_TOKENS</span><span class="p">),</span>
-</span><span id="Teradata-110"><a href="#Teradata-110"><span class="linenos">110</span></a> <span class="s2">&quot;from&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(</span><span class="n">modifiers</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span>
-</span><span id="Teradata-111"><a href="#Teradata-111"><span class="linenos">111</span></a> <span class="s2">&quot;expressions&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span>
-</span><span id="Teradata-112"><a href="#Teradata-112"><span class="linenos">112</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span>
-</span><span id="Teradata-113"><a href="#Teradata-113"><span class="linenos">113</span></a> <span class="s2">&quot;where&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span>
-</span><span id="Teradata-114"><a href="#Teradata-114"><span class="linenos">114</span></a> <span class="p">},</span>
-</span><span id="Teradata-115"><a href="#Teradata-115"><span class="linenos">115</span></a> <span class="p">)</span>
+</span><span id="Teradata-103"><a href="#Teradata-103"><span class="linenos">103</span></a> <span class="k">def</span> <span class="nf">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span>
+</span><span id="Teradata-104"><a href="#Teradata-104"><span class="linenos">104</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span>
+</span><span id="Teradata-105"><a href="#Teradata-105"><span class="linenos">105</span></a>
+</span><span id="Teradata-106"><a href="#Teradata-106"><span class="linenos">106</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span>
+</span><span id="Teradata-107"><a href="#Teradata-107"><span class="linenos">107</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">&quot;Expected USING in TRANSLATE&quot;</span><span class="p">)</span>
+</span><span id="Teradata-108"><a href="#Teradata-108"><span class="linenos">108</span></a>
+</span><span id="Teradata-109"><a href="#Teradata-109"><span class="linenos">109</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CHARSET_TRANSLATORS</span><span class="p">):</span>
+</span><span id="Teradata-110"><a href="#Teradata-110"><span class="linenos">110</span></a> <span class="n">charset_split</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;_TO_&quot;</span><span class="p">)</span>
+</span><span id="Teradata-111"><a href="#Teradata-111"><span class="linenos">111</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">charset_split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+</span><span id="Teradata-112"><a href="#Teradata-112"><span class="linenos">112</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Teradata-113"><a href="#Teradata-113"><span class="linenos">113</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">&quot;Expected a character set translator after USING in TRANSLATE&quot;</span><span class="p">)</span>
+</span><span id="Teradata-114"><a href="#Teradata-114"><span class="linenos">114</span></a>
+</span><span id="Teradata-115"><a href="#Teradata-115"><span class="linenos">115</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span>
</span><span id="Teradata-116"><a href="#Teradata-116"><span class="linenos">116</span></a>
-</span><span id="Teradata-117"><a href="#Teradata-117"><span class="linenos">117</span></a> <span class="k">def</span> <span class="nf">_parse_rangen</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
-</span><span id="Teradata-118"><a href="#Teradata-118"><span class="linenos">118</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span>
-</span><span id="Teradata-119"><a href="#Teradata-119"><span class="linenos">119</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)</span>
-</span><span id="Teradata-120"><a href="#Teradata-120"><span class="linenos">120</span></a>
-</span><span id="Teradata-121"><a href="#Teradata-121"><span class="linenos">121</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span>
-</span><span id="Teradata-122"><a href="#Teradata-122"><span class="linenos">122</span></a> <span class="n">each</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">&quot;EACH&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span>
-</span><span id="Teradata-123"><a href="#Teradata-123"><span class="linenos">123</span></a>
-</span><span id="Teradata-124"><a href="#Teradata-124"><span class="linenos">124</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RangeN</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">each</span><span class="o">=</span><span class="n">each</span><span class="p">)</span>
-</span><span id="Teradata-125"><a href="#Teradata-125"><span class="linenos">125</span></a>
-</span><span id="Teradata-126"><a href="#Teradata-126"><span class="linenos">126</span></a> <span class="k">def</span> <span class="nf">_parse_cast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span>
-</span><span id="Teradata-127"><a href="#Teradata-127"><span class="linenos">127</span></a> <span class="n">cast</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">,</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_cast</span><span class="p">(</span><span class="n">strict</span><span class="p">))</span>
-</span><span id="Teradata-128"><a href="#Teradata-128"><span class="linenos">128</span></a> <span class="k">if</span> <span class="n">cast</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">):</span>
-</span><span id="Teradata-129"><a href="#Teradata-129"><span class="linenos">129</span></a> <span class="k">return</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">&quot;teradata&quot;</span><span class="p">)(</span>
-</span><span id="Teradata-130"><a href="#Teradata-130"><span class="linenos">130</span></a> <span class="p">[</span><span class="n">cast</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()]</span>
-</span><span id="Teradata-131"><a href="#Teradata-131"><span class="linenos">131</span></a> <span class="p">)</span>
-</span><span id="Teradata-132"><a href="#Teradata-132"><span class="linenos">132</span></a> <span class="k">return</span> <span class="n">cast</span>
-</span><span id="Teradata-133"><a href="#Teradata-133"><span class="linenos">133</span></a>
-</span><span id="Teradata-134"><a href="#Teradata-134"><span class="linenos">134</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="Teradata-135"><a href="#Teradata-135"><span class="linenos">135</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span>
-</span><span id="Teradata-136"><a href="#Teradata-136"><span class="linenos">136</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span>
+</span><span id="Teradata-117"><a href="#Teradata-117"><span class="linenos">117</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span>
+</span><span id="Teradata-118"><a href="#Teradata-118"><span class="linenos">118</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span>
+</span><span id="Teradata-119"><a href="#Teradata-119"><span class="linenos">119</span></a> <span class="k">def</span> <span class="nf">_parse_update</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">:</span>
+</span><span id="Teradata-120"><a href="#Teradata-120"><span class="linenos">120</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span>
+</span><span id="Teradata-121"><a href="#Teradata-121"><span class="linenos">121</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span>
+</span><span id="Teradata-122"><a href="#Teradata-122"><span class="linenos">122</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span>
+</span><span id="Teradata-123"><a href="#Teradata-123"><span class="linenos">123</span></a> <span class="s2">&quot;this&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">UPDATE_ALIAS_TOKENS</span><span class="p">),</span>
+</span><span id="Teradata-124"><a href="#Teradata-124"><span class="linenos">124</span></a> <span class="s2">&quot;from&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(</span><span class="n">modifiers</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span>
+</span><span id="Teradata-125"><a href="#Teradata-125"><span class="linenos">125</span></a> <span class="s2">&quot;expressions&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span>
+</span><span id="Teradata-126"><a href="#Teradata-126"><span class="linenos">126</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span>
+</span><span id="Teradata-127"><a href="#Teradata-127"><span class="linenos">127</span></a> <span class="s2">&quot;where&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span>
+</span><span id="Teradata-128"><a href="#Teradata-128"><span class="linenos">128</span></a> <span class="p">},</span>
+</span><span id="Teradata-129"><a href="#Teradata-129"><span class="linenos">129</span></a> <span class="p">)</span>
+</span><span id="Teradata-130"><a href="#Teradata-130"><span class="linenos">130</span></a>
+</span><span id="Teradata-131"><a href="#Teradata-131"><span class="linenos">131</span></a> <span class="k">def</span> <span class="nf">_parse_rangen</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+</span><span id="Teradata-132"><a href="#Teradata-132"><span class="linenos">132</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span>
+</span><span id="Teradata-133"><a href="#Teradata-133"><span class="linenos">133</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)</span>
+</span><span id="Teradata-134"><a href="#Teradata-134"><span class="linenos">134</span></a>
+</span><span id="Teradata-135"><a href="#Teradata-135"><span class="linenos">135</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span>
+</span><span id="Teradata-136"><a href="#Teradata-136"><span class="linenos">136</span></a> <span class="n">each</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">&quot;EACH&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span>
</span><span id="Teradata-137"><a href="#Teradata-137"><span class="linenos">137</span></a>
-</span><span id="Teradata-138"><a href="#Teradata-138"><span class="linenos">138</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata-139"><a href="#Teradata-139"><span class="linenos">139</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">TYPE_MAPPING</span><span class="p">,</span>
-</span><span id="Teradata-140"><a href="#Teradata-140"><span class="linenos">140</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">:</span> <span class="s2">&quot;ST_GEOMETRY&quot;</span><span class="p">,</span>
-</span><span id="Teradata-141"><a href="#Teradata-141"><span class="linenos">141</span></a> <span class="p">}</span>
-</span><span id="Teradata-142"><a href="#Teradata-142"><span class="linenos">142</span></a>
-</span><span id="Teradata-143"><a href="#Teradata-143"><span class="linenos">143</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata-144"><a href="#Teradata-144"><span class="linenos">144</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="Teradata-145"><a href="#Teradata-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">OnCommitProperty</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">POST_INDEX</span><span class="p">,</span>
-</span><span id="Teradata-146"><a href="#Teradata-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</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">POST_EXPRESSION</span><span class="p">,</span>
-</span><span id="Teradata-147"><a href="#Teradata-147"><span class="linenos">147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StabilityProperty</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">POST_CREATE</span><span class="p">,</span>
-</span><span id="Teradata-148"><a href="#Teradata-148"><span class="linenos">148</span></a> <span class="p">}</span>
-</span><span id="Teradata-149"><a href="#Teradata-149"><span class="linenos">149</span></a>
-</span><span id="Teradata-150"><a href="#Teradata-150"><span class="linenos">150</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata-151"><a href="#Teradata-151"><span class="linenos">151</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="Teradata-152"><a href="#Teradata-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Max</span><span class="p">:</span> <span class="n">max_or_greatest</span><span class="p">,</span>
-</span><span id="Teradata-153"><a href="#Teradata-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Min</span><span class="p">:</span> <span class="n">min_or_least</span><span class="p">,</span>
-</span><span id="Teradata-154"><a href="#Teradata-154"><span class="linenos">154</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="Teradata-155"><a href="#Teradata-155"><span class="linenos">155</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">&quot;CAST(</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">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE FORMAT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)&quot;</span><span class="p">,</span>
-</span><span id="Teradata-156"><a href="#Teradata-156"><span class="linenos">156</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ToChar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">e</span><span class="p">),</span>
-</span><span id="Teradata-157"><a href="#Teradata-157"><span class="linenos">157</span></a> <span class="p">}</span>
-</span><span id="Teradata-158"><a href="#Teradata-158"><span class="linenos">158</span></a>
-</span><span id="Teradata-159"><a href="#Teradata-159"><span class="linenos">159</span></a> <span class="k">def</span> <span class="nf">partitionedbyproperty_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">PartitionedByProperty</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata-160"><a href="#Teradata-160"><span class="linenos">160</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;PARTITION BY </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">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span>
-</span><span id="Teradata-161"><a href="#Teradata-161"><span class="linenos">161</span></a>
-</span><span id="Teradata-162"><a href="#Teradata-162"><span class="linenos">162</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span>
-</span><span id="Teradata-163"><a href="#Teradata-163"><span class="linenos">163</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span>
-</span><span id="Teradata-164"><a href="#Teradata-164"><span class="linenos">164</span></a> <span class="k">def</span> <span class="nf">update_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">Update</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata-165"><a href="#Teradata-165"><span class="linenos">165</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">&quot;this&quot;</span><span class="p">)</span>
-</span><span id="Teradata-166"><a href="#Teradata-166"><span class="linenos">166</span></a> <span class="n">from_sql</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">&quot;from&quot;</span><span class="p">)</span>
-</span><span id="Teradata-167"><a href="#Teradata-167"><span class="linenos">167</span></a> <span class="n">set_sql</span> <span class="o">=</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="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
-</span><span id="Teradata-168"><a href="#Teradata-168"><span class="linenos">168</span></a> <span class="n">where_sql</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">&quot;where&quot;</span><span class="p">)</span>
-</span><span id="Teradata-169"><a href="#Teradata-169"><span class="linenos">169</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">&quot;</span>
-</span><span id="Teradata-170"><a href="#Teradata-170"><span class="linenos">170</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span>
-</span><span id="Teradata-171"><a href="#Teradata-171"><span class="linenos">171</span></a>
-</span><span id="Teradata-172"><a href="#Teradata-172"><span class="linenos">172</span></a> <span class="k">def</span> <span class="nf">mod_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">Mod</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata-173"><a href="#Teradata-173"><span class="linenos">173</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;MOD&quot;</span><span class="p">)</span>
-</span><span id="Teradata-174"><a href="#Teradata-174"><span class="linenos">174</span></a>
-</span><span id="Teradata-175"><a href="#Teradata-175"><span class="linenos">175</span></a> <span class="k">def</span> <span class="nf">datatype_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">DataType</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata-176"><a href="#Teradata-176"><span class="linenos">176</span></a> <span class="n">type_sql</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="Teradata-177"><a href="#Teradata-177"><span class="linenos">177</span></a> <span class="n">prefix_sql</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;prefix&quot;</span><span class="p">)</span>
-</span><span id="Teradata-178"><a href="#Teradata-178"><span class="linenos">178</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">prefix_sql</span> <span class="k">else</span> <span class="n">type_sql</span>
-</span><span id="Teradata-179"><a href="#Teradata-179"><span class="linenos">179</span></a>
-</span><span id="Teradata-180"><a href="#Teradata-180"><span class="linenos">180</span></a> <span class="k">def</span> <span class="nf">rangen_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">RangeN</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata-181"><a href="#Teradata-181"><span class="linenos">181</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">&quot;this&quot;</span><span class="p">)</span>
-</span><span id="Teradata-182"><a href="#Teradata-182"><span class="linenos">182</span></a> <span class="n">expressions_sql</span> <span class="o">=</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><span id="Teradata-183"><a href="#Teradata-183"><span class="linenos">183</span></a> <span class="n">each_sql</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">&quot;each&quot;</span><span class="p">)</span>
-</span><span id="Teradata-184"><a href="#Teradata-184"><span class="linenos">184</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
+</span><span id="Teradata-138"><a href="#Teradata-138"><span class="linenos">138</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RangeN</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">each</span><span class="o">=</span><span class="n">each</span><span class="p">)</span>
+</span><span id="Teradata-139"><a href="#Teradata-139"><span class="linenos">139</span></a>
+</span><span id="Teradata-140"><a href="#Teradata-140"><span class="linenos">140</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="Teradata-141"><a href="#Teradata-141"><span class="linenos">141</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span>
+</span><span id="Teradata-142"><a href="#Teradata-142"><span class="linenos">142</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span>
+</span><span id="Teradata-143"><a href="#Teradata-143"><span class="linenos">143</span></a>
+</span><span id="Teradata-144"><a href="#Teradata-144"><span class="linenos">144</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata-145"><a href="#Teradata-145"><span class="linenos">145</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">TYPE_MAPPING</span><span class="p">,</span>
+</span><span id="Teradata-146"><a href="#Teradata-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">:</span> <span class="s2">&quot;ST_GEOMETRY&quot;</span><span class="p">,</span>
+</span><span id="Teradata-147"><a href="#Teradata-147"><span class="linenos">147</span></a> <span class="p">}</span>
+</span><span id="Teradata-148"><a href="#Teradata-148"><span class="linenos">148</span></a>
+</span><span id="Teradata-149"><a href="#Teradata-149"><span class="linenos">149</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata-150"><a href="#Teradata-150"><span class="linenos">150</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="Teradata-151"><a href="#Teradata-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">OnCommitProperty</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">POST_INDEX</span><span class="p">,</span>
+</span><span id="Teradata-152"><a href="#Teradata-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</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">POST_EXPRESSION</span><span class="p">,</span>
+</span><span id="Teradata-153"><a href="#Teradata-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StabilityProperty</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">POST_CREATE</span><span class="p">,</span>
+</span><span id="Teradata-154"><a href="#Teradata-154"><span class="linenos">154</span></a> <span class="p">}</span>
+</span><span id="Teradata-155"><a href="#Teradata-155"><span class="linenos">155</span></a>
+</span><span id="Teradata-156"><a href="#Teradata-156"><span class="linenos">156</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata-157"><a href="#Teradata-157"><span class="linenos">157</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="Teradata-158"><a href="#Teradata-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Max</span><span class="p">:</span> <span class="n">max_or_greatest</span><span class="p">,</span>
+</span><span id="Teradata-159"><a href="#Teradata-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Min</span><span class="p">:</span> <span class="n">min_or_least</span><span class="p">,</span>
+</span><span id="Teradata-160"><a href="#Teradata-160"><span class="linenos">160</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="Teradata-161"><a href="#Teradata-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">&quot;CAST(</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">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE FORMAT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)&quot;</span><span class="p">,</span>
+</span><span id="Teradata-162"><a href="#Teradata-162"><span class="linenos">162</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ToChar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">e</span><span class="p">),</span>
+</span><span id="Teradata-163"><a href="#Teradata-163"><span class="linenos">163</span></a> <span class="p">}</span>
+</span><span id="Teradata-164"><a href="#Teradata-164"><span class="linenos">164</span></a>
+</span><span id="Teradata-165"><a href="#Teradata-165"><span class="linenos">165</span></a> <span class="k">def</span> <span class="nf">partitionedbyproperty_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">PartitionedByProperty</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata-166"><a href="#Teradata-166"><span class="linenos">166</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;PARTITION BY </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">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="Teradata-167"><a href="#Teradata-167"><span class="linenos">167</span></a>
+</span><span id="Teradata-168"><a href="#Teradata-168"><span class="linenos">168</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span>
+</span><span id="Teradata-169"><a href="#Teradata-169"><span class="linenos">169</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span>
+</span><span id="Teradata-170"><a href="#Teradata-170"><span class="linenos">170</span></a> <span class="k">def</span> <span class="nf">update_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">Update</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata-171"><a href="#Teradata-171"><span class="linenos">171</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">&quot;this&quot;</span><span class="p">)</span>
+</span><span id="Teradata-172"><a href="#Teradata-172"><span class="linenos">172</span></a> <span class="n">from_sql</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">&quot;from&quot;</span><span class="p">)</span>
+</span><span id="Teradata-173"><a href="#Teradata-173"><span class="linenos">173</span></a> <span class="n">set_sql</span> <span class="o">=</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="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
+</span><span id="Teradata-174"><a href="#Teradata-174"><span class="linenos">174</span></a> <span class="n">where_sql</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">&quot;where&quot;</span><span class="p">)</span>
+</span><span id="Teradata-175"><a href="#Teradata-175"><span class="linenos">175</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="Teradata-176"><a href="#Teradata-176"><span class="linenos">176</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span>
+</span><span id="Teradata-177"><a href="#Teradata-177"><span class="linenos">177</span></a>
+</span><span id="Teradata-178"><a href="#Teradata-178"><span class="linenos">178</span></a> <span class="k">def</span> <span class="nf">mod_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">Mod</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata-179"><a href="#Teradata-179"><span class="linenos">179</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;MOD&quot;</span><span class="p">)</span>
+</span><span id="Teradata-180"><a href="#Teradata-180"><span class="linenos">180</span></a>
+</span><span id="Teradata-181"><a href="#Teradata-181"><span class="linenos">181</span></a> <span class="k">def</span> <span class="nf">datatype_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">DataType</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata-182"><a href="#Teradata-182"><span class="linenos">182</span></a> <span class="n">type_sql</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="Teradata-183"><a href="#Teradata-183"><span class="linenos">183</span></a> <span class="n">prefix_sql</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;prefix&quot;</span><span class="p">)</span>
+</span><span id="Teradata-184"><a href="#Teradata-184"><span class="linenos">184</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">prefix_sql</span> <span class="k">else</span> <span class="n">type_sql</span>
</span><span id="Teradata-185"><a href="#Teradata-185"><span class="linenos">185</span></a>
-</span><span id="Teradata-186"><a href="#Teradata-186"><span class="linenos">186</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;RANGE_N(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">)&quot;</span>
+</span><span id="Teradata-186"><a href="#Teradata-186"><span class="linenos">186</span></a> <span class="k">def</span> <span class="nf">rangen_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">RangeN</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata-187"><a href="#Teradata-187"><span class="linenos">187</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">&quot;this&quot;</span><span class="p">)</span>
+</span><span id="Teradata-188"><a href="#Teradata-188"><span class="linenos">188</span></a> <span class="n">expressions_sql</span> <span class="o">=</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><span id="Teradata-189"><a href="#Teradata-189"><span class="linenos">189</span></a> <span class="n">each_sql</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">&quot;each&quot;</span><span class="p">)</span>
+</span><span id="Teradata-190"><a href="#Teradata-190"><span class="linenos">190</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
+</span><span id="Teradata-191"><a href="#Teradata-191"><span class="linenos">191</span></a>
+</span><span id="Teradata-192"><a href="#Teradata-192"><span class="linenos">192</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;RANGE_N(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">)&quot;</span>
+</span><span id="Teradata-193"><a href="#Teradata-193"><span class="linenos">193</span></a>
+</span><span id="Teradata-194"><a href="#Teradata-194"><span class="linenos">194</span></a> <span class="k">def</span> <span class="nf">createable_sql</span><span class="p">(</span>
+</span><span id="Teradata-195"><a href="#Teradata-195"><span class="linenos">195</span></a> <span class="bp">self</span><span class="p">,</span>
+</span><span id="Teradata-196"><a href="#Teradata-196"><span class="linenos">196</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">,</span>
+</span><span id="Teradata-197"><a href="#Teradata-197"><span class="linenos">197</span></a> <span class="n">locations</span><span class="p">:</span> <span class="nb">dict</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="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">]],</span>
+</span><span id="Teradata-198"><a href="#Teradata-198"><span class="linenos">198</span></a> <span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata-199"><a href="#Teradata-199"><span class="linenos">199</span></a> <span class="n">kind</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">&quot;kind&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span>
+</span><span id="Teradata-200"><a href="#Teradata-200"><span class="linenos">200</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">&quot;TABLE&quot;</span> <span class="ow">and</span> <span class="n">locations</span><span class="o">.</span><span class="n">get</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">POST_NAME</span><span class="p">):</span>
+</span><span id="Teradata-201"><a href="#Teradata-201"><span class="linenos">201</span></a> <span class="n">this_name</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="o">.</span><span class="n">this</span><span class="p">,</span> <span class="s2">&quot;this&quot;</span><span class="p">)</span>
+</span><span id="Teradata-202"><a href="#Teradata-202"><span class="linenos">202</span></a> <span class="n">this_properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span>
+</span><span id="Teradata-203"><a href="#Teradata-203"><span class="linenos">203</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">locations</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">POST_NAME</span><span class="p">]),</span>
+</span><span id="Teradata-204"><a href="#Teradata-204"><span class="linenos">204</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
+</span><span id="Teradata-205"><a href="#Teradata-205"><span class="linenos">205</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">&quot;,&quot;</span><span class="p">,</span>
+</span><span id="Teradata-206"><a href="#Teradata-206"><span class="linenos">206</span></a> <span class="p">)</span>
+</span><span id="Teradata-207"><a href="#Teradata-207"><span class="linenos">207</span></a> <span class="n">this_schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">schema_columns_sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span>
+</span><span id="Teradata-208"><a href="#Teradata-208"><span class="linenos">208</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">this_name</span><span class="si">}{</span><span class="n">this_properties</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this_schema</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="Teradata-209"><a href="#Teradata-209"><span class="linenos">209</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">createable_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">locations</span><span class="p">)</span>
</span></pre></div>
@@ -497,27 +553,27 @@
</div>
<a class="headerlink" href="#Teradata.Tokenizer"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Tokenizer-17"><a href="#Teradata.Tokenizer-17"><span class="linenos">17</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span>
-</span><span id="Teradata.Tokenizer-18"><a href="#Teradata.Tokenizer-18"><span class="linenos">18</span></a> <span class="c1"># https://docs.teradata.com/r/Teradata-Database-SQL-Functions-Operators-Expressions-and-Predicates/March-2017/Comparison-Operators-and-Functions/Comparison-Operators/ANSI-Compliance</span>
-</span><span id="Teradata.Tokenizer-19"><a href="#Teradata.Tokenizer-19"><span class="linenos">19</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata.Tokenizer-20"><a href="#Teradata.Tokenizer-20"><span class="linenos">20</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-21"><a href="#Teradata.Tokenizer-21"><span class="linenos">21</span></a> <span class="s2">&quot;BYTEINT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-22"><a href="#Teradata.Tokenizer-22"><span class="linenos">22</span></a> <span class="s2">&quot;SEL&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-23"><a href="#Teradata.Tokenizer-23"><span class="linenos">23</span></a> <span class="s2">&quot;INS&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INSERT</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-24"><a href="#Teradata.Tokenizer-24"><span class="linenos">24</span></a> <span class="s2">&quot;MOD&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MOD</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-25"><a href="#Teradata.Tokenizer-25"><span class="linenos">25</span></a> <span class="s2">&quot;LT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-26"><a href="#Teradata.Tokenizer-26"><span class="linenos">26</span></a> <span class="s2">&quot;LE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LTE</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-27"><a href="#Teradata.Tokenizer-27"><span class="linenos">27</span></a> <span class="s2">&quot;GT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-28"><a href="#Teradata.Tokenizer-28"><span class="linenos">28</span></a> <span class="s2">&quot;GE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GTE</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-29"><a href="#Teradata.Tokenizer-29"><span class="linenos">29</span></a> <span class="s2">&quot;^=&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-30"><a href="#Teradata.Tokenizer-30"><span class="linenos">30</span></a> <span class="s2">&quot;NE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-31"><a href="#Teradata.Tokenizer-31"><span class="linenos">31</span></a> <span class="s2">&quot;NOT=&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-32"><a href="#Teradata.Tokenizer-32"><span class="linenos">32</span></a> <span class="s2">&quot;ST_GEOMETRY&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">,</span>
-</span><span id="Teradata.Tokenizer-33"><a href="#Teradata.Tokenizer-33"><span class="linenos">33</span></a> <span class="p">}</span>
-</span><span id="Teradata.Tokenizer-34"><a href="#Teradata.Tokenizer-34"><span class="linenos">34</span></a>
-</span><span id="Teradata.Tokenizer-35"><a href="#Teradata.Tokenizer-35"><span class="linenos">35</span></a> <span class="c1"># teradata does not support % for modulus</span>
-</span><span id="Teradata.Tokenizer-36"><a href="#Teradata.Tokenizer-36"><span class="linenos">36</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">}</span>
-</span><span id="Teradata.Tokenizer-37"><a href="#Teradata.Tokenizer-37"><span class="linenos">37</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;%&quot;</span><span class="p">)</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Tokenizer-31"><a href="#Teradata.Tokenizer-31"><span class="linenos">31</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span>
+</span><span id="Teradata.Tokenizer-32"><a href="#Teradata.Tokenizer-32"><span class="linenos">32</span></a> <span class="c1"># https://docs.teradata.com/r/Teradata-Database-SQL-Functions-Operators-Expressions-and-Predicates/March-2017/Comparison-Operators-and-Functions/Comparison-Operators/ANSI-Compliance</span>
+</span><span id="Teradata.Tokenizer-33"><a href="#Teradata.Tokenizer-33"><span class="linenos">33</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata.Tokenizer-34"><a href="#Teradata.Tokenizer-34"><span class="linenos">34</span></a> <span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">KEYWORDS</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-35"><a href="#Teradata.Tokenizer-35"><span class="linenos">35</span></a> <span class="s2">&quot;BYTEINT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SMALLINT</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-36"><a href="#Teradata.Tokenizer-36"><span class="linenos">36</span></a> <span class="s2">&quot;SEL&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SELECT</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-37"><a href="#Teradata.Tokenizer-37"><span class="linenos">37</span></a> <span class="s2">&quot;INS&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">INSERT</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-38"><a href="#Teradata.Tokenizer-38"><span class="linenos">38</span></a> <span class="s2">&quot;MOD&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">MOD</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-39"><a href="#Teradata.Tokenizer-39"><span class="linenos">39</span></a> <span class="s2">&quot;LT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LT</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-40"><a href="#Teradata.Tokenizer-40"><span class="linenos">40</span></a> <span class="s2">&quot;LE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">LTE</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-41"><a href="#Teradata.Tokenizer-41"><span class="linenos">41</span></a> <span class="s2">&quot;GT&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GT</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-42"><a href="#Teradata.Tokenizer-42"><span class="linenos">42</span></a> <span class="s2">&quot;GE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GTE</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-43"><a href="#Teradata.Tokenizer-43"><span class="linenos">43</span></a> <span class="s2">&quot;^=&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-44"><a href="#Teradata.Tokenizer-44"><span class="linenos">44</span></a> <span class="s2">&quot;NE&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-45"><a href="#Teradata.Tokenizer-45"><span class="linenos">45</span></a> <span class="s2">&quot;NOT=&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">NEQ</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-46"><a href="#Teradata.Tokenizer-46"><span class="linenos">46</span></a> <span class="s2">&quot;ST_GEOMETRY&quot;</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">,</span>
+</span><span id="Teradata.Tokenizer-47"><a href="#Teradata.Tokenizer-47"><span class="linenos">47</span></a> <span class="p">}</span>
+</span><span id="Teradata.Tokenizer-48"><a href="#Teradata.Tokenizer-48"><span class="linenos">48</span></a>
+</span><span id="Teradata.Tokenizer-49"><a href="#Teradata.Tokenizer-49"><span class="linenos">49</span></a> <span class="c1"># Teradata does not support % as a modulo operator</span>
+</span><span id="Teradata.Tokenizer-50"><a href="#Teradata.Tokenizer-50"><span class="linenos">50</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="p">{</span><span class="o">**</span><span class="n">tokens</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="p">}</span>
+</span><span id="Teradata.Tokenizer-51"><a href="#Teradata.Tokenizer-51"><span class="linenos">51</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;%&quot;</span><span class="p">)</span>
</span></pre></div>
@@ -529,6 +585,7 @@
<div><dt><a href="../tokens.html#Tokenizer">sqlglot.tokens.Tokenizer</a></dt>
<dd id="Teradata.Tokenizer.reset" class="function"><a href="../tokens.html#Tokenizer.reset">reset</a></dd>
<dd id="Teradata.Tokenizer.tokenize" class="function"><a href="../tokens.html#Tokenizer.tokenize">tokenize</a></dd>
+ <dd id="Teradata.Tokenizer.peek" class="function"><a href="../tokens.html#Tokenizer.peek">peek</a></dd>
</div>
</dl>
@@ -545,124 +602,108 @@
</div>
<a class="headerlink" href="#Teradata.Parser"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Parser-39"><a href="#Teradata.Parser-39"><span class="linenos"> 39</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="Teradata.Parser-40"><a href="#Teradata.Parser-40"><span class="linenos"> 40</span></a> <span class="n">CHARSET_TRANSLATORS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata.Parser-41"><a href="#Teradata.Parser-41"><span class="linenos"> 41</span></a> <span class="s2">&quot;GRAPHIC_TO_KANJISJIS&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-42"><a href="#Teradata.Parser-42"><span class="linenos"> 42</span></a> <span class="s2">&quot;GRAPHIC_TO_LATIN&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-43"><a href="#Teradata.Parser-43"><span class="linenos"> 43</span></a> <span class="s2">&quot;GRAPHIC_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-44"><a href="#Teradata.Parser-44"><span class="linenos"> 44</span></a> <span class="s2">&quot;GRAPHIC_TO_UNICODE_PadSpace&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-45"><a href="#Teradata.Parser-45"><span class="linenos"> 45</span></a> <span class="s2">&quot;KANJI1_KanjiEBCDIC_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-46"><a href="#Teradata.Parser-46"><span class="linenos"> 46</span></a> <span class="s2">&quot;KANJI1_KanjiEUC_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-47"><a href="#Teradata.Parser-47"><span class="linenos"> 47</span></a> <span class="s2">&quot;KANJI1_KANJISJIS_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-48"><a href="#Teradata.Parser-48"><span class="linenos"> 48</span></a> <span class="s2">&quot;KANJI1_SBC_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-49"><a href="#Teradata.Parser-49"><span class="linenos"> 49</span></a> <span class="s2">&quot;KANJISJIS_TO_GRAPHIC&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-50"><a href="#Teradata.Parser-50"><span class="linenos"> 50</span></a> <span class="s2">&quot;KANJISJIS_TO_LATIN&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-51"><a href="#Teradata.Parser-51"><span class="linenos"> 51</span></a> <span class="s2">&quot;KANJISJIS_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-52"><a href="#Teradata.Parser-52"><span class="linenos"> 52</span></a> <span class="s2">&quot;LATIN_TO_GRAPHIC&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-53"><a href="#Teradata.Parser-53"><span class="linenos"> 53</span></a> <span class="s2">&quot;LATIN_TO_KANJISJIS&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-54"><a href="#Teradata.Parser-54"><span class="linenos"> 54</span></a> <span class="s2">&quot;LATIN_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-55"><a href="#Teradata.Parser-55"><span class="linenos"> 55</span></a> <span class="s2">&quot;LOCALE_TO_UNICODE&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-56"><a href="#Teradata.Parser-56"><span class="linenos"> 56</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-57"><a href="#Teradata.Parser-57"><span class="linenos"> 57</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC_PadGraphic&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-58"><a href="#Teradata.Parser-58"><span class="linenos"> 58</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC_VarGraphic&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-59"><a href="#Teradata.Parser-59"><span class="linenos"> 59</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KanjiEBCDIC&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-60"><a href="#Teradata.Parser-60"><span class="linenos"> 60</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KanjiEUC&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-61"><a href="#Teradata.Parser-61"><span class="linenos"> 61</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KANJISJIS&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-62"><a href="#Teradata.Parser-62"><span class="linenos"> 62</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_SBC&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-63"><a href="#Teradata.Parser-63"><span class="linenos"> 63</span></a> <span class="s2">&quot;UNICODE_TO_KANJISJIS&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-64"><a href="#Teradata.Parser-64"><span class="linenos"> 64</span></a> <span class="s2">&quot;UNICODE_TO_LATIN&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-65"><a href="#Teradata.Parser-65"><span class="linenos"> 65</span></a> <span class="s2">&quot;UNICODE_TO_LOCALE&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-66"><a href="#Teradata.Parser-66"><span class="linenos"> 66</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_FoldSpace&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-67"><a href="#Teradata.Parser-67"><span class="linenos"> 67</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_Fullwidth&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-68"><a href="#Teradata.Parser-68"><span class="linenos"> 68</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_Halfwidth&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-69"><a href="#Teradata.Parser-69"><span class="linenos"> 69</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFC&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-70"><a href="#Teradata.Parser-70"><span class="linenos"> 70</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFD&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-71"><a href="#Teradata.Parser-71"><span class="linenos"> 71</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFKC&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-72"><a href="#Teradata.Parser-72"><span class="linenos"> 72</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFKD&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Parser-73"><a href="#Teradata.Parser-73"><span class="linenos"> 73</span></a> <span class="p">}</span>
-</span><span id="Teradata.Parser-74"><a href="#Teradata.Parser-74"><span class="linenos"> 74</span></a>
-</span><span id="Teradata.Parser-75"><a href="#Teradata.Parser-75"><span class="linenos"> 75</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span><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">FUNC_TOKENS</span><span class="p">}</span>
-</span><span id="Teradata.Parser-76"><a href="#Teradata.Parser-76"><span class="linenos"> 76</span></a> <span class="n">FUNC_TOKENS</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">)</span>
-</span><span id="Teradata.Parser-77"><a href="#Teradata.Parser-77"><span class="linenos"> 77</span></a>
-</span><span id="Teradata.Parser-78"><a href="#Teradata.Parser-78"><span class="linenos"> 78</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata.Parser-79"><a href="#Teradata.Parser-79"><span class="linenos"> 79</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">STATEMENT_PARSERS</span><span class="p">,</span>
-</span><span id="Teradata.Parser-80"><a href="#Teradata.Parser-80"><span class="linenos"> 80</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create</span><span class="p">(),</span>
-</span><span id="Teradata.Parser-81"><a href="#Teradata.Parser-81"><span class="linenos"> 81</span></a> <span class="p">}</span>
-</span><span id="Teradata.Parser-82"><a href="#Teradata.Parser-82"><span class="linenos"> 82</span></a>
-</span><span id="Teradata.Parser-83"><a href="#Teradata.Parser-83"><span class="linenos"> 83</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata.Parser-84"><a href="#Teradata.Parser-84"><span class="linenos"> 84</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">FUNCTION_PARSERS</span><span class="p">,</span>
-</span><span id="Teradata.Parser-85"><a href="#Teradata.Parser-85"><span class="linenos"> 85</span></a> <span class="s2">&quot;RANGE_N&quot;</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_rangen</span><span class="p">(),</span>
-</span><span id="Teradata.Parser-86"><a href="#Teradata.Parser-86"><span class="linenos"> 86</span></a> <span class="s2">&quot;TRANSLATE&quot;</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Parser-53"><a href="#Teradata.Parser-53"><span class="linenos"> 53</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="Teradata.Parser-54"><a href="#Teradata.Parser-54"><span class="linenos"> 54</span></a> <span class="n">CHARSET_TRANSLATORS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata.Parser-55"><a href="#Teradata.Parser-55"><span class="linenos"> 55</span></a> <span class="s2">&quot;GRAPHIC_TO_KANJISJIS&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-56"><a href="#Teradata.Parser-56"><span class="linenos"> 56</span></a> <span class="s2">&quot;GRAPHIC_TO_LATIN&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-57"><a href="#Teradata.Parser-57"><span class="linenos"> 57</span></a> <span class="s2">&quot;GRAPHIC_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-58"><a href="#Teradata.Parser-58"><span class="linenos"> 58</span></a> <span class="s2">&quot;GRAPHIC_TO_UNICODE_PadSpace&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-59"><a href="#Teradata.Parser-59"><span class="linenos"> 59</span></a> <span class="s2">&quot;KANJI1_KanjiEBCDIC_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-60"><a href="#Teradata.Parser-60"><span class="linenos"> 60</span></a> <span class="s2">&quot;KANJI1_KanjiEUC_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-61"><a href="#Teradata.Parser-61"><span class="linenos"> 61</span></a> <span class="s2">&quot;KANJI1_KANJISJIS_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-62"><a href="#Teradata.Parser-62"><span class="linenos"> 62</span></a> <span class="s2">&quot;KANJI1_SBC_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-63"><a href="#Teradata.Parser-63"><span class="linenos"> 63</span></a> <span class="s2">&quot;KANJISJIS_TO_GRAPHIC&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-64"><a href="#Teradata.Parser-64"><span class="linenos"> 64</span></a> <span class="s2">&quot;KANJISJIS_TO_LATIN&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-65"><a href="#Teradata.Parser-65"><span class="linenos"> 65</span></a> <span class="s2">&quot;KANJISJIS_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-66"><a href="#Teradata.Parser-66"><span class="linenos"> 66</span></a> <span class="s2">&quot;LATIN_TO_GRAPHIC&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-67"><a href="#Teradata.Parser-67"><span class="linenos"> 67</span></a> <span class="s2">&quot;LATIN_TO_KANJISJIS&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-68"><a href="#Teradata.Parser-68"><span class="linenos"> 68</span></a> <span class="s2">&quot;LATIN_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-69"><a href="#Teradata.Parser-69"><span class="linenos"> 69</span></a> <span class="s2">&quot;LOCALE_TO_UNICODE&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-70"><a href="#Teradata.Parser-70"><span class="linenos"> 70</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-71"><a href="#Teradata.Parser-71"><span class="linenos"> 71</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC_PadGraphic&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-72"><a href="#Teradata.Parser-72"><span class="linenos"> 72</span></a> <span class="s2">&quot;UNICODE_TO_GRAPHIC_VarGraphic&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-73"><a href="#Teradata.Parser-73"><span class="linenos"> 73</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KanjiEBCDIC&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-74"><a href="#Teradata.Parser-74"><span class="linenos"> 74</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KanjiEUC&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-75"><a href="#Teradata.Parser-75"><span class="linenos"> 75</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_KANJISJIS&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-76"><a href="#Teradata.Parser-76"><span class="linenos"> 76</span></a> <span class="s2">&quot;UNICODE_TO_KANJI1_SBC&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-77"><a href="#Teradata.Parser-77"><span class="linenos"> 77</span></a> <span class="s2">&quot;UNICODE_TO_KANJISJIS&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-78"><a href="#Teradata.Parser-78"><span class="linenos"> 78</span></a> <span class="s2">&quot;UNICODE_TO_LATIN&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-79"><a href="#Teradata.Parser-79"><span class="linenos"> 79</span></a> <span class="s2">&quot;UNICODE_TO_LOCALE&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-80"><a href="#Teradata.Parser-80"><span class="linenos"> 80</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_FoldSpace&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-81"><a href="#Teradata.Parser-81"><span class="linenos"> 81</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_Fullwidth&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-82"><a href="#Teradata.Parser-82"><span class="linenos"> 82</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_Halfwidth&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-83"><a href="#Teradata.Parser-83"><span class="linenos"> 83</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFC&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-84"><a href="#Teradata.Parser-84"><span class="linenos"> 84</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFD&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-85"><a href="#Teradata.Parser-85"><span class="linenos"> 85</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFKC&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Parser-86"><a href="#Teradata.Parser-86"><span class="linenos"> 86</span></a> <span class="s2">&quot;UNICODE_TO_UNICODE_NFKD&quot;</span><span class="p">,</span>
</span><span id="Teradata.Parser-87"><a href="#Teradata.Parser-87"><span class="linenos"> 87</span></a> <span class="p">}</span>
</span><span id="Teradata.Parser-88"><a href="#Teradata.Parser-88"><span class="linenos"> 88</span></a>
-</span><span id="Teradata.Parser-89"><a href="#Teradata.Parser-89"><span class="linenos"> 89</span></a> <span class="k">def</span> <span class="nf">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span>
-</span><span id="Teradata.Parser-90"><a href="#Teradata.Parser-90"><span class="linenos"> 90</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span>
+</span><span id="Teradata.Parser-89"><a href="#Teradata.Parser-89"><span class="linenos"> 89</span></a> <span class="n">FUNC_TOKENS</span> <span class="o">=</span> <span class="p">{</span><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">FUNC_TOKENS</span><span class="p">}</span>
+</span><span id="Teradata.Parser-90"><a href="#Teradata.Parser-90"><span class="linenos"> 90</span></a> <span class="n">FUNC_TOKENS</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">)</span>
</span><span id="Teradata.Parser-91"><a href="#Teradata.Parser-91"><span class="linenos"> 91</span></a>
-</span><span id="Teradata.Parser-92"><a href="#Teradata.Parser-92"><span class="linenos"> 92</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span>
-</span><span id="Teradata.Parser-93"><a href="#Teradata.Parser-93"><span class="linenos"> 93</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">&quot;Expected USING in TRANSLATE&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Parser-94"><a href="#Teradata.Parser-94"><span class="linenos"> 94</span></a>
-</span><span id="Teradata.Parser-95"><a href="#Teradata.Parser-95"><span class="linenos"> 95</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CHARSET_TRANSLATORS</span><span class="p">):</span>
-</span><span id="Teradata.Parser-96"><a href="#Teradata.Parser-96"><span class="linenos"> 96</span></a> <span class="n">charset_split</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;_TO_&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Parser-97"><a href="#Teradata.Parser-97"><span class="linenos"> 97</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">charset_split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
-</span><span id="Teradata.Parser-98"><a href="#Teradata.Parser-98"><span class="linenos"> 98</span></a> <span class="k">else</span><span class="p">:</span>
-</span><span id="Teradata.Parser-99"><a href="#Teradata.Parser-99"><span class="linenos"> 99</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">&quot;Expected a character set translator after USING in TRANSLATE&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Parser-100"><a href="#Teradata.Parser-100"><span class="linenos">100</span></a>
-</span><span id="Teradata.Parser-101"><a href="#Teradata.Parser-101"><span class="linenos">101</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span>
+</span><span id="Teradata.Parser-92"><a href="#Teradata.Parser-92"><span class="linenos"> 92</span></a> <span class="n">STATEMENT_PARSERS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata.Parser-93"><a href="#Teradata.Parser-93"><span class="linenos"> 93</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">STATEMENT_PARSERS</span><span class="p">,</span>
+</span><span id="Teradata.Parser-94"><a href="#Teradata.Parser-94"><span class="linenos"> 94</span></a> <span class="n">TokenType</span><span class="o">.</span><span class="n">REPLACE</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_create</span><span class="p">(),</span>
+</span><span id="Teradata.Parser-95"><a href="#Teradata.Parser-95"><span class="linenos"> 95</span></a> <span class="p">}</span>
+</span><span id="Teradata.Parser-96"><a href="#Teradata.Parser-96"><span class="linenos"> 96</span></a>
+</span><span id="Teradata.Parser-97"><a href="#Teradata.Parser-97"><span class="linenos"> 97</span></a> <span class="n">FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata.Parser-98"><a href="#Teradata.Parser-98"><span class="linenos"> 98</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">FUNCTION_PARSERS</span><span class="p">,</span>
+</span><span id="Teradata.Parser-99"><a href="#Teradata.Parser-99"><span class="linenos"> 99</span></a> <span class="s2">&quot;RANGE_N&quot;</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_rangen</span><span class="p">(),</span>
+</span><span id="Teradata.Parser-100"><a href="#Teradata.Parser-100"><span class="linenos">100</span></a> <span class="s2">&quot;TRANSLATE&quot;</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">STRICT_CAST</span><span class="p">),</span>
+</span><span id="Teradata.Parser-101"><a href="#Teradata.Parser-101"><span class="linenos">101</span></a> <span class="p">}</span>
</span><span id="Teradata.Parser-102"><a href="#Teradata.Parser-102"><span class="linenos">102</span></a>
-</span><span id="Teradata.Parser-103"><a href="#Teradata.Parser-103"><span class="linenos">103</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span>
-</span><span id="Teradata.Parser-104"><a href="#Teradata.Parser-104"><span class="linenos">104</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span>
-</span><span id="Teradata.Parser-105"><a href="#Teradata.Parser-105"><span class="linenos">105</span></a> <span class="k">def</span> <span class="nf">_parse_update</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span>
-</span><span id="Teradata.Parser-106"><a href="#Teradata.Parser-106"><span class="linenos">106</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span>
-</span><span id="Teradata.Parser-107"><a href="#Teradata.Parser-107"><span class="linenos">107</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span>
-</span><span id="Teradata.Parser-108"><a href="#Teradata.Parser-108"><span class="linenos">108</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span>
-</span><span id="Teradata.Parser-109"><a href="#Teradata.Parser-109"><span class="linenos">109</span></a> <span class="s2">&quot;this&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">UPDATE_ALIAS_TOKENS</span><span class="p">),</span>
-</span><span id="Teradata.Parser-110"><a href="#Teradata.Parser-110"><span class="linenos">110</span></a> <span class="s2">&quot;from&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(</span><span class="n">modifiers</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span>
-</span><span id="Teradata.Parser-111"><a href="#Teradata.Parser-111"><span class="linenos">111</span></a> <span class="s2">&quot;expressions&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span>
-</span><span id="Teradata.Parser-112"><a href="#Teradata.Parser-112"><span class="linenos">112</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span>
-</span><span id="Teradata.Parser-113"><a href="#Teradata.Parser-113"><span class="linenos">113</span></a> <span class="s2">&quot;where&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span>
-</span><span id="Teradata.Parser-114"><a href="#Teradata.Parser-114"><span class="linenos">114</span></a> <span class="p">},</span>
-</span><span id="Teradata.Parser-115"><a href="#Teradata.Parser-115"><span class="linenos">115</span></a> <span class="p">)</span>
+</span><span id="Teradata.Parser-103"><a href="#Teradata.Parser-103"><span class="linenos">103</span></a> <span class="k">def</span> <span class="nf">_parse_translate</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span>
+</span><span id="Teradata.Parser-104"><a href="#Teradata.Parser-104"><span class="linenos">104</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span>
+</span><span id="Teradata.Parser-105"><a href="#Teradata.Parser-105"><span class="linenos">105</span></a>
+</span><span id="Teradata.Parser-106"><a href="#Teradata.Parser-106"><span class="linenos">106</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">USING</span><span class="p">):</span>
+</span><span id="Teradata.Parser-107"><a href="#Teradata.Parser-107"><span class="linenos">107</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">&quot;Expected USING in TRANSLATE&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Parser-108"><a href="#Teradata.Parser-108"><span class="linenos">108</span></a>
+</span><span id="Teradata.Parser-109"><a href="#Teradata.Parser-109"><span class="linenos">109</span></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_texts</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">CHARSET_TRANSLATORS</span><span class="p">):</span>
+</span><span id="Teradata.Parser-110"><a href="#Teradata.Parser-110"><span class="linenos">110</span></a> <span class="n">charset_split</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prev</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;_TO_&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Parser-111"><a href="#Teradata.Parser-111"><span class="linenos">111</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CharacterSet</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">charset_split</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
+</span><span id="Teradata.Parser-112"><a href="#Teradata.Parser-112"><span class="linenos">112</span></a> <span class="k">else</span><span class="p">:</span>
+</span><span id="Teradata.Parser-113"><a href="#Teradata.Parser-113"><span class="linenos">113</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">raise_error</span><span class="p">(</span><span class="s2">&quot;Expected a character set translator after USING in TRANSLATE&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Parser-114"><a href="#Teradata.Parser-114"><span class="linenos">114</span></a>
+</span><span id="Teradata.Parser-115"><a href="#Teradata.Parser-115"><span class="linenos">115</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span> <span class="k">if</span> <span class="n">strict</span> <span class="k">else</span> <span class="n">exp</span><span class="o">.</span><span class="n">TryCast</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">to</span><span class="o">=</span><span class="n">to</span><span class="p">)</span>
</span><span id="Teradata.Parser-116"><a href="#Teradata.Parser-116"><span class="linenos">116</span></a>
-</span><span id="Teradata.Parser-117"><a href="#Teradata.Parser-117"><span class="linenos">117</span></a> <span class="k">def</span> <span class="nf">_parse_rangen</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
-</span><span id="Teradata.Parser-118"><a href="#Teradata.Parser-118"><span class="linenos">118</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span>
-</span><span id="Teradata.Parser-119"><a href="#Teradata.Parser-119"><span class="linenos">119</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)</span>
-</span><span id="Teradata.Parser-120"><a href="#Teradata.Parser-120"><span class="linenos">120</span></a>
-</span><span id="Teradata.Parser-121"><a href="#Teradata.Parser-121"><span class="linenos">121</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span>
-</span><span id="Teradata.Parser-122"><a href="#Teradata.Parser-122"><span class="linenos">122</span></a> <span class="n">each</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">&quot;EACH&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span>
-</span><span id="Teradata.Parser-123"><a href="#Teradata.Parser-123"><span class="linenos">123</span></a>
-</span><span id="Teradata.Parser-124"><a href="#Teradata.Parser-124"><span class="linenos">124</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RangeN</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">each</span><span class="o">=</span><span class="n">each</span><span class="p">)</span>
-</span><span id="Teradata.Parser-125"><a href="#Teradata.Parser-125"><span class="linenos">125</span></a>
-</span><span id="Teradata.Parser-126"><a href="#Teradata.Parser-126"><span class="linenos">126</span></a> <span class="k">def</span> <span class="nf">_parse_cast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">:</span>
-</span><span id="Teradata.Parser-127"><a href="#Teradata.Parser-127"><span class="linenos">127</span></a> <span class="n">cast</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">cast</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Cast</span><span class="p">,</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_cast</span><span class="p">(</span><span class="n">strict</span><span class="p">))</span>
-</span><span id="Teradata.Parser-128"><a href="#Teradata.Parser-128"><span class="linenos">128</span></a> <span class="k">if</span> <span class="n">cast</span><span class="o">.</span><span class="n">to</span><span class="o">.</span><span class="n">this</span> <span class="o">==</span> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">DATE</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">FORMAT</span><span class="p">):</span>
-</span><span id="Teradata.Parser-129"><a href="#Teradata.Parser-129"><span class="linenos">129</span></a> <span class="k">return</span> <span class="n">format_time_lambda</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">,</span> <span class="s2">&quot;teradata&quot;</span><span class="p">)(</span>
-</span><span id="Teradata.Parser-130"><a href="#Teradata.Parser-130"><span class="linenos">130</span></a> <span class="p">[</span><span class="n">cast</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_string</span><span class="p">()]</span>
-</span><span id="Teradata.Parser-131"><a href="#Teradata.Parser-131"><span class="linenos">131</span></a> <span class="p">)</span>
-</span><span id="Teradata.Parser-132"><a href="#Teradata.Parser-132"><span class="linenos">132</span></a> <span class="k">return</span> <span class="n">cast</span>
+</span><span id="Teradata.Parser-117"><a href="#Teradata.Parser-117"><span class="linenos">117</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span>
+</span><span id="Teradata.Parser-118"><a href="#Teradata.Parser-118"><span class="linenos">118</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span>
+</span><span id="Teradata.Parser-119"><a href="#Teradata.Parser-119"><span class="linenos">119</span></a> <span class="k">def</span> <span class="nf">_parse_update</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">:</span>
+</span><span id="Teradata.Parser-120"><a href="#Teradata.Parser-120"><span class="linenos">120</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span>
+</span><span id="Teradata.Parser-121"><a href="#Teradata.Parser-121"><span class="linenos">121</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Update</span><span class="p">,</span>
+</span><span id="Teradata.Parser-122"><a href="#Teradata.Parser-122"><span class="linenos">122</span></a> <span class="o">**</span><span class="p">{</span> <span class="c1"># type: ignore</span>
+</span><span id="Teradata.Parser-123"><a href="#Teradata.Parser-123"><span class="linenos">123</span></a> <span class="s2">&quot;this&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span><span class="n">alias_tokens</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">UPDATE_ALIAS_TOKENS</span><span class="p">),</span>
+</span><span id="Teradata.Parser-124"><a href="#Teradata.Parser-124"><span class="linenos">124</span></a> <span class="s2">&quot;from&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_from</span><span class="p">(</span><span class="n">modifiers</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span>
+</span><span id="Teradata.Parser-125"><a href="#Teradata.Parser-125"><span class="linenos">125</span></a> <span class="s2">&quot;expressions&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">SET</span><span class="p">)</span>
+</span><span id="Teradata.Parser-126"><a href="#Teradata.Parser-126"><span class="linenos">126</span></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_equality</span><span class="p">),</span>
+</span><span id="Teradata.Parser-127"><a href="#Teradata.Parser-127"><span class="linenos">127</span></a> <span class="s2">&quot;where&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_where</span><span class="p">(),</span>
+</span><span id="Teradata.Parser-128"><a href="#Teradata.Parser-128"><span class="linenos">128</span></a> <span class="p">},</span>
+</span><span id="Teradata.Parser-129"><a href="#Teradata.Parser-129"><span class="linenos">129</span></a> <span class="p">)</span>
+</span><span id="Teradata.Parser-130"><a href="#Teradata.Parser-130"><span class="linenos">130</span></a>
+</span><span id="Teradata.Parser-131"><a href="#Teradata.Parser-131"><span class="linenos">131</span></a> <span class="k">def</span> <span class="nf">_parse_rangen</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+</span><span id="Teradata.Parser-132"><a href="#Teradata.Parser-132"><span class="linenos">132</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_id_var</span><span class="p">()</span>
+</span><span id="Teradata.Parser-133"><a href="#Teradata.Parser-133"><span class="linenos">133</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_match</span><span class="p">(</span><span class="n">TokenType</span><span class="o">.</span><span class="n">BETWEEN</span><span class="p">)</span>
+</span><span id="Teradata.Parser-134"><a href="#Teradata.Parser-134"><span class="linenos">134</span></a>
+</span><span id="Teradata.Parser-135"><a href="#Teradata.Parser-135"><span class="linenos">135</span></a> <span class="n">expressions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">)</span>
+</span><span id="Teradata.Parser-136"><a href="#Teradata.Parser-136"><span class="linenos">136</span></a> <span class="n">each</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_match_text_seq</span><span class="p">(</span><span class="s2">&quot;EACH&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_conjunction</span><span class="p">()</span>
+</span><span id="Teradata.Parser-137"><a href="#Teradata.Parser-137"><span class="linenos">137</span></a>
+</span><span id="Teradata.Parser-138"><a href="#Teradata.Parser-138"><span class="linenos">138</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">RangeN</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">this</span><span class="p">,</span> <span class="n">expressions</span><span class="o">=</span><span class="n">expressions</span><span class="p">,</span> <span class="n">each</span><span class="o">=</span><span class="n">each</span><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>
@@ -695,105 +736,107 @@ Default: "nulls_are_small"</li>
</div>
<a class="headerlink" href="#Teradata.Generator"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator-134"><a href="#Teradata.Generator-134"><span class="linenos">134</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="Teradata.Generator-135"><a href="#Teradata.Generator-135"><span class="linenos">135</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span>
-</span><span id="Teradata.Generator-136"><a href="#Teradata.Generator-136"><span class="linenos">136</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span>
-</span><span id="Teradata.Generator-137"><a href="#Teradata.Generator-137"><span class="linenos">137</span></a>
-</span><span id="Teradata.Generator-138"><a href="#Teradata.Generator-138"><span class="linenos">138</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata.Generator-139"><a href="#Teradata.Generator-139"><span class="linenos">139</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">TYPE_MAPPING</span><span class="p">,</span>
-</span><span id="Teradata.Generator-140"><a href="#Teradata.Generator-140"><span class="linenos">140</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">:</span> <span class="s2">&quot;ST_GEOMETRY&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Generator-141"><a href="#Teradata.Generator-141"><span class="linenos">141</span></a> <span class="p">}</span>
-</span><span id="Teradata.Generator-142"><a href="#Teradata.Generator-142"><span class="linenos">142</span></a>
-</span><span id="Teradata.Generator-143"><a href="#Teradata.Generator-143"><span class="linenos">143</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata.Generator-144"><a href="#Teradata.Generator-144"><span class="linenos">144</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="Teradata.Generator-145"><a href="#Teradata.Generator-145"><span class="linenos">145</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">OnCommitProperty</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">POST_INDEX</span><span class="p">,</span>
-</span><span id="Teradata.Generator-146"><a href="#Teradata.Generator-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</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">POST_EXPRESSION</span><span class="p">,</span>
-</span><span id="Teradata.Generator-147"><a href="#Teradata.Generator-147"><span class="linenos">147</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StabilityProperty</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">POST_CREATE</span><span class="p">,</span>
-</span><span id="Teradata.Generator-148"><a href="#Teradata.Generator-148"><span class="linenos">148</span></a> <span class="p">}</span>
-</span><span id="Teradata.Generator-149"><a href="#Teradata.Generator-149"><span class="linenos">149</span></a>
-</span><span id="Teradata.Generator-150"><a href="#Teradata.Generator-150"><span class="linenos">150</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span>
-</span><span id="Teradata.Generator-151"><a href="#Teradata.Generator-151"><span class="linenos">151</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="Teradata.Generator-152"><a href="#Teradata.Generator-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Max</span><span class="p">:</span> <span class="n">max_or_greatest</span><span class="p">,</span>
-</span><span id="Teradata.Generator-153"><a href="#Teradata.Generator-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Min</span><span class="p">:</span> <span class="n">min_or_least</span><span class="p">,</span>
-</span><span id="Teradata.Generator-154"><a href="#Teradata.Generator-154"><span class="linenos">154</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="Teradata.Generator-155"><a href="#Teradata.Generator-155"><span class="linenos">155</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TimeToStr</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">&quot;CAST(</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">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE FORMAT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)&quot;</span><span class="p">,</span>
-</span><span id="Teradata.Generator-156"><a href="#Teradata.Generator-156"><span class="linenos">156</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ToChar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">e</span><span class="p">),</span>
-</span><span id="Teradata.Generator-157"><a href="#Teradata.Generator-157"><span class="linenos">157</span></a> <span class="p">}</span>
-</span><span id="Teradata.Generator-158"><a href="#Teradata.Generator-158"><span class="linenos">158</span></a>
-</span><span id="Teradata.Generator-159"><a href="#Teradata.Generator-159"><span class="linenos">159</span></a> <span class="k">def</span> <span class="nf">partitionedbyproperty_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">PartitionedByProperty</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata.Generator-160"><a href="#Teradata.Generator-160"><span class="linenos">160</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;PARTITION BY </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">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span>
-</span><span id="Teradata.Generator-161"><a href="#Teradata.Generator-161"><span class="linenos">161</span></a>
-</span><span id="Teradata.Generator-162"><a href="#Teradata.Generator-162"><span class="linenos">162</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span>
-</span><span id="Teradata.Generator-163"><a href="#Teradata.Generator-163"><span class="linenos">163</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span>
-</span><span id="Teradata.Generator-164"><a href="#Teradata.Generator-164"><span class="linenos">164</span></a> <span class="k">def</span> <span class="nf">update_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">Update</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata.Generator-165"><a href="#Teradata.Generator-165"><span class="linenos">165</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">&quot;this&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator-166"><a href="#Teradata.Generator-166"><span class="linenos">166</span></a> <span class="n">from_sql</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">&quot;from&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator-167"><a href="#Teradata.Generator-167"><span class="linenos">167</span></a> <span class="n">set_sql</span> <span class="o">=</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="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
-</span><span id="Teradata.Generator-168"><a href="#Teradata.Generator-168"><span class="linenos">168</span></a> <span class="n">where_sql</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">&quot;where&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator-169"><a href="#Teradata.Generator-169"><span class="linenos">169</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">&quot;</span>
-</span><span id="Teradata.Generator-170"><a href="#Teradata.Generator-170"><span class="linenos">170</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span>
-</span><span id="Teradata.Generator-171"><a href="#Teradata.Generator-171"><span class="linenos">171</span></a>
-</span><span id="Teradata.Generator-172"><a href="#Teradata.Generator-172"><span class="linenos">172</span></a> <span class="k">def</span> <span class="nf">mod_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">Mod</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata.Generator-173"><a href="#Teradata.Generator-173"><span class="linenos">173</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;MOD&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator-174"><a href="#Teradata.Generator-174"><span class="linenos">174</span></a>
-</span><span id="Teradata.Generator-175"><a href="#Teradata.Generator-175"><span class="linenos">175</span></a> <span class="k">def</span> <span class="nf">datatype_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">DataType</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata.Generator-176"><a href="#Teradata.Generator-176"><span class="linenos">176</span></a> <span class="n">type_sql</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="Teradata.Generator-177"><a href="#Teradata.Generator-177"><span class="linenos">177</span></a> <span class="n">prefix_sql</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;prefix&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator-178"><a href="#Teradata.Generator-178"><span class="linenos">178</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">prefix_sql</span> <span class="k">else</span> <span class="n">type_sql</span>
-</span><span id="Teradata.Generator-179"><a href="#Teradata.Generator-179"><span class="linenos">179</span></a>
-</span><span id="Teradata.Generator-180"><a href="#Teradata.Generator-180"><span class="linenos">180</span></a> <span class="k">def</span> <span class="nf">rangen_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">RangeN</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata.Generator-181"><a href="#Teradata.Generator-181"><span class="linenos">181</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">&quot;this&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator-182"><a href="#Teradata.Generator-182"><span class="linenos">182</span></a> <span class="n">expressions_sql</span> <span class="o">=</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><span id="Teradata.Generator-183"><a href="#Teradata.Generator-183"><span class="linenos">183</span></a> <span class="n">each_sql</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">&quot;each&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator-184"><a href="#Teradata.Generator-184"><span class="linenos">184</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator-140"><a href="#Teradata.Generator-140"><span class="linenos">140</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="Teradata.Generator-141"><a href="#Teradata.Generator-141"><span class="linenos">141</span></a> <span class="n">JOIN_HINTS</span> <span class="o">=</span> <span class="kc">False</span>
+</span><span id="Teradata.Generator-142"><a href="#Teradata.Generator-142"><span class="linenos">142</span></a> <span class="n">TABLE_HINTS</span> <span class="o">=</span> <span class="kc">False</span>
+</span><span id="Teradata.Generator-143"><a href="#Teradata.Generator-143"><span class="linenos">143</span></a>
+</span><span id="Teradata.Generator-144"><a href="#Teradata.Generator-144"><span class="linenos">144</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata.Generator-145"><a href="#Teradata.Generator-145"><span class="linenos">145</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">TYPE_MAPPING</span><span class="p">,</span>
+</span><span id="Teradata.Generator-146"><a href="#Teradata.Generator-146"><span class="linenos">146</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">GEOMETRY</span><span class="p">:</span> <span class="s2">&quot;ST_GEOMETRY&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Generator-147"><a href="#Teradata.Generator-147"><span class="linenos">147</span></a> <span class="p">}</span>
+</span><span id="Teradata.Generator-148"><a href="#Teradata.Generator-148"><span class="linenos">148</span></a>
+</span><span id="Teradata.Generator-149"><a href="#Teradata.Generator-149"><span class="linenos">149</span></a> <span class="n">PROPERTIES_LOCATION</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata.Generator-150"><a href="#Teradata.Generator-150"><span class="linenos">150</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="Teradata.Generator-151"><a href="#Teradata.Generator-151"><span class="linenos">151</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">OnCommitProperty</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">POST_INDEX</span><span class="p">,</span>
+</span><span id="Teradata.Generator-152"><a href="#Teradata.Generator-152"><span class="linenos">152</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">PartitionedByProperty</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">POST_EXPRESSION</span><span class="p">,</span>
+</span><span id="Teradata.Generator-153"><a href="#Teradata.Generator-153"><span class="linenos">153</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StabilityProperty</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">POST_CREATE</span><span class="p">,</span>
+</span><span id="Teradata.Generator-154"><a href="#Teradata.Generator-154"><span class="linenos">154</span></a> <span class="p">}</span>
+</span><span id="Teradata.Generator-155"><a href="#Teradata.Generator-155"><span class="linenos">155</span></a>
+</span><span id="Teradata.Generator-156"><a href="#Teradata.Generator-156"><span class="linenos">156</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span>
+</span><span id="Teradata.Generator-157"><a href="#Teradata.Generator-157"><span class="linenos">157</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="Teradata.Generator-158"><a href="#Teradata.Generator-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Max</span><span class="p">:</span> <span class="n">max_or_greatest</span><span class="p">,</span>
+</span><span id="Teradata.Generator-159"><a href="#Teradata.Generator-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Min</span><span class="p">:</span> <span class="n">min_or_least</span><span class="p">,</span>
+</span><span id="Teradata.Generator-160"><a href="#Teradata.Generator-160"><span class="linenos">160</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="Teradata.Generator-161"><a href="#Teradata.Generator-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StrToDate</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">&quot;CAST(</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">e</span><span class="p">,</span><span class="w"> </span><span class="s1">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2"> AS DATE FORMAT </span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_time</span><span class="p">(</span><span class="n">e</span><span class="p">)</span><span class="si">}</span><span class="s2">)&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Generator-162"><a href="#Teradata.Generator-162"><span class="linenos">162</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ToChar</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> <span class="n">e</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">function_fallback_sql</span><span class="p">(</span><span class="n">e</span><span class="p">),</span>
+</span><span id="Teradata.Generator-163"><a href="#Teradata.Generator-163"><span class="linenos">163</span></a> <span class="p">}</span>
+</span><span id="Teradata.Generator-164"><a href="#Teradata.Generator-164"><span class="linenos">164</span></a>
+</span><span id="Teradata.Generator-165"><a href="#Teradata.Generator-165"><span class="linenos">165</span></a> <span class="k">def</span> <span class="nf">partitionedbyproperty_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">PartitionedByProperty</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata.Generator-166"><a href="#Teradata.Generator-166"><span class="linenos">166</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;PARTITION BY </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">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="Teradata.Generator-167"><a href="#Teradata.Generator-167"><span class="linenos">167</span></a>
+</span><span id="Teradata.Generator-168"><a href="#Teradata.Generator-168"><span class="linenos">168</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span>
+</span><span id="Teradata.Generator-169"><a href="#Teradata.Generator-169"><span class="linenos">169</span></a> <span class="c1"># https://docs.teradata.com/r/Enterprise_IntelliFlex_VMware/Teradata-VantageTM-SQL-Data-Manipulation-Language-17.20/Statement-Syntax/UPDATE/UPDATE-Syntax-Basic-Form-FROM-Clause</span>
+</span><span id="Teradata.Generator-170"><a href="#Teradata.Generator-170"><span class="linenos">170</span></a> <span class="k">def</span> <span class="nf">update_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">Update</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata.Generator-171"><a href="#Teradata.Generator-171"><span class="linenos">171</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">&quot;this&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator-172"><a href="#Teradata.Generator-172"><span class="linenos">172</span></a> <span class="n">from_sql</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">&quot;from&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator-173"><a href="#Teradata.Generator-173"><span class="linenos">173</span></a> <span class="n">set_sql</span> <span class="o">=</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="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
+</span><span id="Teradata.Generator-174"><a href="#Teradata.Generator-174"><span class="linenos">174</span></a> <span class="n">where_sql</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">&quot;where&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator-175"><a href="#Teradata.Generator-175"><span class="linenos">175</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="Teradata.Generator-176"><a href="#Teradata.Generator-176"><span class="linenos">176</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span>
+</span><span id="Teradata.Generator-177"><a href="#Teradata.Generator-177"><span class="linenos">177</span></a>
+</span><span id="Teradata.Generator-178"><a href="#Teradata.Generator-178"><span class="linenos">178</span></a> <span class="k">def</span> <span class="nf">mod_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">Mod</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata.Generator-179"><a href="#Teradata.Generator-179"><span class="linenos">179</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;MOD&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator-180"><a href="#Teradata.Generator-180"><span class="linenos">180</span></a>
+</span><span id="Teradata.Generator-181"><a href="#Teradata.Generator-181"><span class="linenos">181</span></a> <span class="k">def</span> <span class="nf">datatype_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">DataType</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata.Generator-182"><a href="#Teradata.Generator-182"><span class="linenos">182</span></a> <span class="n">type_sql</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="Teradata.Generator-183"><a href="#Teradata.Generator-183"><span class="linenos">183</span></a> <span class="n">prefix_sql</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;prefix&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator-184"><a href="#Teradata.Generator-184"><span class="linenos">184</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">prefix_sql</span> <span class="k">else</span> <span class="n">type_sql</span>
</span><span id="Teradata.Generator-185"><a href="#Teradata.Generator-185"><span class="linenos">185</span></a>
-</span><span id="Teradata.Generator-186"><a href="#Teradata.Generator-186"><span class="linenos">186</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;RANGE_N(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">)&quot;</span>
+</span><span id="Teradata.Generator-186"><a href="#Teradata.Generator-186"><span class="linenos">186</span></a> <span class="k">def</span> <span class="nf">rangen_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">RangeN</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata.Generator-187"><a href="#Teradata.Generator-187"><span class="linenos">187</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">&quot;this&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator-188"><a href="#Teradata.Generator-188"><span class="linenos">188</span></a> <span class="n">expressions_sql</span> <span class="o">=</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><span id="Teradata.Generator-189"><a href="#Teradata.Generator-189"><span class="linenos">189</span></a> <span class="n">each_sql</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">&quot;each&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator-190"><a href="#Teradata.Generator-190"><span class="linenos">190</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
+</span><span id="Teradata.Generator-191"><a href="#Teradata.Generator-191"><span class="linenos">191</span></a>
+</span><span id="Teradata.Generator-192"><a href="#Teradata.Generator-192"><span class="linenos">192</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;RANGE_N(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">)&quot;</span>
+</span><span id="Teradata.Generator-193"><a href="#Teradata.Generator-193"><span class="linenos">193</span></a>
+</span><span id="Teradata.Generator-194"><a href="#Teradata.Generator-194"><span class="linenos">194</span></a> <span class="k">def</span> <span class="nf">createable_sql</span><span class="p">(</span>
+</span><span id="Teradata.Generator-195"><a href="#Teradata.Generator-195"><span class="linenos">195</span></a> <span class="bp">self</span><span class="p">,</span>
+</span><span id="Teradata.Generator-196"><a href="#Teradata.Generator-196"><span class="linenos">196</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">,</span>
+</span><span id="Teradata.Generator-197"><a href="#Teradata.Generator-197"><span class="linenos">197</span></a> <span class="n">locations</span><span class="p">:</span> <span class="nb">dict</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="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">]],</span>
+</span><span id="Teradata.Generator-198"><a href="#Teradata.Generator-198"><span class="linenos">198</span></a> <span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata.Generator-199"><a href="#Teradata.Generator-199"><span class="linenos">199</span></a> <span class="n">kind</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">&quot;kind&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span>
+</span><span id="Teradata.Generator-200"><a href="#Teradata.Generator-200"><span class="linenos">200</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">&quot;TABLE&quot;</span> <span class="ow">and</span> <span class="n">locations</span><span class="o">.</span><span class="n">get</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">POST_NAME</span><span class="p">):</span>
+</span><span id="Teradata.Generator-201"><a href="#Teradata.Generator-201"><span class="linenos">201</span></a> <span class="n">this_name</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="o">.</span><span class="n">this</span><span class="p">,</span> <span class="s2">&quot;this&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator-202"><a href="#Teradata.Generator-202"><span class="linenos">202</span></a> <span class="n">this_properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span>
+</span><span id="Teradata.Generator-203"><a href="#Teradata.Generator-203"><span class="linenos">203</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">locations</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">POST_NAME</span><span class="p">]),</span>
+</span><span id="Teradata.Generator-204"><a href="#Teradata.Generator-204"><span class="linenos">204</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
+</span><span id="Teradata.Generator-205"><a href="#Teradata.Generator-205"><span class="linenos">205</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">&quot;,&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Generator-206"><a href="#Teradata.Generator-206"><span class="linenos">206</span></a> <span class="p">)</span>
+</span><span id="Teradata.Generator-207"><a href="#Teradata.Generator-207"><span class="linenos">207</span></a> <span class="n">this_schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">schema_columns_sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span>
+</span><span id="Teradata.Generator-208"><a href="#Teradata.Generator-208"><span class="linenos">208</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">this_name</span><span class="si">}{</span><span class="n">this_properties</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this_schema</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="Teradata.Generator-209"><a href="#Teradata.Generator-209"><span class="linenos">209</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">createable_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">locations</span><span class="p">)</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
@@ -816,8 +859,8 @@ Default: True</li>
</div>
<a class="headerlink" href="#Teradata.Generator.partitionedbyproperty_sql"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.partitionedbyproperty_sql-159"><a href="#Teradata.Generator.partitionedbyproperty_sql-159"><span class="linenos">159</span></a> <span class="k">def</span> <span class="nf">partitionedbyproperty_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">PartitionedByProperty</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata.Generator.partitionedbyproperty_sql-160"><a href="#Teradata.Generator.partitionedbyproperty_sql-160"><span class="linenos">160</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;PARTITION BY </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">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.partitionedbyproperty_sql-165"><a href="#Teradata.Generator.partitionedbyproperty_sql-165"><span class="linenos">165</span></a> <span class="k">def</span> <span class="nf">partitionedbyproperty_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">PartitionedByProperty</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata.Generator.partitionedbyproperty_sql-166"><a href="#Teradata.Generator.partitionedbyproperty_sql-166"><span class="linenos">166</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;PARTITION BY </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">&#39;this&#39;</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span>
</span></pre></div>
@@ -835,13 +878,13 @@ Default: True</li>
</div>
<a class="headerlink" href="#Teradata.Generator.update_sql"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.update_sql-164"><a href="#Teradata.Generator.update_sql-164"><span class="linenos">164</span></a> <span class="k">def</span> <span class="nf">update_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">Update</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata.Generator.update_sql-165"><a href="#Teradata.Generator.update_sql-165"><span class="linenos">165</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">&quot;this&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator.update_sql-166"><a href="#Teradata.Generator.update_sql-166"><span class="linenos">166</span></a> <span class="n">from_sql</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">&quot;from&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator.update_sql-167"><a href="#Teradata.Generator.update_sql-167"><span class="linenos">167</span></a> <span class="n">set_sql</span> <span class="o">=</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="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
-</span><span id="Teradata.Generator.update_sql-168"><a href="#Teradata.Generator.update_sql-168"><span class="linenos">168</span></a> <span class="n">where_sql</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">&quot;where&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator.update_sql-169"><a href="#Teradata.Generator.update_sql-169"><span class="linenos">169</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">&quot;</span>
-</span><span id="Teradata.Generator.update_sql-170"><a href="#Teradata.Generator.update_sql-170"><span class="linenos">170</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.update_sql-170"><a href="#Teradata.Generator.update_sql-170"><span class="linenos">170</span></a> <span class="k">def</span> <span class="nf">update_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">Update</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata.Generator.update_sql-171"><a href="#Teradata.Generator.update_sql-171"><span class="linenos">171</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">&quot;this&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator.update_sql-172"><a href="#Teradata.Generator.update_sql-172"><span class="linenos">172</span></a> <span class="n">from_sql</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">&quot;from&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator.update_sql-173"><a href="#Teradata.Generator.update_sql-173"><span class="linenos">173</span></a> <span class="n">set_sql</span> <span class="o">=</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="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
+</span><span id="Teradata.Generator.update_sql-174"><a href="#Teradata.Generator.update_sql-174"><span class="linenos">174</span></a> <span class="n">where_sql</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">&quot;where&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator.update_sql-175"><a href="#Teradata.Generator.update_sql-175"><span class="linenos">175</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;UPDATE </span><span class="si">{</span><span class="n">this</span><span class="si">}{</span><span class="n">from_sql</span><span class="si">}</span><span class="s2"> SET </span><span class="si">{</span><span class="n">set_sql</span><span class="si">}{</span><span class="n">where_sql</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="Teradata.Generator.update_sql-176"><a href="#Teradata.Generator.update_sql-176"><span class="linenos">176</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">prepend_ctes</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">sql</span><span class="p">)</span>
</span></pre></div>
@@ -859,8 +902,8 @@ Default: True</li>
</div>
<a class="headerlink" href="#Teradata.Generator.mod_sql"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.mod_sql-172"><a href="#Teradata.Generator.mod_sql-172"><span class="linenos">172</span></a> <span class="k">def</span> <span class="nf">mod_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">Mod</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata.Generator.mod_sql-173"><a href="#Teradata.Generator.mod_sql-173"><span class="linenos">173</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;MOD&quot;</span><span class="p">)</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.mod_sql-178"><a href="#Teradata.Generator.mod_sql-178"><span class="linenos">178</span></a> <span class="k">def</span> <span class="nf">mod_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">Mod</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata.Generator.mod_sql-179"><a href="#Teradata.Generator.mod_sql-179"><span class="linenos">179</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">binary</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">&quot;MOD&quot;</span><span class="p">)</span>
</span></pre></div>
@@ -878,10 +921,10 @@ Default: True</li>
</div>
<a class="headerlink" href="#Teradata.Generator.datatype_sql"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.datatype_sql-175"><a href="#Teradata.Generator.datatype_sql-175"><span class="linenos">175</span></a> <span class="k">def</span> <span class="nf">datatype_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">DataType</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata.Generator.datatype_sql-176"><a href="#Teradata.Generator.datatype_sql-176"><span class="linenos">176</span></a> <span class="n">type_sql</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
-</span><span id="Teradata.Generator.datatype_sql-177"><a href="#Teradata.Generator.datatype_sql-177"><span class="linenos">177</span></a> <span class="n">prefix_sql</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;prefix&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator.datatype_sql-178"><a href="#Teradata.Generator.datatype_sql-178"><span class="linenos">178</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">prefix_sql</span> <span class="k">else</span> <span class="n">type_sql</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.datatype_sql-181"><a href="#Teradata.Generator.datatype_sql-181"><span class="linenos">181</span></a> <span class="k">def</span> <span class="nf">datatype_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">DataType</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata.Generator.datatype_sql-182"><a href="#Teradata.Generator.datatype_sql-182"><span class="linenos">182</span></a> <span class="n">type_sql</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">datatype_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">)</span>
+</span><span id="Teradata.Generator.datatype_sql-183"><a href="#Teradata.Generator.datatype_sql-183"><span class="linenos">183</span></a> <span class="n">prefix_sql</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;prefix&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator.datatype_sql-184"><a href="#Teradata.Generator.datatype_sql-184"><span class="linenos">184</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">prefix_sql</span> <span class="k">else</span> <span class="n">type_sql</span>
</span></pre></div>
@@ -899,13 +942,46 @@ Default: True</li>
</div>
<a class="headerlink" href="#Teradata.Generator.rangen_sql"></a>
- <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.rangen_sql-180"><a href="#Teradata.Generator.rangen_sql-180"><span class="linenos">180</span></a> <span class="k">def</span> <span class="nf">rangen_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">RangeN</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
-</span><span id="Teradata.Generator.rangen_sql-181"><a href="#Teradata.Generator.rangen_sql-181"><span class="linenos">181</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">&quot;this&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator.rangen_sql-182"><a href="#Teradata.Generator.rangen_sql-182"><span class="linenos">182</span></a> <span class="n">expressions_sql</span> <span class="o">=</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><span id="Teradata.Generator.rangen_sql-183"><a href="#Teradata.Generator.rangen_sql-183"><span class="linenos">183</span></a> <span class="n">each_sql</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">&quot;each&quot;</span><span class="p">)</span>
-</span><span id="Teradata.Generator.rangen_sql-184"><a href="#Teradata.Generator.rangen_sql-184"><span class="linenos">184</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
-</span><span id="Teradata.Generator.rangen_sql-185"><a href="#Teradata.Generator.rangen_sql-185"><span class="linenos">185</span></a>
-</span><span id="Teradata.Generator.rangen_sql-186"><a href="#Teradata.Generator.rangen_sql-186"><span class="linenos">186</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;RANGE_N(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">)&quot;</span>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.rangen_sql-186"><a href="#Teradata.Generator.rangen_sql-186"><span class="linenos">186</span></a> <span class="k">def</span> <span class="nf">rangen_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">RangeN</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata.Generator.rangen_sql-187"><a href="#Teradata.Generator.rangen_sql-187"><span class="linenos">187</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">&quot;this&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator.rangen_sql-188"><a href="#Teradata.Generator.rangen_sql-188"><span class="linenos">188</span></a> <span class="n">expressions_sql</span> <span class="o">=</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><span id="Teradata.Generator.rangen_sql-189"><a href="#Teradata.Generator.rangen_sql-189"><span class="linenos">189</span></a> <span class="n">each_sql</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">&quot;each&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator.rangen_sql-190"><a href="#Teradata.Generator.rangen_sql-190"><span class="linenos">190</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot; EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">&quot;</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">&quot;&quot;</span>
+</span><span id="Teradata.Generator.rangen_sql-191"><a href="#Teradata.Generator.rangen_sql-191"><span class="linenos">191</span></a>
+</span><span id="Teradata.Generator.rangen_sql-192"><a href="#Teradata.Generator.rangen_sql-192"><span class="linenos">192</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;RANGE_N(</span><span class="si">{</span><span class="n">this</span><span class="si">}</span><span class="s2"> BETWEEN </span><span class="si">{</span><span class="n">expressions_sql</span><span class="si">}{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">)&quot;</span>
+</span></pre></div>
+
+
+
+
+ </div>
+ <div id="Teradata.Generator.createable_sql" class="classattr">
+ <input id="Teradata.Generator.createable_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">createable_sql</span><span class="signature pdoc-code multiline">(<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#Create">sqlglot.expressions.Create</a></span>,</span><span class="param"> <span class="n">locations</span><span class="p">:</span> <span class="nb">dict</span><span class="p">[</span><span class="n"><a href="../expressions.html#Properties.Location">sqlglot.expressions.Properties.Location</a></span><span class="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n"><a href="../expressions.html#Property">sqlglot.expressions.Property</a></span><span class="p">]]</span></span><span class="return-annotation">) -> <span class="nb">str</span>:</span></span>
+
+ <label class="view-source-button" for="Teradata.Generator.createable_sql-view-source"><span>View Source</span></label>
+
+ </div>
+ <a class="headerlink" href="#Teradata.Generator.createable_sql"></a>
+ <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.createable_sql-194"><a href="#Teradata.Generator.createable_sql-194"><span class="linenos">194</span></a> <span class="k">def</span> <span class="nf">createable_sql</span><span class="p">(</span>
+</span><span id="Teradata.Generator.createable_sql-195"><a href="#Teradata.Generator.createable_sql-195"><span class="linenos">195</span></a> <span class="bp">self</span><span class="p">,</span>
+</span><span id="Teradata.Generator.createable_sql-196"><a href="#Teradata.Generator.createable_sql-196"><span class="linenos">196</span></a> <span class="n">expression</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Create</span><span class="p">,</span>
+</span><span id="Teradata.Generator.createable_sql-197"><a href="#Teradata.Generator.createable_sql-197"><span class="linenos">197</span></a> <span class="n">locations</span><span class="p">:</span> <span class="nb">dict</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="p">,</span> <span class="nb">list</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Property</span><span class="p">]],</span>
+</span><span id="Teradata.Generator.createable_sql-198"><a href="#Teradata.Generator.createable_sql-198"><span class="linenos">198</span></a> <span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
+</span><span id="Teradata.Generator.createable_sql-199"><a href="#Teradata.Generator.createable_sql-199"><span class="linenos">199</span></a> <span class="n">kind</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">&quot;kind&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">upper</span><span class="p">()</span>
+</span><span id="Teradata.Generator.createable_sql-200"><a href="#Teradata.Generator.createable_sql-200"><span class="linenos">200</span></a> <span class="k">if</span> <span class="n">kind</span> <span class="o">==</span> <span class="s2">&quot;TABLE&quot;</span> <span class="ow">and</span> <span class="n">locations</span><span class="o">.</span><span class="n">get</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">POST_NAME</span><span class="p">):</span>
+</span><span id="Teradata.Generator.createable_sql-201"><a href="#Teradata.Generator.createable_sql-201"><span class="linenos">201</span></a> <span class="n">this_name</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="o">.</span><span class="n">this</span><span class="p">,</span> <span class="s2">&quot;this&quot;</span><span class="p">)</span>
+</span><span id="Teradata.Generator.createable_sql-202"><a href="#Teradata.Generator.createable_sql-202"><span class="linenos">202</span></a> <span class="n">this_properties</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span>
+</span><span id="Teradata.Generator.createable_sql-203"><a href="#Teradata.Generator.createable_sql-203"><span class="linenos">203</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">(</span><span class="n">expressions</span><span class="o">=</span><span class="n">locations</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">POST_NAME</span><span class="p">]),</span>
+</span><span id="Teradata.Generator.createable_sql-204"><a href="#Teradata.Generator.createable_sql-204"><span class="linenos">204</span></a> <span class="n">wrapped</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
+</span><span id="Teradata.Generator.createable_sql-205"><a href="#Teradata.Generator.createable_sql-205"><span class="linenos">205</span></a> <span class="n">prefix</span><span class="o">=</span><span class="s2">&quot;,&quot;</span><span class="p">,</span>
+</span><span id="Teradata.Generator.createable_sql-206"><a href="#Teradata.Generator.createable_sql-206"><span class="linenos">206</span></a> <span class="p">)</span>
+</span><span id="Teradata.Generator.createable_sql-207"><a href="#Teradata.Generator.createable_sql-207"><span class="linenos">207</span></a> <span class="n">this_schema</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">schema_columns_sql</span><span class="p">(</span><span class="n">expression</span><span class="o">.</span><span class="n">this</span><span class="p">)</span>
+</span><span id="Teradata.Generator.createable_sql-208"><a href="#Teradata.Generator.createable_sql-208"><span class="linenos">208</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">this_name</span><span class="si">}{</span><span class="n">this_properties</span><span class="si">}{</span><span class="bp">self</span><span class="o">.</span><span class="n">sep</span><span class="p">()</span><span class="si">}{</span><span class="n">this_schema</span><span class="si">}</span><span class="s2">&quot;</span>
+</span><span id="Teradata.Generator.createable_sql-209"><a href="#Teradata.Generator.createable_sql-209"><span class="linenos">209</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">createable_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">locations</span><span class="p">)</span>
</span></pre></div>
@@ -1021,10 +1097,12 @@ Default: True</li>
<dd id="Teradata.Generator.ordered_sql" class="function"><a href="../generator.html#Generator.ordered_sql">ordered_sql</a></dd>
<dd id="Teradata.Generator.matchrecognize_sql" class="function"><a href="../generator.html#Generator.matchrecognize_sql">matchrecognize_sql</a></dd>
<dd id="Teradata.Generator.query_modifiers" class="function"><a href="../generator.html#Generator.query_modifiers">query_modifiers</a></dd>
+ <dd id="Teradata.Generator.offset_limit_modifiers" class="function"><a href="../generator.html#Generator.offset_limit_modifiers">offset_limit_modifiers</a></dd>
<dd id="Teradata.Generator.after_having_modifiers" class="function"><a href="../generator.html#Generator.after_having_modifiers">after_having_modifiers</a></dd>
<dd id="Teradata.Generator.after_limit_modifiers" class="function"><a href="../generator.html#Generator.after_limit_modifiers">after_limit_modifiers</a></dd>
<dd id="Teradata.Generator.select_sql" class="function"><a href="../generator.html#Generator.select_sql">select_sql</a></dd>
<dd id="Teradata.Generator.schema_sql" class="function"><a href="../generator.html#Generator.schema_sql">schema_sql</a></dd>
+ <dd id="Teradata.Generator.schema_columns_sql" class="function"><a href="../generator.html#Generator.schema_columns_sql">schema_columns_sql</a></dd>
<dd id="Teradata.Generator.star_sql" class="function"><a href="../generator.html#Generator.star_sql">star_sql</a></dd>
<dd id="Teradata.Generator.parameter_sql" class="function"><a href="../generator.html#Generator.parameter_sql">parameter_sql</a></dd>
<dd id="Teradata.Generator.sessionparameter_sql" class="function"><a href="../generator.html#Generator.sessionparameter_sql">sessionparameter_sql</a></dd>
@@ -1049,7 +1127,7 @@ Default: True</li>
<dd id="Teradata.Generator.nextvaluefor_sql" class="function"><a href="../generator.html#Generator.nextvaluefor_sql">nextvaluefor_sql</a></dd>
<dd id="Teradata.Generator.extract_sql" class="function"><a href="../generator.html#Generator.extract_sql">extract_sql</a></dd>
<dd id="Teradata.Generator.trim_sql" class="function"><a href="../generator.html#Generator.trim_sql">trim_sql</a></dd>
- <dd id="Teradata.Generator.concat_sql" class="function"><a href="../generator.html#Generator.concat_sql">concat_sql</a></dd>
+ <dd id="Teradata.Generator.safeconcat_sql" class="function"><a href="../generator.html#Generator.safeconcat_sql">safeconcat_sql</a></dd>
<dd id="Teradata.Generator.check_sql" class="function"><a href="../generator.html#Generator.check_sql">check_sql</a></dd>
<dd id="Teradata.Generator.foreignkey_sql" class="function"><a href="../generator.html#Generator.foreignkey_sql">foreignkey_sql</a></dd>
<dd id="Teradata.Generator.primarykey_sql" class="function"><a href="../generator.html#Generator.primarykey_sql">primarykey_sql</a></dd>
@@ -1100,6 +1178,7 @@ Default: True</li>
<dd id="Teradata.Generator.respectnulls_sql" class="function"><a href="../generator.html#Generator.respectnulls_sql">respectnulls_sql</a></dd>
<dd id="Teradata.Generator.intdiv_sql" class="function"><a href="../generator.html#Generator.intdiv_sql">intdiv_sql</a></dd>
<dd id="Teradata.Generator.dpipe_sql" class="function"><a href="../generator.html#Generator.dpipe_sql">dpipe_sql</a></dd>
+ <dd id="Teradata.Generator.safedpipe_sql" class="function"><a href="../generator.html#Generator.safedpipe_sql">safedpipe_sql</a></dd>
<dd id="Teradata.Generator.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd>
<dd id="Teradata.Generator.overlaps_sql" class="function"><a href="../generator.html#Generator.overlaps_sql">overlaps_sql</a></dd>
<dd id="Teradata.Generator.distance_sql" class="function"><a href="../generator.html#Generator.distance_sql">distance_sql</a></dd>
@@ -1147,6 +1226,7 @@ Default: True</li>
<dd id="Teradata.Generator.dictproperty_sql" class="function"><a href="../generator.html#Generator.dictproperty_sql">dictproperty_sql</a></dd>
<dd id="Teradata.Generator.dictrange_sql" class="function"><a href="../generator.html#Generator.dictrange_sql">dictrange_sql</a></dd>
<dd id="Teradata.Generator.dictsubproperty_sql" class="function"><a href="../generator.html#Generator.dictsubproperty_sql">dictsubproperty_sql</a></dd>
+ <dd id="Teradata.Generator.oncluster_sql" class="function"><a href="../generator.html#Generator.oncluster_sql">oncluster_sql</a></dd>
</div>
</dl>