diff options
Diffstat (limited to 'docs/sqlglot/dialects/teradata.html')
-rw-r--r-- | docs/sqlglot/dialects/teradata.html | 235 |
1 files changed, 120 insertions, 115 deletions
diff --git a/docs/sqlglot/dialects/teradata.html b/docs/sqlglot/dialects/teradata.html index 91906a1..91b5d18 100644 --- a/docs/sqlglot/dialects/teradata.html +++ b/docs/sqlglot/dialects/teradata.html @@ -223,36 +223,37 @@ </span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> </span><span id="L-130"><a href="#L-130"><span class="linenos">130</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-131"><a href="#L-131"><span class="linenos">131</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-132"><a href="#L-132"><span class="linenos">132</span></a> <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="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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</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="c1"># FROM before SET in Teradata UPDATE syntax</span> -</span><span id="L-138"><a href="#L-138"><span class="linenos">138</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-139"><a href="#L-139"><span class="linenos">139</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> -</span><span id="L-141"><a href="#L-141"><span class="linenos">141</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">"from"</span><span class="p">)</span> -</span><span id="L-142"><a href="#L-142"><span class="linenos">142</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-143"><a href="#L-143"><span class="linenos">143</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">"where"</span><span class="p">)</span> -</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"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">"</span> -</span><span id="L-145"><a href="#L-145"><span class="linenos">145</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-146"><a href="#L-146"><span class="linenos">146</span></a> -</span><span id="L-147"><a href="#L-147"><span class="linenos">147</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-148"><a href="#L-148"><span class="linenos">148</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">"MOD"</span><span class="p">)</span> -</span><span id="L-149"><a href="#L-149"><span class="linenos">149</span></a> -</span><span id="L-150"><a href="#L-150"><span class="linenos">150</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-151"><a href="#L-151"><span class="linenos">151</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-152"><a href="#L-152"><span class="linenos">152</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">"prefix"</span><span class="p">)</span> -</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">"</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-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="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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> -</span><span id="L-157"><a href="#L-157"><span class="linenos">157</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-158"><a href="#L-158"><span class="linenos">158</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">"each"</span><span class="p">)</span> -</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">""</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="k">return</span> <span class="sa">f</span><span class="s2">"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">)"</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</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-133"><a href="#L-133"><span class="linenos">133</span></a> <span class="p">}</span> +</span><span id="L-134"><a href="#L-134"><span class="linenos">134</span></a> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</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-140"><a href="#L-140"><span class="linenos">140</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-141"><a href="#L-141"><span class="linenos">141</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-142"><a href="#L-142"><span class="linenos">142</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">"from"</span><span class="p">)</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</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-144"><a href="#L-144"><span class="linenos">144</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">"where"</span><span class="p">)</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"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">"</span> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</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-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="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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</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">"MOD"</span><span class="p">)</span> +</span><span id="L-150"><a href="#L-150"><span class="linenos">150</span></a> +</span><span id="L-151"><a href="#L-151"><span class="linenos">151</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-152"><a href="#L-152"><span class="linenos">152</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-153"><a href="#L-153"><span class="linenos">153</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">"prefix"</span><span class="p">)</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">"</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-155"><a href="#L-155"><span class="linenos">155</span></a> +</span><span id="L-156"><a href="#L-156"><span class="linenos">156</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="L-158"><a href="#L-158"><span class="linenos">158</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-159"><a href="#L-159"><span class="linenos">159</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">"each"</span><span class="p">)</span> +</span><span id="L-160"><a href="#L-160"><span class="linenos">160</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">)"</span> </span></pre></div> @@ -392,36 +393,37 @@ </span><span id="Teradata-130"><a href="#Teradata-130"><span class="linenos">130</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> </span><span id="Teradata-131"><a href="#Teradata-131"><span class="linenos">131</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-132"><a href="#Teradata-132"><span class="linenos">132</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-133"><a href="#Teradata-133"><span class="linenos">133</span></a> <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="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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata-136"><a href="#Teradata-136"><span class="linenos">136</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</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="c1"># FROM before SET in Teradata UPDATE syntax</span> -</span><span id="Teradata-139"><a href="#Teradata-139"><span class="linenos">139</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-140"><a href="#Teradata-140"><span class="linenos">140</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata-141"><a href="#Teradata-141"><span class="linenos">141</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> -</span><span id="Teradata-142"><a href="#Teradata-142"><span class="linenos">142</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">"from"</span><span class="p">)</span> -</span><span id="Teradata-143"><a href="#Teradata-143"><span class="linenos">143</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-144"><a href="#Teradata-144"><span class="linenos">144</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">"where"</span><span class="p">)</span> -</span><span id="Teradata-145"><a href="#Teradata-145"><span class="linenos">145</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"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">"</span> -</span><span id="Teradata-146"><a href="#Teradata-146"><span class="linenos">146</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-147"><a href="#Teradata-147"><span class="linenos">147</span></a> -</span><span id="Teradata-148"><a href="#Teradata-148"><span class="linenos">148</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata-149"><a href="#Teradata-149"><span class="linenos">149</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">"MOD"</span><span class="p">)</span> -</span><span id="Teradata-150"><a href="#Teradata-150"><span class="linenos">150</span></a> -</span><span id="Teradata-151"><a href="#Teradata-151"><span class="linenos">151</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata-152"><a href="#Teradata-152"><span class="linenos">152</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-153"><a href="#Teradata-153"><span class="linenos">153</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">"prefix"</span><span class="p">)</span> -</span><span id="Teradata-154"><a href="#Teradata-154"><span class="linenos">154</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">"</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-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="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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata-157"><a href="#Teradata-157"><span class="linenos">157</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> -</span><span id="Teradata-158"><a href="#Teradata-158"><span class="linenos">158</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-159"><a href="#Teradata-159"><span class="linenos">159</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">"each"</span><span class="p">)</span> -</span><span id="Teradata-160"><a href="#Teradata-160"><span class="linenos">160</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">""</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="k">return</span> <span class="sa">f</span><span class="s2">"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">)"</span> +</span><span id="Teradata-133"><a href="#Teradata-133"><span class="linenos">133</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-134"><a href="#Teradata-134"><span class="linenos">134</span></a> <span class="p">}</span> +</span><span id="Teradata-135"><a href="#Teradata-135"><span class="linenos">135</span></a> +</span><span id="Teradata-136"><a href="#Teradata-136"><span class="linenos">136</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata-137"><a href="#Teradata-137"><span class="linenos">137</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Teradata-138"><a href="#Teradata-138"><span class="linenos">138</span></a> +</span><span id="Teradata-139"><a href="#Teradata-139"><span class="linenos">139</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span> +</span><span id="Teradata-140"><a href="#Teradata-140"><span class="linenos">140</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-141"><a href="#Teradata-141"><span class="linenos">141</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata-142"><a href="#Teradata-142"><span class="linenos">142</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Teradata-143"><a href="#Teradata-143"><span class="linenos">143</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">"from"</span><span class="p">)</span> +</span><span id="Teradata-144"><a href="#Teradata-144"><span class="linenos">144</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-145"><a href="#Teradata-145"><span class="linenos">145</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">"where"</span><span class="p">)</span> +</span><span id="Teradata-146"><a href="#Teradata-146"><span class="linenos">146</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"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">"</span> +</span><span id="Teradata-147"><a href="#Teradata-147"><span class="linenos">147</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-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="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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata-150"><a href="#Teradata-150"><span class="linenos">150</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">"MOD"</span><span class="p">)</span> +</span><span id="Teradata-151"><a href="#Teradata-151"><span class="linenos">151</span></a> +</span><span id="Teradata-152"><a href="#Teradata-152"><span class="linenos">152</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata-153"><a href="#Teradata-153"><span class="linenos">153</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-154"><a href="#Teradata-154"><span class="linenos">154</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">"prefix"</span><span class="p">)</span> +</span><span id="Teradata-155"><a href="#Teradata-155"><span class="linenos">155</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">"</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-156"><a href="#Teradata-156"><span class="linenos">156</span></a> +</span><span id="Teradata-157"><a href="#Teradata-157"><span class="linenos">157</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata-158"><a href="#Teradata-158"><span class="linenos">158</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Teradata-159"><a href="#Teradata-159"><span class="linenos">159</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-160"><a href="#Teradata-160"><span class="linenos">160</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">"each"</span><span class="p">)</span> +</span><span id="Teradata-161"><a href="#Teradata-161"><span class="linenos">161</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Teradata-162"><a href="#Teradata-162"><span class="linenos">162</span></a> +</span><span id="Teradata-163"><a href="#Teradata-163"><span class="linenos">163</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">)"</span> </span></pre></div> @@ -437,6 +439,7 @@ <dd id="Teradata.parse_into" class="function"><a href="dialect.html#Dialect.parse_into">parse_into</a></dd> <dd id="Teradata.generate" class="function"><a href="dialect.html#Dialect.generate">generate</a></dd> <dd id="Teradata.transpile" class="function"><a href="dialect.html#Dialect.transpile">transpile</a></dd> + <dd id="Teradata.tokenize" class="function"><a href="dialect.html#Dialect.tokenize">tokenize</a></dd> <dd id="Teradata.parser" class="function"><a href="dialect.html#Dialect.parser">parser</a></dd> <dd id="Teradata.generator" class="function"><a href="dialect.html#Dialect.generator">generator</a></dd> @@ -659,36 +662,37 @@ Default: "nulls_are_small"</li> </span><span id="Teradata.Generator-130"><a href="#Teradata.Generator-130"><span class="linenos">130</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> </span><span id="Teradata.Generator-131"><a href="#Teradata.Generator-131"><span class="linenos">131</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-132"><a href="#Teradata.Generator-132"><span class="linenos">132</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-133"><a href="#Teradata.Generator-133"><span class="linenos">133</span></a> <span class="p">}</span> -</span><span id="Teradata.Generator-134"><a href="#Teradata.Generator-134"><span class="linenos">134</span></a> -</span><span id="Teradata.Generator-135"><a href="#Teradata.Generator-135"><span class="linenos">135</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata.Generator-136"><a href="#Teradata.Generator-136"><span class="linenos">136</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</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="c1"># FROM before SET in Teradata UPDATE syntax</span> -</span><span id="Teradata.Generator-139"><a href="#Teradata.Generator-139"><span class="linenos">139</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-140"><a href="#Teradata.Generator-140"><span class="linenos">140</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">-></span> <span class="nb">str</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">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> -</span><span id="Teradata.Generator-142"><a href="#Teradata.Generator-142"><span class="linenos">142</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">"from"</span><span class="p">)</span> -</span><span id="Teradata.Generator-143"><a href="#Teradata.Generator-143"><span class="linenos">143</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-144"><a href="#Teradata.Generator-144"><span class="linenos">144</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">"where"</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">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"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">"</span> -</span><span id="Teradata.Generator-146"><a href="#Teradata.Generator-146"><span class="linenos">146</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-147"><a href="#Teradata.Generator-147"><span class="linenos">147</span></a> -</span><span id="Teradata.Generator-148"><a href="#Teradata.Generator-148"><span class="linenos">148</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata.Generator-149"><a href="#Teradata.Generator-149"><span class="linenos">149</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">"MOD"</span><span class="p">)</span> -</span><span id="Teradata.Generator-150"><a href="#Teradata.Generator-150"><span class="linenos">150</span></a> -</span><span id="Teradata.Generator-151"><a href="#Teradata.Generator-151"><span class="linenos">151</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">-></span> <span class="nb">str</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">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-153"><a href="#Teradata.Generator-153"><span class="linenos">153</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">"prefix"</span><span class="p">)</span> -</span><span id="Teradata.Generator-154"><a href="#Teradata.Generator-154"><span class="linenos">154</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">"</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-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="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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata.Generator-157"><a href="#Teradata.Generator-157"><span class="linenos">157</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> -</span><span id="Teradata.Generator-158"><a href="#Teradata.Generator-158"><span class="linenos">158</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-159"><a href="#Teradata.Generator-159"><span class="linenos">159</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">"each"</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">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">""</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="k">return</span> <span class="sa">f</span><span class="s2">"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">)"</span> +</span><span id="Teradata.Generator-133"><a href="#Teradata.Generator-133"><span class="linenos">133</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-134"><a href="#Teradata.Generator-134"><span class="linenos">134</span></a> <span class="p">}</span> +</span><span id="Teradata.Generator-135"><a href="#Teradata.Generator-135"><span class="linenos">135</span></a> +</span><span id="Teradata.Generator-136"><a href="#Teradata.Generator-136"><span class="linenos">136</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata.Generator-137"><a href="#Teradata.Generator-137"><span class="linenos">137</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> +</span><span id="Teradata.Generator-138"><a href="#Teradata.Generator-138"><span class="linenos">138</span></a> +</span><span id="Teradata.Generator-139"><a href="#Teradata.Generator-139"><span class="linenos">139</span></a> <span class="c1"># FROM before SET in Teradata UPDATE syntax</span> +</span><span id="Teradata.Generator-140"><a href="#Teradata.Generator-140"><span class="linenos">140</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-141"><a href="#Teradata.Generator-141"><span class="linenos">141</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata.Generator-142"><a href="#Teradata.Generator-142"><span class="linenos">142</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Teradata.Generator-143"><a href="#Teradata.Generator-143"><span class="linenos">143</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">"from"</span><span class="p">)</span> +</span><span id="Teradata.Generator-144"><a href="#Teradata.Generator-144"><span class="linenos">144</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-145"><a href="#Teradata.Generator-145"><span class="linenos">145</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">"where"</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">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"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">"</span> +</span><span id="Teradata.Generator-147"><a href="#Teradata.Generator-147"><span class="linenos">147</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-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="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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata.Generator-150"><a href="#Teradata.Generator-150"><span class="linenos">150</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">"MOD"</span><span class="p">)</span> +</span><span id="Teradata.Generator-151"><a href="#Teradata.Generator-151"><span class="linenos">151</span></a> +</span><span id="Teradata.Generator-152"><a href="#Teradata.Generator-152"><span class="linenos">152</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">-></span> <span class="nb">str</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">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-154"><a href="#Teradata.Generator-154"><span class="linenos">154</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">"prefix"</span><span class="p">)</span> +</span><span id="Teradata.Generator-155"><a href="#Teradata.Generator-155"><span class="linenos">155</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">"</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-156"><a href="#Teradata.Generator-156"><span class="linenos">156</span></a> +</span><span id="Teradata.Generator-157"><a href="#Teradata.Generator-157"><span class="linenos">157</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">-></span> <span class="nb">str</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">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Teradata.Generator-159"><a href="#Teradata.Generator-159"><span class="linenos">159</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-160"><a href="#Teradata.Generator-160"><span class="linenos">160</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">"each"</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">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Teradata.Generator-162"><a href="#Teradata.Generator-162"><span class="linenos">162</span></a> +</span><span id="Teradata.Generator-163"><a href="#Teradata.Generator-163"><span class="linenos">163</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">)"</span> </span></pre></div> @@ -705,8 +709,7 @@ represents a python time format and the output the target time format</li> <li><strong>quote_end (str):</strong> specifies which ending character to use to delimit quotes. Default: '.</li> <li><strong>identifier_start (str):</strong> specifies which starting character to use to delimit identifiers. Default: ".</li> <li><strong>identifier_end (str):</strong> specifies which ending character to use to delimit identifiers. Default: ".</li> -<li><strong>identify (bool):</strong> if set to True all identifiers will be delimited by the corresponding -character.</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> @@ -748,8 +751,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-135"><a href="#Teradata.Generator.partitionedbyproperty_sql-135"><span class="linenos">135</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata.Generator.partitionedbyproperty_sql-136"><a href="#Teradata.Generator.partitionedbyproperty_sql-136"><span class="linenos">136</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.partitionedbyproperty_sql-136"><a href="#Teradata.Generator.partitionedbyproperty_sql-136"><span class="linenos">136</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata.Generator.partitionedbyproperty_sql-137"><a href="#Teradata.Generator.partitionedbyproperty_sql-137"><span class="linenos">137</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">"</span> </span></pre></div> @@ -767,13 +770,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-140"><a href="#Teradata.Generator.update_sql-140"><span class="linenos">140</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata.Generator.update_sql-141"><a href="#Teradata.Generator.update_sql-141"><span class="linenos">141</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> -</span><span id="Teradata.Generator.update_sql-142"><a href="#Teradata.Generator.update_sql-142"><span class="linenos">142</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">"from"</span><span class="p">)</span> -</span><span id="Teradata.Generator.update_sql-143"><a href="#Teradata.Generator.update_sql-143"><span class="linenos">143</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-144"><a href="#Teradata.Generator.update_sql-144"><span class="linenos">144</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">"where"</span><span class="p">)</span> -</span><span id="Teradata.Generator.update_sql-145"><a href="#Teradata.Generator.update_sql-145"><span class="linenos">145</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"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">"</span> -</span><span id="Teradata.Generator.update_sql-146"><a href="#Teradata.Generator.update_sql-146"><span class="linenos">146</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-141"><a href="#Teradata.Generator.update_sql-141"><span class="linenos">141</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata.Generator.update_sql-142"><a href="#Teradata.Generator.update_sql-142"><span class="linenos">142</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Teradata.Generator.update_sql-143"><a href="#Teradata.Generator.update_sql-143"><span class="linenos">143</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">"from"</span><span class="p">)</span> +</span><span id="Teradata.Generator.update_sql-144"><a href="#Teradata.Generator.update_sql-144"><span class="linenos">144</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-145"><a href="#Teradata.Generator.update_sql-145"><span class="linenos">145</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">"where"</span><span class="p">)</span> +</span><span id="Teradata.Generator.update_sql-146"><a href="#Teradata.Generator.update_sql-146"><span class="linenos">146</span></a> <span class="n">sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"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">"</span> +</span><span id="Teradata.Generator.update_sql-147"><a href="#Teradata.Generator.update_sql-147"><span class="linenos">147</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> @@ -791,8 +794,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-148"><a href="#Teradata.Generator.mod_sql-148"><span class="linenos">148</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata.Generator.mod_sql-149"><a href="#Teradata.Generator.mod_sql-149"><span class="linenos">149</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">"MOD"</span><span class="p">)</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.mod_sql-149"><a href="#Teradata.Generator.mod_sql-149"><span class="linenos">149</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata.Generator.mod_sql-150"><a href="#Teradata.Generator.mod_sql-150"><span class="linenos">150</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">"MOD"</span><span class="p">)</span> </span></pre></div> @@ -810,10 +813,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-151"><a href="#Teradata.Generator.datatype_sql-151"><span class="linenos">151</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata.Generator.datatype_sql-152"><a href="#Teradata.Generator.datatype_sql-152"><span class="linenos">152</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-153"><a href="#Teradata.Generator.datatype_sql-153"><span class="linenos">153</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">"prefix"</span><span class="p">)</span> -</span><span id="Teradata.Generator.datatype_sql-154"><a href="#Teradata.Generator.datatype_sql-154"><span class="linenos">154</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">"</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-152"><a href="#Teradata.Generator.datatype_sql-152"><span class="linenos">152</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata.Generator.datatype_sql-153"><a href="#Teradata.Generator.datatype_sql-153"><span class="linenos">153</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-154"><a href="#Teradata.Generator.datatype_sql-154"><span class="linenos">154</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">"prefix"</span><span class="p">)</span> +</span><span id="Teradata.Generator.datatype_sql-155"><a href="#Teradata.Generator.datatype_sql-155"><span class="linenos">155</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"SYSUDTLIB.</span><span class="si">{</span><span class="n">type_sql</span><span class="si">}</span><span class="s2">"</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> @@ -831,13 +834,13 @@ 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-156"><a href="#Teradata.Generator.rangen_sql-156"><span class="linenos">156</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">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Teradata.Generator.rangen_sql-157"><a href="#Teradata.Generator.rangen_sql-157"><span class="linenos">157</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> -</span><span id="Teradata.Generator.rangen_sql-158"><a href="#Teradata.Generator.rangen_sql-158"><span class="linenos">158</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-159"><a href="#Teradata.Generator.rangen_sql-159"><span class="linenos">159</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">"each"</span><span class="p">)</span> -</span><span id="Teradata.Generator.rangen_sql-160"><a href="#Teradata.Generator.rangen_sql-160"><span class="linenos">160</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">""</span> -</span><span id="Teradata.Generator.rangen_sql-161"><a href="#Teradata.Generator.rangen_sql-161"><span class="linenos">161</span></a> -</span><span id="Teradata.Generator.rangen_sql-162"><a href="#Teradata.Generator.rangen_sql-162"><span class="linenos">162</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">)"</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Teradata.Generator.rangen_sql-157"><a href="#Teradata.Generator.rangen_sql-157"><span class="linenos">157</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">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Teradata.Generator.rangen_sql-158"><a href="#Teradata.Generator.rangen_sql-158"><span class="linenos">158</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="s2">"this"</span><span class="p">)</span> +</span><span id="Teradata.Generator.rangen_sql-159"><a href="#Teradata.Generator.rangen_sql-159"><span class="linenos">159</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-160"><a href="#Teradata.Generator.rangen_sql-160"><span class="linenos">160</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">"each"</span><span class="p">)</span> +</span><span id="Teradata.Generator.rangen_sql-161"><a href="#Teradata.Generator.rangen_sql-161"><span class="linenos">161</span></a> <span class="n">each_sql</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">" EACH </span><span class="si">{</span><span class="n">each_sql</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">each_sql</span> <span class="k">else</span> <span class="s2">""</span> +</span><span id="Teradata.Generator.rangen_sql-162"><a href="#Teradata.Generator.rangen_sql-162"><span class="linenos">162</span></a> +</span><span id="Teradata.Generator.rangen_sql-163"><a href="#Teradata.Generator.rangen_sql-163"><span class="linenos">163</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"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">)"</span> </span></pre></div> @@ -932,6 +935,8 @@ Default: True</li> <dd id="Teradata.Generator.lateral_sql" class="function"><a href="../generator.html#Generator.lateral_sql">lateral_sql</a></dd> <dd id="Teradata.Generator.limit_sql" class="function"><a href="../generator.html#Generator.limit_sql">limit_sql</a></dd> <dd id="Teradata.Generator.offset_sql" class="function"><a href="../generator.html#Generator.offset_sql">offset_sql</a></dd> + <dd id="Teradata.Generator.setitem_sql" class="function"><a href="../generator.html#Generator.setitem_sql">setitem_sql</a></dd> + <dd id="Teradata.Generator.set_sql" class="function"><a href="../generator.html#Generator.set_sql">set_sql</a></dd> <dd id="Teradata.Generator.lock_sql" class="function"><a href="../generator.html#Generator.lock_sql">lock_sql</a></dd> <dd id="Teradata.Generator.literal_sql" class="function"><a href="../generator.html#Generator.literal_sql">literal_sql</a></dd> <dd id="Teradata.Generator.loaddata_sql" class="function"><a href="../generator.html#Generator.loaddata_sql">loaddata_sql</a></dd> @@ -1016,7 +1021,6 @@ Default: True</li> <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.div_sql" class="function"><a href="../generator.html#Generator.div_sql">div_sql</a></dd> - <dd id="Teradata.Generator.floatdiv_sql" class="function"><a href="../generator.html#Generator.floatdiv_sql">floatdiv_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> <dd id="Teradata.Generator.dot_sql" class="function"><a href="../generator.html#Generator.dot_sql">dot_sql</a></dd> @@ -1057,6 +1061,7 @@ Default: True</li> <dd id="Teradata.Generator.kwarg_sql" class="function"><a href="../generator.html#Generator.kwarg_sql">kwarg_sql</a></dd> <dd id="Teradata.Generator.when_sql" class="function"><a href="../generator.html#Generator.when_sql">when_sql</a></dd> <dd id="Teradata.Generator.merge_sql" class="function"><a href="../generator.html#Generator.merge_sql">merge_sql</a></dd> + <dd id="Teradata.Generator.tochar_sql" class="function"><a href="../generator.html#Generator.tochar_sql">tochar_sql</a></dd> </div> </dl> |