diff options
Diffstat (limited to 'docs/sqlglot/dialects/redshift.html')
-rw-r--r-- | docs/sqlglot/dialects/redshift.html | 2230 |
1 files changed, 1139 insertions, 1091 deletions
diff --git a/docs/sqlglot/dialects/redshift.html b/docs/sqlglot/dialects/redshift.html index af19565..9e3103d 100644 --- a/docs/sqlglot/dialects/redshift.html +++ b/docs/sqlglot/dialects/redshift.html @@ -46,6 +46,9 @@ <a class="variable" href="#Redshift.COPY_PARAMS_ARE_CSV">COPY_PARAMS_ARE_CSV</a> </li> <li> + <a class="variable" href="#Redshift.HEX_LOWERCASE">HEX_LOWERCASE</a> + </li> + <li> <a class="variable" href="#Redshift.TIME_FORMAT">TIME_FORMAT</a> </li> <li> @@ -124,6 +127,9 @@ <a class="variable" href="#Redshift.Generator.COPY_PARAMS_ARE_WRAPPED">COPY_PARAMS_ARE_WRAPPED</a> </li> <li> + <a class="variable" href="#Redshift.Generator.HEX_FUNC">HEX_FUNC</a> + </li> + <li> <a class="variable" href="#Redshift.Generator.TYPE_MAPPING">TYPE_MAPPING</a> </li> <li> @@ -286,365 +292,368 @@ </span><span id="L-39"><a href="#L-39"><span class="linenos"> 39</span></a> <span class="n">SUPPORTS_USER_DEFINED_TYPES</span> <span class="o">=</span> <span class="kc">False</span> </span><span id="L-40"><a href="#L-40"><span class="linenos"> 40</span></a> <span class="n">INDEX_OFFSET</span> <span class="o">=</span> <span class="mi">0</span> </span><span id="L-41"><a href="#L-41"><span class="linenos"> 41</span></a> <span class="n">COPY_PARAMS_ARE_CSV</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> -</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> <span class="n">TIME_FORMAT</span> <span class="o">=</span> <span class="s2">"'YYYY-MM-DD HH:MI:SS'"</span> -</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="n">TIME_MAPPING</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">TIME_MAPPING</span><span class="p">,</span> -</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="s2">"MON"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> -</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> -</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="p">}</span> -</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> -</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> -</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> -</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="s2">"ADD_MONTHS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">(</span> -</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> -</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> -</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"month"</span><span class="p">),</span> -</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="n">return_type</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">build</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">),</span> -</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="p">),</span> -</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="s2">"DATEADD"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">),</span> -</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">),</span> -</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">),</span> -</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">),</span> -</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="s2">"GETDATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="s2">"LISTAGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="s2">"STRTOL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">FromBase</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="p">}</span> -</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> -</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> <span class="n">NO_PAREN_FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTION_PARSERS</span><span class="p">,</span> -</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="s2">"APPROXIMATE"</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_approximate_count</span><span class="p">(),</span> -</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="s2">"SYSDATE"</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">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">,</span> <span class="n">transaction</span><span class="o">=</span><span class="kc">True</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">SUPPORTS_IMPLICIT_UNNEST</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> -</span><span id="L-76"><a href="#L-76"><span class="linenos"> 76</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> -</span><span id="L-77"><a href="#L-77"><span class="linenos"> 77</span></a> <span class="bp">self</span><span class="p">,</span> -</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">joins</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> -</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">parse_bracket</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">is_db_reference</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="n">parse_partition</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> -</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="c1"># Redshift supports UNPIVOTing SUPER objects, e.g. `UNPIVOT foo.obj[0] AS val AT attr`</span> -</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="n">unpivot</span> <span class="o">=</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">UNPIVOT</span><span class="p">)</span> -</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">table</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span> -</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> -</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">joins</span><span class="o">=</span><span class="n">joins</span><span class="p">,</span> -</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">,</span> -</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">parse_bracket</span><span class="o">=</span><span class="n">parse_bracket</span><span class="p">,</span> -</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">is_db_reference</span><span class="o">=</span><span class="n">is_db_reference</span><span class="p">,</span> -</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="p">)</span> -</span><span id="L-94"><a href="#L-94"><span class="linenos"> 94</span></a> -</span><span id="L-95"><a href="#L-95"><span class="linenos"> 95</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">Pivot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">unpivot</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="k">if</span> <span class="n">unpivot</span> <span class="k">else</span> <span class="n">table</span> -</span><span id="L-96"><a href="#L-96"><span class="linenos"> 96</span></a> -</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> <span class="k">def</span> <span class="nf">_parse_convert</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="p">,</span> <span class="n">strict</span><span class="p">:</span> <span class="nb">bool</span><span class="p">,</span> <span class="n">safe</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> -</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> -</span><span id="L-101"><a href="#L-101"><span class="linenos">101</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">COMMA</span><span class="p">)</span> -</span><span id="L-102"><a href="#L-102"><span class="linenos">102</span></a> <span class="n">this</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_bitwise</span><span class="p">()</span> -</span><span id="L-103"><a href="#L-103"><span class="linenos">103</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">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 class="n">safe</span><span class="o">=</span><span class="n">safe</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">def</span> <span class="nf">_parse_approximate_count</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">]:</span> -</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">-</span> <span class="mi">1</span> -</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="n">func</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> -</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> -</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> -</span><span id="L-110"><a href="#L-110"><span class="linenos">110</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">ApproxDistinct</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> -</span><span id="L-111"><a href="#L-111"><span class="linenos">111</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> -</span><span id="L-112"><a href="#L-112"><span class="linenos">112</span></a> <span class="k">return</span> <span class="kc">None</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">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> -</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="n">BIT_STRINGS</span> <span class="o">=</span> <span class="p">[]</span> -</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[]</span> -</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">]</span> -</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> -</span><span id="L-119"><a href="#L-119"><span class="linenos">119</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-120"><a href="#L-120"><span class="linenos">120</span></a> <span class="o">**</span><span class="n">Postgres</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-121"><a href="#L-121"><span class="linenos">121</span></a> <span class="s2">"HLLSKETCH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HLLSKETCH</span><span class="p">,</span> -</span><span id="L-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="s2">"SUPER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SUPER</span><span class="p">,</span> -</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="s2">"TOP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> -</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="s2">"UNLOAD"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> -</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="s2">"VARBYTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> -</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="p">}</span> -</span><span id="L-127"><a href="#L-127"><span class="linenos">127</span></a> <span class="n">KEYWORDS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"VALUES"</span><span class="p">)</span> -</span><span id="L-128"><a href="#L-128"><span class="linenos">128</span></a> -</span><span id="L-129"><a href="#L-129"><span class="linenos">129</span></a> <span class="c1"># Redshift allows # to appear as a table identifier prefix</span> -</span><span id="L-130"><a href="#L-130"><span class="linenos">130</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> -</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"#"</span><span class="p">)</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">Postgres</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">LOCKING_READS_SUPPORTED</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">QUERY_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="n">VALUES_AS_TABLE</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">TZ_TO_WITH_TIME_ZONE</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="n">NVL2_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">LAST_DAY_SUPPORTS_DATE_PART</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">CAN_IMPLEMENT_ARRAY_ANY</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">MULTI_ARG_DISTINCT</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="L-142"><a href="#L-142"><span class="linenos">142</span></a> <span class="n">COPY_PARAMS_ARE_WRAPPED</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> -</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> <span class="o">**</span><span class="n">Postgres</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-146"><a href="#L-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">BINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> -</span><span id="L-147"><a href="#L-147"><span class="linenos">147</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">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> -</span><span id="L-148"><a href="#L-148"><span class="linenos">148</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">TIMETZ</span><span class="p">:</span> <span class="s2">"TIME"</span><span class="p">,</span> -</span><span id="L-149"><a href="#L-149"><span class="linenos">149</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">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</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">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</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">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ROWVERSION</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> -</span><span id="L-152"><a href="#L-152"><span class="linenos">152</span></a> <span class="p">}</span> -</span><span id="L-153"><a href="#L-153"><span class="linenos">153</span></a> -</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-155"><a href="#L-155"><span class="linenos">155</span></a> <span class="o">**</span><span class="n">Postgres</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-156"><a href="#L-156"><span class="linenos">156</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">:</span> <span class="n">concat_to_dpipe_sql</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">ConcatWs</span><span class="p">:</span> <span class="n">concat_ws_to_dpipe_sql</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">ApproxDistinct</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> -</span><span id="L-159"><a href="#L-159"><span class="linenos">159</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"APPROXIMATE COUNT(DISTINCT </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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</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">CurrentTimestamp</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="p">(</span> -</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="s2">"SYSDATE"</span> <span class="k">if</span> <span class="n">e</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">"transaction"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"GETDATE()"</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 class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> -</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> -</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</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">func</span><span class="p">(</span><span class="s2">"DISTKEY"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> -</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</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">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> -</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FromBase</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRTOL"</span><span class="p">),</span> -</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">:</span> <span class="n">generatedasidentitycolumnconstraint_sql</span><span class="p">,</span> -</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">json_extract_segments</span><span class="p">(</span><span class="s2">"JSON_EXTRACT_PATH_TEXT"</span><span class="p">),</span> -</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">json_extract_segments</span><span class="p">(</span><span class="s2">"JSON_EXTRACT_PATH_TEXT"</span><span class="p">),</span> -</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LISTAGG"</span><span class="p">),</span> -</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ParseJSON</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"JSON_PARSE"</span><span class="p">),</span> -</span><span id="L-173"><a href="#L-173"><span class="linenos">173</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><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="p">[</span> -</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">,</span> -</span><span id="L-176"><a href="#L-176"><span class="linenos">176</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_semi_and_anti_joins</span><span class="p">,</span> -</span><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">unqualify_unnest</span><span class="p">,</span> -</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="p">]</span> -</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="p">),</span> -</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> -</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'COMPOUND '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'compound'</span><span class="p">]</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">SORTKEY(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StartsWith</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> -</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</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="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2"> LIKE </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="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> || '%'"</span><span class="p">,</span> -</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> -</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> -</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> -</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> -</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"(TIMESTAMP 'epoch' + </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="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2"> * INTERVAL '1 SECOND')"</span><span class="p">,</span> -</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="p">}</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="c1"># Postgres maps exp.Pivot to no_pivot_sql, but Redshift support pivots</span> -</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">)</span> +</span><span id="L-42"><a href="#L-42"><span class="linenos"> 42</span></a> <span class="n">HEX_LOWERCASE</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-43"><a href="#L-43"><span class="linenos"> 43</span></a> +</span><span id="L-44"><a href="#L-44"><span class="linenos"> 44</span></a> <span class="n">TIME_FORMAT</span> <span class="o">=</span> <span class="s2">"'YYYY-MM-DD HH:MI:SS'"</span> +</span><span id="L-45"><a href="#L-45"><span class="linenos"> 45</span></a> <span class="n">TIME_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-46"><a href="#L-46"><span class="linenos"> 46</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">TIME_MAPPING</span><span class="p">,</span> +</span><span id="L-47"><a href="#L-47"><span class="linenos"> 47</span></a> <span class="s2">"MON"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="L-48"><a href="#L-48"><span class="linenos"> 48</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="L-49"><a href="#L-49"><span class="linenos"> 49</span></a> <span class="p">}</span> +</span><span id="L-50"><a href="#L-50"><span class="linenos"> 50</span></a> +</span><span id="L-51"><a href="#L-51"><span class="linenos"> 51</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="L-52"><a href="#L-52"><span class="linenos"> 52</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-53"><a href="#L-53"><span class="linenos"> 53</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="L-54"><a href="#L-54"><span class="linenos"> 54</span></a> <span class="s2">"ADD_MONTHS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">(</span> +</span><span id="L-55"><a href="#L-55"><span class="linenos"> 55</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="L-56"><a href="#L-56"><span class="linenos"> 56</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="L-57"><a href="#L-57"><span class="linenos"> 57</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"month"</span><span class="p">),</span> +</span><span id="L-58"><a href="#L-58"><span class="linenos"> 58</span></a> <span class="n">return_type</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">build</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">),</span> +</span><span id="L-59"><a href="#L-59"><span class="linenos"> 59</span></a> <span class="p">),</span> +</span><span id="L-60"><a href="#L-60"><span class="linenos"> 60</span></a> <span class="s2">"DATEADD"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">),</span> +</span><span id="L-61"><a href="#L-61"><span class="linenos"> 61</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">),</span> +</span><span id="L-62"><a href="#L-62"><span class="linenos"> 62</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">),</span> +</span><span id="L-63"><a href="#L-63"><span class="linenos"> 63</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">),</span> +</span><span id="L-64"><a href="#L-64"><span class="linenos"> 64</span></a> <span class="s2">"GETDATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-65"><a href="#L-65"><span class="linenos"> 65</span></a> <span class="s2">"LISTAGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-66"><a href="#L-66"><span class="linenos"> 66</span></a> <span class="s2">"STRTOL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">FromBase</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="L-67"><a href="#L-67"><span class="linenos"> 67</span></a> <span class="p">}</span> +</span><span id="L-68"><a href="#L-68"><span class="linenos"> 68</span></a> +</span><span id="L-69"><a href="#L-69"><span class="linenos"> 69</span></a> <span class="n">NO_PAREN_FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-70"><a href="#L-70"><span class="linenos"> 70</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTION_PARSERS</span><span class="p">,</span> +</span><span id="L-71"><a href="#L-71"><span class="linenos"> 71</span></a> <span class="s2">"APPROXIMATE"</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_approximate_count</span><span class="p">(),</span> +</span><span id="L-72"><a href="#L-72"><span class="linenos"> 72</span></a> <span class="s2">"SYSDATE"</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">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">,</span> <span class="n">transaction</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="L-73"><a href="#L-73"><span class="linenos"> 73</span></a> <span class="p">}</span> +</span><span id="L-74"><a href="#L-74"><span class="linenos"> 74</span></a> +</span><span id="L-75"><a href="#L-75"><span class="linenos"> 75</span></a> <span class="n">SUPPORTS_IMPLICIT_UNNEST</span> <span class="o">=</span> <span class="kc">True</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="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> +</span><span id="L-78"><a href="#L-78"><span class="linenos"> 78</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-79"><a href="#L-79"><span class="linenos"> 79</span></a> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-80"><a href="#L-80"><span class="linenos"> 80</span></a> <span class="n">joins</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-81"><a href="#L-81"><span class="linenos"> 81</span></a> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="L-82"><a href="#L-82"><span class="linenos"> 82</span></a> <span class="n">parse_bracket</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-83"><a href="#L-83"><span class="linenos"> 83</span></a> <span class="n">is_db_reference</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-84"><a href="#L-84"><span class="linenos"> 84</span></a> <span class="n">parse_partition</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="L-85"><a href="#L-85"><span class="linenos"> 85</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-86"><a href="#L-86"><span class="linenos"> 86</span></a> <span class="c1"># Redshift supports UNPIVOTing SUPER objects, e.g. `UNPIVOT foo.obj[0] AS val AT attr`</span> +</span><span id="L-87"><a href="#L-87"><span class="linenos"> 87</span></a> <span class="n">unpivot</span> <span class="o">=</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">UNPIVOT</span><span class="p">)</span> +</span><span id="L-88"><a href="#L-88"><span class="linenos"> 88</span></a> <span class="n">table</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span> +</span><span id="L-89"><a href="#L-89"><span class="linenos"> 89</span></a> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> +</span><span id="L-90"><a href="#L-90"><span class="linenos"> 90</span></a> <span class="n">joins</span><span class="o">=</span><span class="n">joins</span><span class="p">,</span> +</span><span id="L-91"><a href="#L-91"><span class="linenos"> 91</span></a> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">,</span> +</span><span id="L-92"><a href="#L-92"><span class="linenos"> 92</span></a> <span class="n">parse_bracket</span><span class="o">=</span><span class="n">parse_bracket</span><span class="p">,</span> +</span><span id="L-93"><a href="#L-93"><span class="linenos"> 93</span></a> <span class="n">is_db_reference</span><span class="o">=</span><span class="n">is_db_reference</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="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">Pivot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">unpivot</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="k">if</span> <span class="n">unpivot</span> <span class="k">else</span> <span class="n">table</span> +</span><span id="L-97"><a href="#L-97"><span class="linenos"> 97</span></a> +</span><span id="L-98"><a href="#L-98"><span class="linenos"> 98</span></a> <span class="k">def</span> <span class="nf">_parse_convert</span><span class="p">(</span> +</span><span id="L-99"><a href="#L-99"><span class="linenos"> 99</span></a> <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="n">safe</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="L-100"><a href="#L-100"><span class="linenos">100</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="L-101"><a href="#L-101"><span class="linenos">101</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="L-102"><a href="#L-102"><span class="linenos">102</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">COMMA</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_bitwise</span><span class="p">()</span> +</span><span id="L-104"><a href="#L-104"><span class="linenos">104</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">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 class="n">safe</span><span class="o">=</span><span class="n">safe</span><span class="p">)</span> +</span><span id="L-105"><a href="#L-105"><span class="linenos">105</span></a> +</span><span id="L-106"><a href="#L-106"><span class="linenos">106</span></a> <span class="k">def</span> <span class="nf">_parse_approximate_count</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">]:</span> +</span><span id="L-107"><a href="#L-107"><span class="linenos">107</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">-</span> <span class="mi">1</span> +</span><span id="L-108"><a href="#L-108"><span class="linenos">108</span></a> <span class="n">func</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> +</span><span id="L-109"><a href="#L-109"><span class="linenos">109</span></a> +</span><span id="L-110"><a href="#L-110"><span class="linenos">110</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> +</span><span id="L-111"><a href="#L-111"><span class="linenos">111</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">ApproxDistinct</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</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">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="L-113"><a href="#L-113"><span class="linenos">113</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="L-114"><a href="#L-114"><span class="linenos">114</span></a> +</span><span id="L-115"><a href="#L-115"><span class="linenos">115</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="L-116"><a href="#L-116"><span class="linenos">116</span></a> <span class="n">BIT_STRINGS</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-117"><a href="#L-117"><span class="linenos">117</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="L-118"><a href="#L-118"><span class="linenos">118</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">,</span> <span class="s2">"'"</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">KEYWORDS</span> <span class="o">=</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="n">Postgres</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-122"><a href="#L-122"><span class="linenos">122</span></a> <span class="s2">"HLLSKETCH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HLLSKETCH</span><span class="p">,</span> +</span><span id="L-123"><a href="#L-123"><span class="linenos">123</span></a> <span class="s2">"SUPER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SUPER</span><span class="p">,</span> +</span><span id="L-124"><a href="#L-124"><span class="linenos">124</span></a> <span class="s2">"TOP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> +</span><span id="L-125"><a href="#L-125"><span class="linenos">125</span></a> <span class="s2">"UNLOAD"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="L-126"><a href="#L-126"><span class="linenos">126</span></a> <span class="s2">"VARBYTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</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="n">KEYWORDS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"VALUES"</span><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="c1"># Redshift allows # to appear as a table identifier prefix</span> +</span><span id="L-131"><a href="#L-131"><span class="linenos">131</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="L-132"><a href="#L-132"><span class="linenos">132</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"#"</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="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="L-135"><a href="#L-135"><span class="linenos">135</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-136"><a href="#L-136"><span class="linenos">136</span></a> <span class="n">QUERY_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-137"><a href="#L-137"><span class="linenos">137</span></a> <span class="n">VALUES_AS_TABLE</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-138"><a href="#L-138"><span class="linenos">138</span></a> <span class="n">TZ_TO_WITH_TIME_ZONE</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-139"><a href="#L-139"><span class="linenos">139</span></a> <span class="n">NVL2_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-140"><a href="#L-140"><span class="linenos">140</span></a> <span class="n">LAST_DAY_SUPPORTS_DATE_PART</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">CAN_IMPLEMENT_ARRAY_ANY</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 class="n">MULTI_ARG_DISTINCT</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="L-143"><a href="#L-143"><span class="linenos">143</span></a> <span class="n">COPY_PARAMS_ARE_WRAPPED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="L-144"><a href="#L-144"><span class="linenos">144</span></a> <span class="n">HEX_FUNC</span> <span class="o">=</span> <span class="s2">"TO_HEX"</span> +</span><span id="L-145"><a href="#L-145"><span class="linenos">145</span></a> +</span><span id="L-146"><a href="#L-146"><span class="linenos">146</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-147"><a href="#L-147"><span class="linenos">147</span></a> <span class="o">**</span><span class="n">Postgres</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-148"><a href="#L-148"><span class="linenos">148</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">BINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="L-149"><a href="#L-149"><span class="linenos">149</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">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</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">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMETZ</span><span class="p">:</span> <span class="s2">"TIME"</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">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</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">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</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">DataType</span><span class="o">.</span><span class="n">Type</span><span class="o">.</span><span class="n">ROWVERSION</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="L-154"><a href="#L-154"><span class="linenos">154</span></a> <span class="p">}</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="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-157"><a href="#L-157"><span class="linenos">157</span></a> <span class="o">**</span><span class="n">Postgres</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-158"><a href="#L-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">:</span> <span class="n">concat_to_dpipe_sql</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">ConcatWs</span><span class="p">:</span> <span class="n">concat_ws_to_dpipe_sql</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">ApproxDistinct</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-161"><a href="#L-161"><span class="linenos">161</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"APPROXIMATE COUNT(DISTINCT </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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-162"><a href="#L-162"><span class="linenos">162</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</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="p">(</span> +</span><span id="L-163"><a href="#L-163"><span class="linenos">163</span></a> <span class="s2">"SYSDATE"</span> <span class="k">if</span> <span class="n">e</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">"transaction"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"GETDATE()"</span> +</span><span id="L-164"><a href="#L-164"><span class="linenos">164</span></a> <span class="p">),</span> +</span><span id="L-165"><a href="#L-165"><span class="linenos">165</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> +</span><span id="L-166"><a href="#L-166"><span class="linenos">166</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> +</span><span id="L-167"><a href="#L-167"><span class="linenos">167</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</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">func</span><span class="p">(</span><span class="s2">"DISTKEY"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> +</span><span id="L-168"><a href="#L-168"><span class="linenos">168</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</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">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="L-169"><a href="#L-169"><span class="linenos">169</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FromBase</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRTOL"</span><span class="p">),</span> +</span><span id="L-170"><a href="#L-170"><span class="linenos">170</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">:</span> <span class="n">generatedasidentitycolumnconstraint_sql</span><span class="p">,</span> +</span><span id="L-171"><a href="#L-171"><span class="linenos">171</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">json_extract_segments</span><span class="p">(</span><span class="s2">"JSON_EXTRACT_PATH_TEXT"</span><span class="p">),</span> +</span><span id="L-172"><a href="#L-172"><span class="linenos">172</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">json_extract_segments</span><span class="p">(</span><span class="s2">"JSON_EXTRACT_PATH_TEXT"</span><span class="p">),</span> +</span><span id="L-173"><a href="#L-173"><span class="linenos">173</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LISTAGG"</span><span class="p">),</span> +</span><span id="L-174"><a href="#L-174"><span class="linenos">174</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</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">func</span><span class="p">(</span><span class="s2">"UPPER"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">"TO_HEX"</span><span class="p">,</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="s2">"this"</span><span class="p">))),</span> +</span><span id="L-175"><a href="#L-175"><span class="linenos">175</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ParseJSON</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"JSON_PARSE"</span><span class="p">),</span> +</span><span id="L-176"><a href="#L-176"><span class="linenos">176</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><span id="L-177"><a href="#L-177"><span class="linenos">177</span></a> <span class="p">[</span> +</span><span id="L-178"><a href="#L-178"><span class="linenos">178</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">,</span> +</span><span id="L-179"><a href="#L-179"><span class="linenos">179</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_semi_and_anti_joins</span><span class="p">,</span> +</span><span id="L-180"><a href="#L-180"><span class="linenos">180</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">unqualify_unnest</span><span class="p">,</span> +</span><span id="L-181"><a href="#L-181"><span class="linenos">181</span></a> <span class="p">]</span> +</span><span id="L-182"><a href="#L-182"><span class="linenos">182</span></a> <span class="p">),</span> +</span><span id="L-183"><a href="#L-183"><span class="linenos">183</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-184"><a href="#L-184"><span class="linenos">184</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'COMPOUND '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'compound'</span><span class="p">]</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">SORTKEY(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="L-185"><a href="#L-185"><span class="linenos">185</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StartsWith</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-186"><a href="#L-186"><span class="linenos">186</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</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="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2"> LIKE </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="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> || '%'"</span><span class="p">,</span> +</span><span id="L-187"><a href="#L-187"><span class="linenos">187</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="L-188"><a href="#L-188"><span class="linenos">188</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> +</span><span id="L-189"><a href="#L-189"><span class="linenos">189</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> +</span><span id="L-190"><a href="#L-190"><span class="linenos">190</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> +</span><span id="L-191"><a href="#L-191"><span class="linenos">191</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"(TIMESTAMP 'epoch' + </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="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2"> * INTERVAL '1 SECOND')"</span><span class="p">,</span> +</span><span id="L-192"><a href="#L-192"><span class="linenos">192</span></a> <span class="p">}</span> </span><span id="L-193"><a href="#L-193"><span class="linenos">193</span></a> -</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="c1"># Redshift uses the POW | POWER (expr1, expr2) syntax instead of expr1 ^ expr2 (postgres)</span> -</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">)</span> +</span><span id="L-194"><a href="#L-194"><span class="linenos">194</span></a> <span class="c1"># Postgres maps exp.Pivot to no_pivot_sql, but Redshift support pivots</span> +</span><span id="L-195"><a href="#L-195"><span class="linenos">195</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">)</span> </span><span id="L-196"><a href="#L-196"><span class="linenos">196</span></a> -</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="c1"># Redshift supports ANY_VALUE(..)</span> -</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="p">)</span> +</span><span id="L-197"><a href="#L-197"><span class="linenos">197</span></a> <span class="c1"># Redshift uses the POW | POWER (expr1, expr2) syntax instead of expr1 ^ expr2 (postgres)</span> +</span><span id="L-198"><a href="#L-198"><span class="linenos">198</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">)</span> </span><span id="L-199"><a href="#L-199"><span class="linenos">199</span></a> -</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="c1"># Redshift supports LAST_DAY(..)</span> -</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LastDay</span><span class="p">)</span> +</span><span id="L-200"><a href="#L-200"><span class="linenos">200</span></a> <span class="c1"># Redshift supports ANY_VALUE(..)</span> +</span><span id="L-201"><a href="#L-201"><span class="linenos">201</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="p">)</span> </span><span id="L-202"><a href="#L-202"><span class="linenos">202</span></a> -</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="n">RESERVED_KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="s2">"aes128"</span><span class="p">,</span> -</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> <span class="s2">"aes256"</span><span class="p">,</span> -</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="s2">"all"</span><span class="p">,</span> -</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="s2">"allowoverwrite"</span><span class="p">,</span> -</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="s2">"analyse"</span><span class="p">,</span> -</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="s2">"analyze"</span><span class="p">,</span> -</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="s2">"and"</span><span class="p">,</span> -</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="s2">"any"</span><span class="p">,</span> -</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="s2">"array"</span><span class="p">,</span> -</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="s2">"as"</span><span class="p">,</span> -</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="s2">"asc"</span><span class="p">,</span> -</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="s2">"authorization"</span><span class="p">,</span> -</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="s2">"az64"</span><span class="p">,</span> -</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="s2">"backup"</span><span class="p">,</span> -</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="s2">"between"</span><span class="p">,</span> -</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="s2">"binary"</span><span class="p">,</span> -</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="s2">"blanksasnull"</span><span class="p">,</span> -</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="s2">"both"</span><span class="p">,</span> -</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="s2">"bytedict"</span><span class="p">,</span> -</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="s2">"bzip2"</span><span class="p">,</span> -</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="s2">"case"</span><span class="p">,</span> -</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="s2">"cast"</span><span class="p">,</span> -</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="s2">"check"</span><span class="p">,</span> -</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="s2">"collate"</span><span class="p">,</span> -</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="s2">"column"</span><span class="p">,</span> -</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="s2">"constraint"</span><span class="p">,</span> -</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="s2">"create"</span><span class="p">,</span> -</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="s2">"credentials"</span><span class="p">,</span> -</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="s2">"cross"</span><span class="p">,</span> -</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="s2">"current_date"</span><span class="p">,</span> -</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="s2">"current_time"</span><span class="p">,</span> -</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="s2">"current_timestamp"</span><span class="p">,</span> -</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="s2">"current_user"</span><span class="p">,</span> -</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="s2">"current_user_id"</span><span class="p">,</span> -</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="s2">"default"</span><span class="p">,</span> -</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="s2">"deferrable"</span><span class="p">,</span> -</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="s2">"deflate"</span><span class="p">,</span> -</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="s2">"defrag"</span><span class="p">,</span> -</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="s2">"delta"</span><span class="p">,</span> -</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="s2">"delta32k"</span><span class="p">,</span> -</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="s2">"desc"</span><span class="p">,</span> -</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="s2">"disable"</span><span class="p">,</span> -</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="s2">"distinct"</span><span class="p">,</span> -</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="s2">"do"</span><span class="p">,</span> -</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="s2">"else"</span><span class="p">,</span> -</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="s2">"emptyasnull"</span><span class="p">,</span> -</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="s2">"enable"</span><span class="p">,</span> -</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="s2">"encode"</span><span class="p">,</span> -</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="s2">"encrypt "</span><span class="p">,</span> -</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="s2">"encryption"</span><span class="p">,</span> -</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="s2">"end"</span><span class="p">,</span> -</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="s2">"except"</span><span class="p">,</span> -</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="s2">"explicit"</span><span class="p">,</span> -</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="s2">"false"</span><span class="p">,</span> -</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="s2">"for"</span><span class="p">,</span> -</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="s2">"foreign"</span><span class="p">,</span> -</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="s2">"freeze"</span><span class="p">,</span> -</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="s2">"from"</span><span class="p">,</span> -</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="s2">"full"</span><span class="p">,</span> -</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="s2">"globaldict256"</span><span class="p">,</span> -</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="s2">"globaldict64k"</span><span class="p">,</span> -</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="s2">"grant"</span><span class="p">,</span> -</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="s2">"group"</span><span class="p">,</span> -</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="s2">"gzip"</span><span class="p">,</span> -</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="s2">"having"</span><span class="p">,</span> -</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="s2">"identity"</span><span class="p">,</span> -</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="s2">"ignore"</span><span class="p">,</span> -</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="s2">"ilike"</span><span class="p">,</span> -</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="s2">"in"</span><span class="p">,</span> -</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="s2">"initially"</span><span class="p">,</span> -</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="s2">"inner"</span><span class="p">,</span> -</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="s2">"intersect"</span><span class="p">,</span> -</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="s2">"interval"</span><span class="p">,</span> -</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="s2">"into"</span><span class="p">,</span> -</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="s2">"is"</span><span class="p">,</span> -</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="s2">"isnull"</span><span class="p">,</span> -</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="s2">"join"</span><span class="p">,</span> -</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="s2">"leading"</span><span class="p">,</span> -</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="s2">"left"</span><span class="p">,</span> -</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="s2">"like"</span><span class="p">,</span> -</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="s2">"limit"</span><span class="p">,</span> -</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="s2">"localtime"</span><span class="p">,</span> -</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="s2">"localtimestamp"</span><span class="p">,</span> -</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="s2">"lun"</span><span class="p">,</span> -</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="s2">"luns"</span><span class="p">,</span> -</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="s2">"lzo"</span><span class="p">,</span> -</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="s2">"lzop"</span><span class="p">,</span> -</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="s2">"minus"</span><span class="p">,</span> -</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="s2">"mostly16"</span><span class="p">,</span> -</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="s2">"mostly32"</span><span class="p">,</span> -</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="s2">"mostly8"</span><span class="p">,</span> -</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="s2">"natural"</span><span class="p">,</span> -</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="s2">"new"</span><span class="p">,</span> -</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="s2">"not"</span><span class="p">,</span> -</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="s2">"notnull"</span><span class="p">,</span> -</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="s2">"null"</span><span class="p">,</span> -</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="s2">"nulls"</span><span class="p">,</span> -</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="s2">"off"</span><span class="p">,</span> -</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="s2">"offline"</span><span class="p">,</span> -</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="s2">"offset"</span><span class="p">,</span> -</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="s2">"oid"</span><span class="p">,</span> -</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="s2">"old"</span><span class="p">,</span> -</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="s2">"on"</span><span class="p">,</span> -</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <span class="s2">"only"</span><span class="p">,</span> -</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="s2">"open"</span><span class="p">,</span> -</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="s2">"or"</span><span class="p">,</span> -</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="s2">"order"</span><span class="p">,</span> -</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="s2">"outer"</span><span class="p">,</span> -</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="s2">"overlaps"</span><span class="p">,</span> -</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="s2">"parallel"</span><span class="p">,</span> -</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="s2">"partition"</span><span class="p">,</span> -</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="s2">"percent"</span><span class="p">,</span> -</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="s2">"permissions"</span><span class="p">,</span> -</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="s2">"pivot"</span><span class="p">,</span> -</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="s2">"placing"</span><span class="p">,</span> -</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="s2">"primary"</span><span class="p">,</span> -</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="s2">"raw"</span><span class="p">,</span> -</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="s2">"readratio"</span><span class="p">,</span> -</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="s2">"recover"</span><span class="p">,</span> -</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="s2">"references"</span><span class="p">,</span> -</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="s2">"rejectlog"</span><span class="p">,</span> -</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="s2">"resort"</span><span class="p">,</span> -</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> <span class="s2">"respect"</span><span class="p">,</span> -</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="s2">"restore"</span><span class="p">,</span> -</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="s2">"right"</span><span class="p">,</span> -</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="s2">"select"</span><span class="p">,</span> -</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> <span class="s2">"session_user"</span><span class="p">,</span> -</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="s2">"similar"</span><span class="p">,</span> -</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="s2">"snapshot"</span><span class="p">,</span> -</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> <span class="s2">"some"</span><span class="p">,</span> -</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="s2">"sysdate"</span><span class="p">,</span> -</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> <span class="s2">"system"</span><span class="p">,</span> -</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> <span class="s2">"table"</span><span class="p">,</span> -</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> <span class="s2">"tag"</span><span class="p">,</span> -</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="s2">"tdes"</span><span class="p">,</span> -</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="s2">"text255"</span><span class="p">,</span> -</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="s2">"text32k"</span><span class="p">,</span> -</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="s2">"then"</span><span class="p">,</span> -</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="s2">"timestamp"</span><span class="p">,</span> -</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="s2">"to"</span><span class="p">,</span> -</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="s2">"top"</span><span class="p">,</span> -</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="s2">"trailing"</span><span class="p">,</span> -</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="s2">"true"</span><span class="p">,</span> -</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> <span class="s2">"truncatecolumns"</span><span class="p">,</span> -</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> <span class="s2">"type"</span><span class="p">,</span> -</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> <span class="s2">"union"</span><span class="p">,</span> -</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="s2">"unique"</span><span class="p">,</span> -</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a> <span class="s2">"unnest"</span><span class="p">,</span> -</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> <span class="s2">"unpivot"</span><span class="p">,</span> -</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> <span class="s2">"user"</span><span class="p">,</span> -</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> <span class="s2">"using"</span><span class="p">,</span> -</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> <span class="s2">"verbose"</span><span class="p">,</span> -</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="s2">"wallet"</span><span class="p">,</span> -</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> <span class="s2">"when"</span><span class="p">,</span> -</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a> <span class="s2">"where"</span><span class="p">,</span> -</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> <span class="s2">"with"</span><span class="p">,</span> -</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> <span class="s2">"without"</span><span class="p">,</span> -</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> <span class="p">}</span> -</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> -</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> <span class="k">def</span> <span class="nf">unnest_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">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> -</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> <span class="n">num_args</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> -</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> -</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="k">if</span> <span class="n">num_args</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> -</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported number of arguments in UNNEST: </span><span class="si">{</span><span class="n">num_args</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> -</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> <span class="k">return</span> <span class="s2">""</span> -</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> -</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="n">arg</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">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> -</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> <span class="n">alias</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="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</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-373"><a href="#L-373"><span class="linenos">373</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">arg</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">arg</span> -</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> -</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-376"><a href="#L-376"><span class="linenos">376</span></a><span class="w"> </span><span class="sd">"""Redshift doesn't have `WITH` as part of their with_properties so we remove it"""</span> -</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> -</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a> -</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a> <span class="k">def</span> <span class="nf">cast_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">Cast</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</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">JSON</span><span class="p">):</span> -</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> <span class="c1"># Redshift doesn't support a JSON type, so casting to it is treated as a noop</span> -</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a> <span class="k">return</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-383"><a href="#L-383"><span class="linenos">383</span></a> -</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="o">=</span><span class="n">safe_prefix</span><span class="p">)</span> -</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> -</span><span id="L-386"><a href="#L-386"><span class="linenos">386</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-387"><a href="#L-387"><span class="linenos">387</span></a><span class="w"> </span><span class="sd">"""</span> -</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a><span class="sd"> Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean</span> -</span><span id="L-389"><a href="#L-389"><span class="linenos">389</span></a><span class="sd"> VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type</span> -</span><span id="L-390"><a href="#L-390"><span class="linenos">390</span></a><span class="sd"> without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert</span> -</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a><span class="sd"> `TEXT` to `VARCHAR`.</span> -</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a><span class="sd"> """</span> -</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">"text"</span><span class="p">):</span> -</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</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">VARCHAR</span><span class="p">)</span> -</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a> <span class="n">precision</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">"expressions"</span><span class="p">)</span> -</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> -</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">precision</span><span class="p">:</span> -</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"MAX"</span><span class="p">))</span> +</span><span id="L-203"><a href="#L-203"><span class="linenos">203</span></a> <span class="c1"># Redshift supports LAST_DAY(..)</span> +</span><span id="L-204"><a href="#L-204"><span class="linenos">204</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LastDay</span><span class="p">)</span> +</span><span id="L-205"><a href="#L-205"><span class="linenos">205</span></a> +</span><span id="L-206"><a href="#L-206"><span class="linenos">206</span></a> <span class="n">RESERVED_KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="L-207"><a href="#L-207"><span class="linenos">207</span></a> <span class="s2">"aes128"</span><span class="p">,</span> +</span><span id="L-208"><a href="#L-208"><span class="linenos">208</span></a> <span class="s2">"aes256"</span><span class="p">,</span> +</span><span id="L-209"><a href="#L-209"><span class="linenos">209</span></a> <span class="s2">"all"</span><span class="p">,</span> +</span><span id="L-210"><a href="#L-210"><span class="linenos">210</span></a> <span class="s2">"allowoverwrite"</span><span class="p">,</span> +</span><span id="L-211"><a href="#L-211"><span class="linenos">211</span></a> <span class="s2">"analyse"</span><span class="p">,</span> +</span><span id="L-212"><a href="#L-212"><span class="linenos">212</span></a> <span class="s2">"analyze"</span><span class="p">,</span> +</span><span id="L-213"><a href="#L-213"><span class="linenos">213</span></a> <span class="s2">"and"</span><span class="p">,</span> +</span><span id="L-214"><a href="#L-214"><span class="linenos">214</span></a> <span class="s2">"any"</span><span class="p">,</span> +</span><span id="L-215"><a href="#L-215"><span class="linenos">215</span></a> <span class="s2">"array"</span><span class="p">,</span> +</span><span id="L-216"><a href="#L-216"><span class="linenos">216</span></a> <span class="s2">"as"</span><span class="p">,</span> +</span><span id="L-217"><a href="#L-217"><span class="linenos">217</span></a> <span class="s2">"asc"</span><span class="p">,</span> +</span><span id="L-218"><a href="#L-218"><span class="linenos">218</span></a> <span class="s2">"authorization"</span><span class="p">,</span> +</span><span id="L-219"><a href="#L-219"><span class="linenos">219</span></a> <span class="s2">"az64"</span><span class="p">,</span> +</span><span id="L-220"><a href="#L-220"><span class="linenos">220</span></a> <span class="s2">"backup"</span><span class="p">,</span> +</span><span id="L-221"><a href="#L-221"><span class="linenos">221</span></a> <span class="s2">"between"</span><span class="p">,</span> +</span><span id="L-222"><a href="#L-222"><span class="linenos">222</span></a> <span class="s2">"binary"</span><span class="p">,</span> +</span><span id="L-223"><a href="#L-223"><span class="linenos">223</span></a> <span class="s2">"blanksasnull"</span><span class="p">,</span> +</span><span id="L-224"><a href="#L-224"><span class="linenos">224</span></a> <span class="s2">"both"</span><span class="p">,</span> +</span><span id="L-225"><a href="#L-225"><span class="linenos">225</span></a> <span class="s2">"bytedict"</span><span class="p">,</span> +</span><span id="L-226"><a href="#L-226"><span class="linenos">226</span></a> <span class="s2">"bzip2"</span><span class="p">,</span> +</span><span id="L-227"><a href="#L-227"><span class="linenos">227</span></a> <span class="s2">"case"</span><span class="p">,</span> +</span><span id="L-228"><a href="#L-228"><span class="linenos">228</span></a> <span class="s2">"cast"</span><span class="p">,</span> +</span><span id="L-229"><a href="#L-229"><span class="linenos">229</span></a> <span class="s2">"check"</span><span class="p">,</span> +</span><span id="L-230"><a href="#L-230"><span class="linenos">230</span></a> <span class="s2">"collate"</span><span class="p">,</span> +</span><span id="L-231"><a href="#L-231"><span class="linenos">231</span></a> <span class="s2">"column"</span><span class="p">,</span> +</span><span id="L-232"><a href="#L-232"><span class="linenos">232</span></a> <span class="s2">"constraint"</span><span class="p">,</span> +</span><span id="L-233"><a href="#L-233"><span class="linenos">233</span></a> <span class="s2">"create"</span><span class="p">,</span> +</span><span id="L-234"><a href="#L-234"><span class="linenos">234</span></a> <span class="s2">"credentials"</span><span class="p">,</span> +</span><span id="L-235"><a href="#L-235"><span class="linenos">235</span></a> <span class="s2">"cross"</span><span class="p">,</span> +</span><span id="L-236"><a href="#L-236"><span class="linenos">236</span></a> <span class="s2">"current_date"</span><span class="p">,</span> +</span><span id="L-237"><a href="#L-237"><span class="linenos">237</span></a> <span class="s2">"current_time"</span><span class="p">,</span> +</span><span id="L-238"><a href="#L-238"><span class="linenos">238</span></a> <span class="s2">"current_timestamp"</span><span class="p">,</span> +</span><span id="L-239"><a href="#L-239"><span class="linenos">239</span></a> <span class="s2">"current_user"</span><span class="p">,</span> +</span><span id="L-240"><a href="#L-240"><span class="linenos">240</span></a> <span class="s2">"current_user_id"</span><span class="p">,</span> +</span><span id="L-241"><a href="#L-241"><span class="linenos">241</span></a> <span class="s2">"default"</span><span class="p">,</span> +</span><span id="L-242"><a href="#L-242"><span class="linenos">242</span></a> <span class="s2">"deferrable"</span><span class="p">,</span> +</span><span id="L-243"><a href="#L-243"><span class="linenos">243</span></a> <span class="s2">"deflate"</span><span class="p">,</span> +</span><span id="L-244"><a href="#L-244"><span class="linenos">244</span></a> <span class="s2">"defrag"</span><span class="p">,</span> +</span><span id="L-245"><a href="#L-245"><span class="linenos">245</span></a> <span class="s2">"delta"</span><span class="p">,</span> +</span><span id="L-246"><a href="#L-246"><span class="linenos">246</span></a> <span class="s2">"delta32k"</span><span class="p">,</span> +</span><span id="L-247"><a href="#L-247"><span class="linenos">247</span></a> <span class="s2">"desc"</span><span class="p">,</span> +</span><span id="L-248"><a href="#L-248"><span class="linenos">248</span></a> <span class="s2">"disable"</span><span class="p">,</span> +</span><span id="L-249"><a href="#L-249"><span class="linenos">249</span></a> <span class="s2">"distinct"</span><span class="p">,</span> +</span><span id="L-250"><a href="#L-250"><span class="linenos">250</span></a> <span class="s2">"do"</span><span class="p">,</span> +</span><span id="L-251"><a href="#L-251"><span class="linenos">251</span></a> <span class="s2">"else"</span><span class="p">,</span> +</span><span id="L-252"><a href="#L-252"><span class="linenos">252</span></a> <span class="s2">"emptyasnull"</span><span class="p">,</span> +</span><span id="L-253"><a href="#L-253"><span class="linenos">253</span></a> <span class="s2">"enable"</span><span class="p">,</span> +</span><span id="L-254"><a href="#L-254"><span class="linenos">254</span></a> <span class="s2">"encode"</span><span class="p">,</span> +</span><span id="L-255"><a href="#L-255"><span class="linenos">255</span></a> <span class="s2">"encrypt "</span><span class="p">,</span> +</span><span id="L-256"><a href="#L-256"><span class="linenos">256</span></a> <span class="s2">"encryption"</span><span class="p">,</span> +</span><span id="L-257"><a href="#L-257"><span class="linenos">257</span></a> <span class="s2">"end"</span><span class="p">,</span> +</span><span id="L-258"><a href="#L-258"><span class="linenos">258</span></a> <span class="s2">"except"</span><span class="p">,</span> +</span><span id="L-259"><a href="#L-259"><span class="linenos">259</span></a> <span class="s2">"explicit"</span><span class="p">,</span> +</span><span id="L-260"><a href="#L-260"><span class="linenos">260</span></a> <span class="s2">"false"</span><span class="p">,</span> +</span><span id="L-261"><a href="#L-261"><span class="linenos">261</span></a> <span class="s2">"for"</span><span class="p">,</span> +</span><span id="L-262"><a href="#L-262"><span class="linenos">262</span></a> <span class="s2">"foreign"</span><span class="p">,</span> +</span><span id="L-263"><a href="#L-263"><span class="linenos">263</span></a> <span class="s2">"freeze"</span><span class="p">,</span> +</span><span id="L-264"><a href="#L-264"><span class="linenos">264</span></a> <span class="s2">"from"</span><span class="p">,</span> +</span><span id="L-265"><a href="#L-265"><span class="linenos">265</span></a> <span class="s2">"full"</span><span class="p">,</span> +</span><span id="L-266"><a href="#L-266"><span class="linenos">266</span></a> <span class="s2">"globaldict256"</span><span class="p">,</span> +</span><span id="L-267"><a href="#L-267"><span class="linenos">267</span></a> <span class="s2">"globaldict64k"</span><span class="p">,</span> +</span><span id="L-268"><a href="#L-268"><span class="linenos">268</span></a> <span class="s2">"grant"</span><span class="p">,</span> +</span><span id="L-269"><a href="#L-269"><span class="linenos">269</span></a> <span class="s2">"group"</span><span class="p">,</span> +</span><span id="L-270"><a href="#L-270"><span class="linenos">270</span></a> <span class="s2">"gzip"</span><span class="p">,</span> +</span><span id="L-271"><a href="#L-271"><span class="linenos">271</span></a> <span class="s2">"having"</span><span class="p">,</span> +</span><span id="L-272"><a href="#L-272"><span class="linenos">272</span></a> <span class="s2">"identity"</span><span class="p">,</span> +</span><span id="L-273"><a href="#L-273"><span class="linenos">273</span></a> <span class="s2">"ignore"</span><span class="p">,</span> +</span><span id="L-274"><a href="#L-274"><span class="linenos">274</span></a> <span class="s2">"ilike"</span><span class="p">,</span> +</span><span id="L-275"><a href="#L-275"><span class="linenos">275</span></a> <span class="s2">"in"</span><span class="p">,</span> +</span><span id="L-276"><a href="#L-276"><span class="linenos">276</span></a> <span class="s2">"initially"</span><span class="p">,</span> +</span><span id="L-277"><a href="#L-277"><span class="linenos">277</span></a> <span class="s2">"inner"</span><span class="p">,</span> +</span><span id="L-278"><a href="#L-278"><span class="linenos">278</span></a> <span class="s2">"intersect"</span><span class="p">,</span> +</span><span id="L-279"><a href="#L-279"><span class="linenos">279</span></a> <span class="s2">"interval"</span><span class="p">,</span> +</span><span id="L-280"><a href="#L-280"><span class="linenos">280</span></a> <span class="s2">"into"</span><span class="p">,</span> +</span><span id="L-281"><a href="#L-281"><span class="linenos">281</span></a> <span class="s2">"is"</span><span class="p">,</span> +</span><span id="L-282"><a href="#L-282"><span class="linenos">282</span></a> <span class="s2">"isnull"</span><span class="p">,</span> +</span><span id="L-283"><a href="#L-283"><span class="linenos">283</span></a> <span class="s2">"join"</span><span class="p">,</span> +</span><span id="L-284"><a href="#L-284"><span class="linenos">284</span></a> <span class="s2">"leading"</span><span class="p">,</span> +</span><span id="L-285"><a href="#L-285"><span class="linenos">285</span></a> <span class="s2">"left"</span><span class="p">,</span> +</span><span id="L-286"><a href="#L-286"><span class="linenos">286</span></a> <span class="s2">"like"</span><span class="p">,</span> +</span><span id="L-287"><a href="#L-287"><span class="linenos">287</span></a> <span class="s2">"limit"</span><span class="p">,</span> +</span><span id="L-288"><a href="#L-288"><span class="linenos">288</span></a> <span class="s2">"localtime"</span><span class="p">,</span> +</span><span id="L-289"><a href="#L-289"><span class="linenos">289</span></a> <span class="s2">"localtimestamp"</span><span class="p">,</span> +</span><span id="L-290"><a href="#L-290"><span class="linenos">290</span></a> <span class="s2">"lun"</span><span class="p">,</span> +</span><span id="L-291"><a href="#L-291"><span class="linenos">291</span></a> <span class="s2">"luns"</span><span class="p">,</span> +</span><span id="L-292"><a href="#L-292"><span class="linenos">292</span></a> <span class="s2">"lzo"</span><span class="p">,</span> +</span><span id="L-293"><a href="#L-293"><span class="linenos">293</span></a> <span class="s2">"lzop"</span><span class="p">,</span> +</span><span id="L-294"><a href="#L-294"><span class="linenos">294</span></a> <span class="s2">"minus"</span><span class="p">,</span> +</span><span id="L-295"><a href="#L-295"><span class="linenos">295</span></a> <span class="s2">"mostly16"</span><span class="p">,</span> +</span><span id="L-296"><a href="#L-296"><span class="linenos">296</span></a> <span class="s2">"mostly32"</span><span class="p">,</span> +</span><span id="L-297"><a href="#L-297"><span class="linenos">297</span></a> <span class="s2">"mostly8"</span><span class="p">,</span> +</span><span id="L-298"><a href="#L-298"><span class="linenos">298</span></a> <span class="s2">"natural"</span><span class="p">,</span> +</span><span id="L-299"><a href="#L-299"><span class="linenos">299</span></a> <span class="s2">"new"</span><span class="p">,</span> +</span><span id="L-300"><a href="#L-300"><span class="linenos">300</span></a> <span class="s2">"not"</span><span class="p">,</span> +</span><span id="L-301"><a href="#L-301"><span class="linenos">301</span></a> <span class="s2">"notnull"</span><span class="p">,</span> +</span><span id="L-302"><a href="#L-302"><span class="linenos">302</span></a> <span class="s2">"null"</span><span class="p">,</span> +</span><span id="L-303"><a href="#L-303"><span class="linenos">303</span></a> <span class="s2">"nulls"</span><span class="p">,</span> +</span><span id="L-304"><a href="#L-304"><span class="linenos">304</span></a> <span class="s2">"off"</span><span class="p">,</span> +</span><span id="L-305"><a href="#L-305"><span class="linenos">305</span></a> <span class="s2">"offline"</span><span class="p">,</span> +</span><span id="L-306"><a href="#L-306"><span class="linenos">306</span></a> <span class="s2">"offset"</span><span class="p">,</span> +</span><span id="L-307"><a href="#L-307"><span class="linenos">307</span></a> <span class="s2">"oid"</span><span class="p">,</span> +</span><span id="L-308"><a href="#L-308"><span class="linenos">308</span></a> <span class="s2">"old"</span><span class="p">,</span> +</span><span id="L-309"><a href="#L-309"><span class="linenos">309</span></a> <span class="s2">"on"</span><span class="p">,</span> +</span><span id="L-310"><a href="#L-310"><span class="linenos">310</span></a> <span class="s2">"only"</span><span class="p">,</span> +</span><span id="L-311"><a href="#L-311"><span class="linenos">311</span></a> <span class="s2">"open"</span><span class="p">,</span> +</span><span id="L-312"><a href="#L-312"><span class="linenos">312</span></a> <span class="s2">"or"</span><span class="p">,</span> +</span><span id="L-313"><a href="#L-313"><span class="linenos">313</span></a> <span class="s2">"order"</span><span class="p">,</span> +</span><span id="L-314"><a href="#L-314"><span class="linenos">314</span></a> <span class="s2">"outer"</span><span class="p">,</span> +</span><span id="L-315"><a href="#L-315"><span class="linenos">315</span></a> <span class="s2">"overlaps"</span><span class="p">,</span> +</span><span id="L-316"><a href="#L-316"><span class="linenos">316</span></a> <span class="s2">"parallel"</span><span class="p">,</span> +</span><span id="L-317"><a href="#L-317"><span class="linenos">317</span></a> <span class="s2">"partition"</span><span class="p">,</span> +</span><span id="L-318"><a href="#L-318"><span class="linenos">318</span></a> <span class="s2">"percent"</span><span class="p">,</span> +</span><span id="L-319"><a href="#L-319"><span class="linenos">319</span></a> <span class="s2">"permissions"</span><span class="p">,</span> +</span><span id="L-320"><a href="#L-320"><span class="linenos">320</span></a> <span class="s2">"pivot"</span><span class="p">,</span> +</span><span id="L-321"><a href="#L-321"><span class="linenos">321</span></a> <span class="s2">"placing"</span><span class="p">,</span> +</span><span id="L-322"><a href="#L-322"><span class="linenos">322</span></a> <span class="s2">"primary"</span><span class="p">,</span> +</span><span id="L-323"><a href="#L-323"><span class="linenos">323</span></a> <span class="s2">"raw"</span><span class="p">,</span> +</span><span id="L-324"><a href="#L-324"><span class="linenos">324</span></a> <span class="s2">"readratio"</span><span class="p">,</span> +</span><span id="L-325"><a href="#L-325"><span class="linenos">325</span></a> <span class="s2">"recover"</span><span class="p">,</span> +</span><span id="L-326"><a href="#L-326"><span class="linenos">326</span></a> <span class="s2">"references"</span><span class="p">,</span> +</span><span id="L-327"><a href="#L-327"><span class="linenos">327</span></a> <span class="s2">"rejectlog"</span><span class="p">,</span> +</span><span id="L-328"><a href="#L-328"><span class="linenos">328</span></a> <span class="s2">"resort"</span><span class="p">,</span> +</span><span id="L-329"><a href="#L-329"><span class="linenos">329</span></a> <span class="s2">"respect"</span><span class="p">,</span> +</span><span id="L-330"><a href="#L-330"><span class="linenos">330</span></a> <span class="s2">"restore"</span><span class="p">,</span> +</span><span id="L-331"><a href="#L-331"><span class="linenos">331</span></a> <span class="s2">"right"</span><span class="p">,</span> +</span><span id="L-332"><a href="#L-332"><span class="linenos">332</span></a> <span class="s2">"select"</span><span class="p">,</span> +</span><span id="L-333"><a href="#L-333"><span class="linenos">333</span></a> <span class="s2">"session_user"</span><span class="p">,</span> +</span><span id="L-334"><a href="#L-334"><span class="linenos">334</span></a> <span class="s2">"similar"</span><span class="p">,</span> +</span><span id="L-335"><a href="#L-335"><span class="linenos">335</span></a> <span class="s2">"snapshot"</span><span class="p">,</span> +</span><span id="L-336"><a href="#L-336"><span class="linenos">336</span></a> <span class="s2">"some"</span><span class="p">,</span> +</span><span id="L-337"><a href="#L-337"><span class="linenos">337</span></a> <span class="s2">"sysdate"</span><span class="p">,</span> +</span><span id="L-338"><a href="#L-338"><span class="linenos">338</span></a> <span class="s2">"system"</span><span class="p">,</span> +</span><span id="L-339"><a href="#L-339"><span class="linenos">339</span></a> <span class="s2">"table"</span><span class="p">,</span> +</span><span id="L-340"><a href="#L-340"><span class="linenos">340</span></a> <span class="s2">"tag"</span><span class="p">,</span> +</span><span id="L-341"><a href="#L-341"><span class="linenos">341</span></a> <span class="s2">"tdes"</span><span class="p">,</span> +</span><span id="L-342"><a href="#L-342"><span class="linenos">342</span></a> <span class="s2">"text255"</span><span class="p">,</span> +</span><span id="L-343"><a href="#L-343"><span class="linenos">343</span></a> <span class="s2">"text32k"</span><span class="p">,</span> +</span><span id="L-344"><a href="#L-344"><span class="linenos">344</span></a> <span class="s2">"then"</span><span class="p">,</span> +</span><span id="L-345"><a href="#L-345"><span class="linenos">345</span></a> <span class="s2">"timestamp"</span><span class="p">,</span> +</span><span id="L-346"><a href="#L-346"><span class="linenos">346</span></a> <span class="s2">"to"</span><span class="p">,</span> +</span><span id="L-347"><a href="#L-347"><span class="linenos">347</span></a> <span class="s2">"top"</span><span class="p">,</span> +</span><span id="L-348"><a href="#L-348"><span class="linenos">348</span></a> <span class="s2">"trailing"</span><span class="p">,</span> +</span><span id="L-349"><a href="#L-349"><span class="linenos">349</span></a> <span class="s2">"true"</span><span class="p">,</span> +</span><span id="L-350"><a href="#L-350"><span class="linenos">350</span></a> <span class="s2">"truncatecolumns"</span><span class="p">,</span> +</span><span id="L-351"><a href="#L-351"><span class="linenos">351</span></a> <span class="s2">"type"</span><span class="p">,</span> +</span><span id="L-352"><a href="#L-352"><span class="linenos">352</span></a> <span class="s2">"union"</span><span class="p">,</span> +</span><span id="L-353"><a href="#L-353"><span class="linenos">353</span></a> <span class="s2">"unique"</span><span class="p">,</span> +</span><span id="L-354"><a href="#L-354"><span class="linenos">354</span></a> <span class="s2">"unnest"</span><span class="p">,</span> +</span><span id="L-355"><a href="#L-355"><span class="linenos">355</span></a> <span class="s2">"unpivot"</span><span class="p">,</span> +</span><span id="L-356"><a href="#L-356"><span class="linenos">356</span></a> <span class="s2">"user"</span><span class="p">,</span> +</span><span id="L-357"><a href="#L-357"><span class="linenos">357</span></a> <span class="s2">"using"</span><span class="p">,</span> +</span><span id="L-358"><a href="#L-358"><span class="linenos">358</span></a> <span class="s2">"verbose"</span><span class="p">,</span> +</span><span id="L-359"><a href="#L-359"><span class="linenos">359</span></a> <span class="s2">"wallet"</span><span class="p">,</span> +</span><span id="L-360"><a href="#L-360"><span class="linenos">360</span></a> <span class="s2">"when"</span><span class="p">,</span> +</span><span id="L-361"><a href="#L-361"><span class="linenos">361</span></a> <span class="s2">"where"</span><span class="p">,</span> +</span><span id="L-362"><a href="#L-362"><span class="linenos">362</span></a> <span class="s2">"with"</span><span class="p">,</span> +</span><span id="L-363"><a href="#L-363"><span class="linenos">363</span></a> <span class="s2">"without"</span><span class="p">,</span> +</span><span id="L-364"><a href="#L-364"><span class="linenos">364</span></a> <span class="p">}</span> +</span><span id="L-365"><a href="#L-365"><span class="linenos">365</span></a> +</span><span id="L-366"><a href="#L-366"><span class="linenos">366</span></a> <span class="k">def</span> <span class="nf">unnest_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">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-367"><a href="#L-367"><span class="linenos">367</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="L-368"><a href="#L-368"><span class="linenos">368</span></a> <span class="n">num_args</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="L-369"><a href="#L-369"><span class="linenos">369</span></a> +</span><span id="L-370"><a href="#L-370"><span class="linenos">370</span></a> <span class="k">if</span> <span class="n">num_args</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="L-371"><a href="#L-371"><span class="linenos">371</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported number of arguments in UNNEST: </span><span class="si">{</span><span class="n">num_args</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="L-372"><a href="#L-372"><span class="linenos">372</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="L-373"><a href="#L-373"><span class="linenos">373</span></a> +</span><span id="L-374"><a href="#L-374"><span class="linenos">374</span></a> <span class="n">arg</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">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> +</span><span id="L-375"><a href="#L-375"><span class="linenos">375</span></a> <span class="n">alias</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="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</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-376"><a href="#L-376"><span class="linenos">376</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">arg</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">arg</span> +</span><span id="L-377"><a href="#L-377"><span class="linenos">377</span></a> +</span><span id="L-378"><a href="#L-378"><span class="linenos">378</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-379"><a href="#L-379"><span class="linenos">379</span></a><span class="w"> </span><span class="sd">"""Redshift doesn't have `WITH` as part of their with_properties so we remove it"""</span> +</span><span id="L-380"><a href="#L-380"><span class="linenos">380</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="L-381"><a href="#L-381"><span class="linenos">381</span></a> +</span><span id="L-382"><a href="#L-382"><span class="linenos">382</span></a> <span class="k">def</span> <span class="nf">cast_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">Cast</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="L-383"><a href="#L-383"><span class="linenos">383</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</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">JSON</span><span class="p">):</span> +</span><span id="L-384"><a href="#L-384"><span class="linenos">384</span></a> <span class="c1"># Redshift doesn't support a JSON type, so casting to it is treated as a noop</span> +</span><span id="L-385"><a href="#L-385"><span class="linenos">385</span></a> <span class="k">return</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-386"><a href="#L-386"><span class="linenos">386</span></a> +</span><span id="L-387"><a href="#L-387"><span class="linenos">387</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="o">=</span><span class="n">safe_prefix</span><span class="p">)</span> +</span><span id="L-388"><a href="#L-388"><span class="linenos">388</span></a> +</span><span id="L-389"><a href="#L-389"><span class="linenos">389</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-390"><a href="#L-390"><span class="linenos">390</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="L-391"><a href="#L-391"><span class="linenos">391</span></a><span class="sd"> Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean</span> +</span><span id="L-392"><a href="#L-392"><span class="linenos">392</span></a><span class="sd"> VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type</span> +</span><span id="L-393"><a href="#L-393"><span class="linenos">393</span></a><span class="sd"> without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert</span> +</span><span id="L-394"><a href="#L-394"><span class="linenos">394</span></a><span class="sd"> `TEXT` to `VARCHAR`.</span> +</span><span id="L-395"><a href="#L-395"><span class="linenos">395</span></a><span class="sd"> """</span> +</span><span id="L-396"><a href="#L-396"><span class="linenos">396</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">"text"</span><span class="p">):</span> +</span><span id="L-397"><a href="#L-397"><span class="linenos">397</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</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">VARCHAR</span><span class="p">)</span> +</span><span id="L-398"><a href="#L-398"><span class="linenos">398</span></a> <span class="n">precision</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">"expressions"</span><span class="p">)</span> </span><span id="L-399"><a href="#L-399"><span class="linenos">399</span></a> -</span><span id="L-400"><a href="#L-400"><span class="linenos">400</span></a> <span class="k">return</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-400"><a href="#L-400"><span class="linenos">400</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">precision</span><span class="p">:</span> +</span><span id="L-401"><a href="#L-401"><span class="linenos">401</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"MAX"</span><span class="p">))</span> +</span><span id="L-402"><a href="#L-402"><span class="linenos">402</span></a> +</span><span id="L-403"><a href="#L-403"><span class="linenos">403</span></a> <span class="k">return</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></pre></div> @@ -667,365 +676,368 @@ </span><span id="Redshift-40"><a href="#Redshift-40"><span class="linenos"> 40</span></a> <span class="n">SUPPORTS_USER_DEFINED_TYPES</span> <span class="o">=</span> <span class="kc">False</span> </span><span id="Redshift-41"><a href="#Redshift-41"><span class="linenos"> 41</span></a> <span class="n">INDEX_OFFSET</span> <span class="o">=</span> <span class="mi">0</span> </span><span id="Redshift-42"><a href="#Redshift-42"><span class="linenos"> 42</span></a> <span class="n">COPY_PARAMS_ARE_CSV</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift-43"><a href="#Redshift-43"><span class="linenos"> 43</span></a> -</span><span id="Redshift-44"><a href="#Redshift-44"><span class="linenos"> 44</span></a> <span class="n">TIME_FORMAT</span> <span class="o">=</span> <span class="s2">"'YYYY-MM-DD HH:MI:SS'"</span> -</span><span id="Redshift-45"><a href="#Redshift-45"><span class="linenos"> 45</span></a> <span class="n">TIME_MAPPING</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift-46"><a href="#Redshift-46"><span class="linenos"> 46</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">TIME_MAPPING</span><span class="p">,</span> -</span><span id="Redshift-47"><a href="#Redshift-47"><span class="linenos"> 47</span></a> <span class="s2">"MON"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> -</span><span id="Redshift-48"><a href="#Redshift-48"><span class="linenos"> 48</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> -</span><span id="Redshift-49"><a href="#Redshift-49"><span class="linenos"> 49</span></a> <span class="p">}</span> -</span><span id="Redshift-50"><a href="#Redshift-50"><span class="linenos"> 50</span></a> -</span><span id="Redshift-51"><a href="#Redshift-51"><span class="linenos"> 51</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> -</span><span id="Redshift-52"><a href="#Redshift-52"><span class="linenos"> 52</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift-53"><a href="#Redshift-53"><span class="linenos"> 53</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> -</span><span id="Redshift-54"><a href="#Redshift-54"><span class="linenos"> 54</span></a> <span class="s2">"ADD_MONTHS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">(</span> -</span><span id="Redshift-55"><a href="#Redshift-55"><span class="linenos"> 55</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> -</span><span id="Redshift-56"><a href="#Redshift-56"><span class="linenos"> 56</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> -</span><span id="Redshift-57"><a href="#Redshift-57"><span class="linenos"> 57</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"month"</span><span class="p">),</span> -</span><span id="Redshift-58"><a href="#Redshift-58"><span class="linenos"> 58</span></a> <span class="n">return_type</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">build</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">),</span> -</span><span id="Redshift-59"><a href="#Redshift-59"><span class="linenos"> 59</span></a> <span class="p">),</span> -</span><span id="Redshift-60"><a href="#Redshift-60"><span class="linenos"> 60</span></a> <span class="s2">"DATEADD"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">),</span> -</span><span id="Redshift-61"><a href="#Redshift-61"><span class="linenos"> 61</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">),</span> -</span><span id="Redshift-62"><a href="#Redshift-62"><span class="linenos"> 62</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">),</span> -</span><span id="Redshift-63"><a href="#Redshift-63"><span class="linenos"> 63</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">),</span> -</span><span id="Redshift-64"><a href="#Redshift-64"><span class="linenos"> 64</span></a> <span class="s2">"GETDATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Redshift-65"><a href="#Redshift-65"><span class="linenos"> 65</span></a> <span class="s2">"LISTAGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Redshift-66"><a href="#Redshift-66"><span class="linenos"> 66</span></a> <span class="s2">"STRTOL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">FromBase</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Redshift-67"><a href="#Redshift-67"><span class="linenos"> 67</span></a> <span class="p">}</span> -</span><span id="Redshift-68"><a href="#Redshift-68"><span class="linenos"> 68</span></a> -</span><span id="Redshift-69"><a href="#Redshift-69"><span class="linenos"> 69</span></a> <span class="n">NO_PAREN_FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift-70"><a href="#Redshift-70"><span class="linenos"> 70</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTION_PARSERS</span><span class="p">,</span> -</span><span id="Redshift-71"><a href="#Redshift-71"><span class="linenos"> 71</span></a> <span class="s2">"APPROXIMATE"</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_approximate_count</span><span class="p">(),</span> -</span><span id="Redshift-72"><a href="#Redshift-72"><span class="linenos"> 72</span></a> <span class="s2">"SYSDATE"</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">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">,</span> <span class="n">transaction</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> -</span><span id="Redshift-73"><a href="#Redshift-73"><span class="linenos"> 73</span></a> <span class="p">}</span> -</span><span id="Redshift-74"><a href="#Redshift-74"><span class="linenos"> 74</span></a> -</span><span id="Redshift-75"><a href="#Redshift-75"><span class="linenos"> 75</span></a> <span class="n">SUPPORTS_IMPLICIT_UNNEST</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Redshift-76"><a href="#Redshift-76"><span class="linenos"> 76</span></a> -</span><span id="Redshift-77"><a href="#Redshift-77"><span class="linenos"> 77</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> -</span><span id="Redshift-78"><a href="#Redshift-78"><span class="linenos"> 78</span></a> <span class="bp">self</span><span class="p">,</span> -</span><span id="Redshift-79"><a href="#Redshift-79"><span class="linenos"> 79</span></a> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="Redshift-80"><a href="#Redshift-80"><span class="linenos"> 80</span></a> <span class="n">joins</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="Redshift-81"><a href="#Redshift-81"><span class="linenos"> 81</span></a> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> -</span><span id="Redshift-82"><a href="#Redshift-82"><span class="linenos"> 82</span></a> <span class="n">parse_bracket</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="Redshift-83"><a href="#Redshift-83"><span class="linenos"> 83</span></a> <span class="n">is_db_reference</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="Redshift-84"><a href="#Redshift-84"><span class="linenos"> 84</span></a> <span class="n">parse_partition</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="Redshift-85"><a href="#Redshift-85"><span class="linenos"> 85</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> -</span><span id="Redshift-86"><a href="#Redshift-86"><span class="linenos"> 86</span></a> <span class="c1"># Redshift supports UNPIVOTing SUPER objects, e.g. `UNPIVOT foo.obj[0] AS val AT attr`</span> -</span><span id="Redshift-87"><a href="#Redshift-87"><span class="linenos"> 87</span></a> <span class="n">unpivot</span> <span class="o">=</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">UNPIVOT</span><span class="p">)</span> -</span><span id="Redshift-88"><a href="#Redshift-88"><span class="linenos"> 88</span></a> <span class="n">table</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span> -</span><span id="Redshift-89"><a href="#Redshift-89"><span class="linenos"> 89</span></a> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> -</span><span id="Redshift-90"><a href="#Redshift-90"><span class="linenos"> 90</span></a> <span class="n">joins</span><span class="o">=</span><span class="n">joins</span><span class="p">,</span> -</span><span id="Redshift-91"><a href="#Redshift-91"><span class="linenos"> 91</span></a> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">,</span> -</span><span id="Redshift-92"><a href="#Redshift-92"><span class="linenos"> 92</span></a> <span class="n">parse_bracket</span><span class="o">=</span><span class="n">parse_bracket</span><span class="p">,</span> -</span><span id="Redshift-93"><a href="#Redshift-93"><span class="linenos"> 93</span></a> <span class="n">is_db_reference</span><span class="o">=</span><span class="n">is_db_reference</span><span class="p">,</span> -</span><span id="Redshift-94"><a href="#Redshift-94"><span class="linenos"> 94</span></a> <span class="p">)</span> -</span><span id="Redshift-95"><a href="#Redshift-95"><span class="linenos"> 95</span></a> -</span><span id="Redshift-96"><a href="#Redshift-96"><span class="linenos"> 96</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">Pivot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">unpivot</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="k">if</span> <span class="n">unpivot</span> <span class="k">else</span> <span class="n">table</span> -</span><span id="Redshift-97"><a href="#Redshift-97"><span class="linenos"> 97</span></a> -</span><span id="Redshift-98"><a href="#Redshift-98"><span class="linenos"> 98</span></a> <span class="k">def</span> <span class="nf">_parse_convert</span><span class="p">(</span> -</span><span id="Redshift-99"><a href="#Redshift-99"><span class="linenos"> 99</span></a> <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="n">safe</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="Redshift-100"><a href="#Redshift-100"><span class="linenos">100</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> -</span><span id="Redshift-101"><a href="#Redshift-101"><span class="linenos">101</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> -</span><span id="Redshift-102"><a href="#Redshift-102"><span class="linenos">102</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">COMMA</span><span class="p">)</span> -</span><span id="Redshift-103"><a href="#Redshift-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_bitwise</span><span class="p">()</span> -</span><span id="Redshift-104"><a href="#Redshift-104"><span class="linenos">104</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">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 class="n">safe</span><span class="o">=</span><span class="n">safe</span><span class="p">)</span> -</span><span id="Redshift-105"><a href="#Redshift-105"><span class="linenos">105</span></a> -</span><span id="Redshift-106"><a href="#Redshift-106"><span class="linenos">106</span></a> <span class="k">def</span> <span class="nf">_parse_approximate_count</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">]:</span> -</span><span id="Redshift-107"><a href="#Redshift-107"><span class="linenos">107</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">-</span> <span class="mi">1</span> -</span><span id="Redshift-108"><a href="#Redshift-108"><span class="linenos">108</span></a> <span class="n">func</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> -</span><span id="Redshift-109"><a href="#Redshift-109"><span class="linenos">109</span></a> -</span><span id="Redshift-110"><a href="#Redshift-110"><span class="linenos">110</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> -</span><span id="Redshift-111"><a href="#Redshift-111"><span class="linenos">111</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">ApproxDistinct</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> -</span><span id="Redshift-112"><a href="#Redshift-112"><span class="linenos">112</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> -</span><span id="Redshift-113"><a href="#Redshift-113"><span class="linenos">113</span></a> <span class="k">return</span> <span class="kc">None</span> -</span><span id="Redshift-114"><a href="#Redshift-114"><span class="linenos">114</span></a> -</span><span id="Redshift-115"><a href="#Redshift-115"><span class="linenos">115</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> -</span><span id="Redshift-116"><a href="#Redshift-116"><span class="linenos">116</span></a> <span class="n">BIT_STRINGS</span> <span class="o">=</span> <span class="p">[]</span> -</span><span id="Redshift-117"><a href="#Redshift-117"><span class="linenos">117</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[]</span> -</span><span id="Redshift-118"><a href="#Redshift-118"><span class="linenos">118</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">]</span> -</span><span id="Redshift-119"><a href="#Redshift-119"><span class="linenos">119</span></a> -</span><span id="Redshift-120"><a href="#Redshift-120"><span class="linenos">120</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift-121"><a href="#Redshift-121"><span class="linenos">121</span></a> <span class="o">**</span><span class="n">Postgres</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="Redshift-122"><a href="#Redshift-122"><span class="linenos">122</span></a> <span class="s2">"HLLSKETCH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HLLSKETCH</span><span class="p">,</span> -</span><span id="Redshift-123"><a href="#Redshift-123"><span class="linenos">123</span></a> <span class="s2">"SUPER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SUPER</span><span class="p">,</span> -</span><span id="Redshift-124"><a href="#Redshift-124"><span class="linenos">124</span></a> <span class="s2">"TOP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> -</span><span id="Redshift-125"><a href="#Redshift-125"><span class="linenos">125</span></a> <span class="s2">"UNLOAD"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> -</span><span id="Redshift-126"><a href="#Redshift-126"><span class="linenos">126</span></a> <span class="s2">"VARBYTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> -</span><span id="Redshift-127"><a href="#Redshift-127"><span class="linenos">127</span></a> <span class="p">}</span> -</span><span id="Redshift-128"><a href="#Redshift-128"><span class="linenos">128</span></a> <span class="n">KEYWORDS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"VALUES"</span><span class="p">)</span> -</span><span id="Redshift-129"><a href="#Redshift-129"><span class="linenos">129</span></a> -</span><span id="Redshift-130"><a href="#Redshift-130"><span class="linenos">130</span></a> <span class="c1"># Redshift allows # to appear as a table identifier prefix</span> -</span><span id="Redshift-131"><a href="#Redshift-131"><span class="linenos">131</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> -</span><span id="Redshift-132"><a href="#Redshift-132"><span class="linenos">132</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"#"</span><span class="p">)</span> -</span><span id="Redshift-133"><a href="#Redshift-133"><span class="linenos">133</span></a> -</span><span id="Redshift-134"><a href="#Redshift-134"><span class="linenos">134</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> -</span><span id="Redshift-135"><a href="#Redshift-135"><span class="linenos">135</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift-136"><a href="#Redshift-136"><span class="linenos">136</span></a> <span class="n">QUERY_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift-137"><a href="#Redshift-137"><span class="linenos">137</span></a> <span class="n">VALUES_AS_TABLE</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift-138"><a href="#Redshift-138"><span class="linenos">138</span></a> <span class="n">TZ_TO_WITH_TIME_ZONE</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Redshift-139"><a href="#Redshift-139"><span class="linenos">139</span></a> <span class="n">NVL2_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Redshift-140"><a href="#Redshift-140"><span class="linenos">140</span></a> <span class="n">LAST_DAY_SUPPORTS_DATE_PART</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift-141"><a href="#Redshift-141"><span class="linenos">141</span></a> <span class="n">CAN_IMPLEMENT_ARRAY_ANY</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift-142"><a href="#Redshift-142"><span class="linenos">142</span></a> <span class="n">MULTI_ARG_DISTINCT</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Redshift-143"><a href="#Redshift-143"><span class="linenos">143</span></a> <span class="n">COPY_PARAMS_ARE_WRAPPED</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift-144"><a href="#Redshift-144"><span class="linenos">144</span></a> -</span><span id="Redshift-145"><a href="#Redshift-145"><span class="linenos">145</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift-146"><a href="#Redshift-146"><span class="linenos">146</span></a> <span class="o">**</span><span class="n">Postgres</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="Redshift-147"><a href="#Redshift-147"><span class="linenos">147</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">BINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> -</span><span id="Redshift-148"><a href="#Redshift-148"><span class="linenos">148</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">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> -</span><span id="Redshift-149"><a href="#Redshift-149"><span class="linenos">149</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">TIMETZ</span><span class="p">:</span> <span class="s2">"TIME"</span><span class="p">,</span> -</span><span id="Redshift-150"><a href="#Redshift-150"><span class="linenos">150</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">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> -</span><span id="Redshift-151"><a href="#Redshift-151"><span class="linenos">151</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">VARBINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> -</span><span id="Redshift-152"><a href="#Redshift-152"><span class="linenos">152</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">ROWVERSION</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> -</span><span id="Redshift-153"><a href="#Redshift-153"><span class="linenos">153</span></a> <span class="p">}</span> -</span><span id="Redshift-154"><a href="#Redshift-154"><span class="linenos">154</span></a> -</span><span id="Redshift-155"><a href="#Redshift-155"><span class="linenos">155</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift-156"><a href="#Redshift-156"><span class="linenos">156</span></a> <span class="o">**</span><span class="n">Postgres</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="Redshift-157"><a href="#Redshift-157"><span class="linenos">157</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">:</span> <span class="n">concat_to_dpipe_sql</span><span class="p">,</span> -</span><span id="Redshift-158"><a href="#Redshift-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ConcatWs</span><span class="p">:</span> <span class="n">concat_ws_to_dpipe_sql</span><span class="p">,</span> -</span><span id="Redshift-159"><a href="#Redshift-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> -</span><span id="Redshift-160"><a href="#Redshift-160"><span class="linenos">160</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"APPROXIMATE COUNT(DISTINCT </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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Redshift-161"><a href="#Redshift-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</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="p">(</span> -</span><span id="Redshift-162"><a href="#Redshift-162"><span class="linenos">162</span></a> <span class="s2">"SYSDATE"</span> <span class="k">if</span> <span class="n">e</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">"transaction"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"GETDATE()"</span> -</span><span id="Redshift-163"><a href="#Redshift-163"><span class="linenos">163</span></a> <span class="p">),</span> -</span><span id="Redshift-164"><a href="#Redshift-164"><span class="linenos">164</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> -</span><span id="Redshift-165"><a href="#Redshift-165"><span class="linenos">165</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> -</span><span id="Redshift-166"><a href="#Redshift-166"><span class="linenos">166</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</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">func</span><span class="p">(</span><span class="s2">"DISTKEY"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> -</span><span id="Redshift-167"><a href="#Redshift-167"><span class="linenos">167</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</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">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> -</span><span id="Redshift-168"><a href="#Redshift-168"><span class="linenos">168</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FromBase</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRTOL"</span><span class="p">),</span> -</span><span id="Redshift-169"><a href="#Redshift-169"><span class="linenos">169</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">:</span> <span class="n">generatedasidentitycolumnconstraint_sql</span><span class="p">,</span> -</span><span id="Redshift-170"><a href="#Redshift-170"><span class="linenos">170</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">json_extract_segments</span><span class="p">(</span><span class="s2">"JSON_EXTRACT_PATH_TEXT"</span><span class="p">),</span> -</span><span id="Redshift-171"><a href="#Redshift-171"><span class="linenos">171</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">json_extract_segments</span><span class="p">(</span><span class="s2">"JSON_EXTRACT_PATH_TEXT"</span><span class="p">),</span> -</span><span id="Redshift-172"><a href="#Redshift-172"><span class="linenos">172</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LISTAGG"</span><span class="p">),</span> -</span><span id="Redshift-173"><a href="#Redshift-173"><span class="linenos">173</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ParseJSON</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"JSON_PARSE"</span><span class="p">),</span> -</span><span id="Redshift-174"><a href="#Redshift-174"><span class="linenos">174</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><span id="Redshift-175"><a href="#Redshift-175"><span class="linenos">175</span></a> <span class="p">[</span> -</span><span id="Redshift-176"><a href="#Redshift-176"><span class="linenos">176</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">,</span> -</span><span id="Redshift-177"><a href="#Redshift-177"><span class="linenos">177</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_semi_and_anti_joins</span><span class="p">,</span> -</span><span id="Redshift-178"><a href="#Redshift-178"><span class="linenos">178</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">unqualify_unnest</span><span class="p">,</span> -</span><span id="Redshift-179"><a href="#Redshift-179"><span class="linenos">179</span></a> <span class="p">]</span> -</span><span id="Redshift-180"><a href="#Redshift-180"><span class="linenos">180</span></a> <span class="p">),</span> -</span><span id="Redshift-181"><a href="#Redshift-181"><span class="linenos">181</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> -</span><span id="Redshift-182"><a href="#Redshift-182"><span class="linenos">182</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'COMPOUND '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'compound'</span><span class="p">]</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">SORTKEY(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Redshift-183"><a href="#Redshift-183"><span class="linenos">183</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StartsWith</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> -</span><span id="Redshift-184"><a href="#Redshift-184"><span class="linenos">184</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</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="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2"> LIKE </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="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> || '%'"</span><span class="p">,</span> -</span><span id="Redshift-185"><a href="#Redshift-185"><span class="linenos">185</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> -</span><span id="Redshift-186"><a href="#Redshift-186"><span class="linenos">186</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> -</span><span id="Redshift-187"><a href="#Redshift-187"><span class="linenos">187</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> -</span><span id="Redshift-188"><a href="#Redshift-188"><span class="linenos">188</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> -</span><span id="Redshift-189"><a href="#Redshift-189"><span class="linenos">189</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"(TIMESTAMP 'epoch' + </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="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2"> * INTERVAL '1 SECOND')"</span><span class="p">,</span> -</span><span id="Redshift-190"><a href="#Redshift-190"><span class="linenos">190</span></a> <span class="p">}</span> -</span><span id="Redshift-191"><a href="#Redshift-191"><span class="linenos">191</span></a> -</span><span id="Redshift-192"><a href="#Redshift-192"><span class="linenos">192</span></a> <span class="c1"># Postgres maps exp.Pivot to no_pivot_sql, but Redshift support pivots</span> -</span><span id="Redshift-193"><a href="#Redshift-193"><span class="linenos">193</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">)</span> +</span><span id="Redshift-43"><a href="#Redshift-43"><span class="linenos"> 43</span></a> <span class="n">HEX_LOWERCASE</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Redshift-44"><a href="#Redshift-44"><span class="linenos"> 44</span></a> +</span><span id="Redshift-45"><a href="#Redshift-45"><span class="linenos"> 45</span></a> <span class="n">TIME_FORMAT</span> <span class="o">=</span> <span class="s2">"'YYYY-MM-DD HH:MI:SS'"</span> +</span><span id="Redshift-46"><a href="#Redshift-46"><span class="linenos"> 46</span></a> <span class="n">TIME_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-47"><a href="#Redshift-47"><span class="linenos"> 47</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">TIME_MAPPING</span><span class="p">,</span> +</span><span id="Redshift-48"><a href="#Redshift-48"><span class="linenos"> 48</span></a> <span class="s2">"MON"</span><span class="p">:</span> <span class="s2">"%b"</span><span class="p">,</span> +</span><span id="Redshift-49"><a href="#Redshift-49"><span class="linenos"> 49</span></a> <span class="s2">"HH"</span><span class="p">:</span> <span class="s2">"%H"</span><span class="p">,</span> +</span><span id="Redshift-50"><a href="#Redshift-50"><span class="linenos"> 50</span></a> <span class="p">}</span> +</span><span id="Redshift-51"><a href="#Redshift-51"><span class="linenos"> 51</span></a> +</span><span id="Redshift-52"><a href="#Redshift-52"><span class="linenos"> 52</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Redshift-53"><a href="#Redshift-53"><span class="linenos"> 53</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-54"><a href="#Redshift-54"><span class="linenos"> 54</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="Redshift-55"><a href="#Redshift-55"><span class="linenos"> 55</span></a> <span class="s2">"ADD_MONTHS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">(</span> +</span><span id="Redshift-56"><a href="#Redshift-56"><span class="linenos"> 56</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Redshift-57"><a href="#Redshift-57"><span class="linenos"> 57</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Redshift-58"><a href="#Redshift-58"><span class="linenos"> 58</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"month"</span><span class="p">),</span> +</span><span id="Redshift-59"><a href="#Redshift-59"><span class="linenos"> 59</span></a> <span class="n">return_type</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">build</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">),</span> +</span><span id="Redshift-60"><a href="#Redshift-60"><span class="linenos"> 60</span></a> <span class="p">),</span> +</span><span id="Redshift-61"><a href="#Redshift-61"><span class="linenos"> 61</span></a> <span class="s2">"DATEADD"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">),</span> +</span><span id="Redshift-62"><a href="#Redshift-62"><span class="linenos"> 62</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">),</span> +</span><span id="Redshift-63"><a href="#Redshift-63"><span class="linenos"> 63</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">),</span> +</span><span id="Redshift-64"><a href="#Redshift-64"><span class="linenos"> 64</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">),</span> +</span><span id="Redshift-65"><a href="#Redshift-65"><span class="linenos"> 65</span></a> <span class="s2">"GETDATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Redshift-66"><a href="#Redshift-66"><span class="linenos"> 66</span></a> <span class="s2">"LISTAGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Redshift-67"><a href="#Redshift-67"><span class="linenos"> 67</span></a> <span class="s2">"STRTOL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">FromBase</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Redshift-68"><a href="#Redshift-68"><span class="linenos"> 68</span></a> <span class="p">}</span> +</span><span id="Redshift-69"><a href="#Redshift-69"><span class="linenos"> 69</span></a> +</span><span id="Redshift-70"><a href="#Redshift-70"><span class="linenos"> 70</span></a> <span class="n">NO_PAREN_FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-71"><a href="#Redshift-71"><span class="linenos"> 71</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTION_PARSERS</span><span class="p">,</span> +</span><span id="Redshift-72"><a href="#Redshift-72"><span class="linenos"> 72</span></a> <span class="s2">"APPROXIMATE"</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_approximate_count</span><span class="p">(),</span> +</span><span id="Redshift-73"><a href="#Redshift-73"><span class="linenos"> 73</span></a> <span class="s2">"SYSDATE"</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">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">,</span> <span class="n">transaction</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="Redshift-74"><a href="#Redshift-74"><span class="linenos"> 74</span></a> <span class="p">}</span> +</span><span id="Redshift-75"><a href="#Redshift-75"><span class="linenos"> 75</span></a> +</span><span id="Redshift-76"><a href="#Redshift-76"><span class="linenos"> 76</span></a> <span class="n">SUPPORTS_IMPLICIT_UNNEST</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Redshift-77"><a href="#Redshift-77"><span class="linenos"> 77</span></a> +</span><span id="Redshift-78"><a href="#Redshift-78"><span class="linenos"> 78</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> +</span><span id="Redshift-79"><a href="#Redshift-79"><span class="linenos"> 79</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Redshift-80"><a href="#Redshift-80"><span class="linenos"> 80</span></a> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Redshift-81"><a href="#Redshift-81"><span class="linenos"> 81</span></a> <span class="n">joins</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Redshift-82"><a href="#Redshift-82"><span class="linenos"> 82</span></a> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Redshift-83"><a href="#Redshift-83"><span class="linenos"> 83</span></a> <span class="n">parse_bracket</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Redshift-84"><a href="#Redshift-84"><span class="linenos"> 84</span></a> <span class="n">is_db_reference</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Redshift-85"><a href="#Redshift-85"><span class="linenos"> 85</span></a> <span class="n">parse_partition</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Redshift-86"><a href="#Redshift-86"><span class="linenos"> 86</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Redshift-87"><a href="#Redshift-87"><span class="linenos"> 87</span></a> <span class="c1"># Redshift supports UNPIVOTing SUPER objects, e.g. `UNPIVOT foo.obj[0] AS val AT attr`</span> +</span><span id="Redshift-88"><a href="#Redshift-88"><span class="linenos"> 88</span></a> <span class="n">unpivot</span> <span class="o">=</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">UNPIVOT</span><span class="p">)</span> +</span><span id="Redshift-89"><a href="#Redshift-89"><span class="linenos"> 89</span></a> <span class="n">table</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span> +</span><span id="Redshift-90"><a href="#Redshift-90"><span class="linenos"> 90</span></a> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> +</span><span id="Redshift-91"><a href="#Redshift-91"><span class="linenos"> 91</span></a> <span class="n">joins</span><span class="o">=</span><span class="n">joins</span><span class="p">,</span> +</span><span id="Redshift-92"><a href="#Redshift-92"><span class="linenos"> 92</span></a> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">,</span> +</span><span id="Redshift-93"><a href="#Redshift-93"><span class="linenos"> 93</span></a> <span class="n">parse_bracket</span><span class="o">=</span><span class="n">parse_bracket</span><span class="p">,</span> +</span><span id="Redshift-94"><a href="#Redshift-94"><span class="linenos"> 94</span></a> <span class="n">is_db_reference</span><span class="o">=</span><span class="n">is_db_reference</span><span class="p">,</span> +</span><span id="Redshift-95"><a href="#Redshift-95"><span class="linenos"> 95</span></a> <span class="p">)</span> +</span><span id="Redshift-96"><a href="#Redshift-96"><span class="linenos"> 96</span></a> +</span><span id="Redshift-97"><a href="#Redshift-97"><span class="linenos"> 97</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">Pivot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">unpivot</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="k">if</span> <span class="n">unpivot</span> <span class="k">else</span> <span class="n">table</span> +</span><span id="Redshift-98"><a href="#Redshift-98"><span class="linenos"> 98</span></a> +</span><span id="Redshift-99"><a href="#Redshift-99"><span class="linenos"> 99</span></a> <span class="k">def</span> <span class="nf">_parse_convert</span><span class="p">(</span> +</span><span id="Redshift-100"><a href="#Redshift-100"><span class="linenos">100</span></a> <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="n">safe</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Redshift-101"><a href="#Redshift-101"><span class="linenos">101</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Redshift-102"><a href="#Redshift-102"><span class="linenos">102</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="Redshift-103"><a href="#Redshift-103"><span class="linenos">103</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">COMMA</span><span class="p">)</span> +</span><span id="Redshift-104"><a href="#Redshift-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_bitwise</span><span class="p">()</span> +</span><span id="Redshift-105"><a href="#Redshift-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 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 class="n">safe</span><span class="o">=</span><span class="n">safe</span><span class="p">)</span> +</span><span id="Redshift-106"><a href="#Redshift-106"><span class="linenos">106</span></a> +</span><span id="Redshift-107"><a href="#Redshift-107"><span class="linenos">107</span></a> <span class="k">def</span> <span class="nf">_parse_approximate_count</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">]:</span> +</span><span id="Redshift-108"><a href="#Redshift-108"><span class="linenos">108</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">-</span> <span class="mi">1</span> +</span><span id="Redshift-109"><a href="#Redshift-109"><span class="linenos">109</span></a> <span class="n">func</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> +</span><span id="Redshift-110"><a href="#Redshift-110"><span class="linenos">110</span></a> +</span><span id="Redshift-111"><a href="#Redshift-111"><span class="linenos">111</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> +</span><span id="Redshift-112"><a href="#Redshift-112"><span class="linenos">112</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">ApproxDistinct</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> +</span><span id="Redshift-113"><a href="#Redshift-113"><span class="linenos">113</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Redshift-114"><a href="#Redshift-114"><span class="linenos">114</span></a> <span class="k">return</span> <span class="kc">None</span> +</span><span id="Redshift-115"><a href="#Redshift-115"><span class="linenos">115</span></a> +</span><span id="Redshift-116"><a href="#Redshift-116"><span class="linenos">116</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Redshift-117"><a href="#Redshift-117"><span class="linenos">117</span></a> <span class="n">BIT_STRINGS</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Redshift-118"><a href="#Redshift-118"><span class="linenos">118</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Redshift-119"><a href="#Redshift-119"><span class="linenos">119</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">]</span> +</span><span id="Redshift-120"><a href="#Redshift-120"><span class="linenos">120</span></a> +</span><span id="Redshift-121"><a href="#Redshift-121"><span class="linenos">121</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-122"><a href="#Redshift-122"><span class="linenos">122</span></a> <span class="o">**</span><span class="n">Postgres</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="Redshift-123"><a href="#Redshift-123"><span class="linenos">123</span></a> <span class="s2">"HLLSKETCH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HLLSKETCH</span><span class="p">,</span> +</span><span id="Redshift-124"><a href="#Redshift-124"><span class="linenos">124</span></a> <span class="s2">"SUPER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SUPER</span><span class="p">,</span> +</span><span id="Redshift-125"><a href="#Redshift-125"><span class="linenos">125</span></a> <span class="s2">"TOP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> +</span><span id="Redshift-126"><a href="#Redshift-126"><span class="linenos">126</span></a> <span class="s2">"UNLOAD"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Redshift-127"><a href="#Redshift-127"><span class="linenos">127</span></a> <span class="s2">"VARBYTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="Redshift-128"><a href="#Redshift-128"><span class="linenos">128</span></a> <span class="p">}</span> +</span><span id="Redshift-129"><a href="#Redshift-129"><span class="linenos">129</span></a> <span class="n">KEYWORDS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"VALUES"</span><span class="p">)</span> +</span><span id="Redshift-130"><a href="#Redshift-130"><span class="linenos">130</span></a> +</span><span id="Redshift-131"><a href="#Redshift-131"><span class="linenos">131</span></a> <span class="c1"># Redshift allows # to appear as a table identifier prefix</span> +</span><span id="Redshift-132"><a href="#Redshift-132"><span class="linenos">132</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Redshift-133"><a href="#Redshift-133"><span class="linenos">133</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"#"</span><span class="p">)</span> +</span><span id="Redshift-134"><a href="#Redshift-134"><span class="linenos">134</span></a> +</span><span id="Redshift-135"><a href="#Redshift-135"><span class="linenos">135</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Redshift-136"><a href="#Redshift-136"><span class="linenos">136</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Redshift-137"><a href="#Redshift-137"><span class="linenos">137</span></a> <span class="n">QUERY_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Redshift-138"><a href="#Redshift-138"><span class="linenos">138</span></a> <span class="n">VALUES_AS_TABLE</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Redshift-139"><a href="#Redshift-139"><span class="linenos">139</span></a> <span class="n">TZ_TO_WITH_TIME_ZONE</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Redshift-140"><a href="#Redshift-140"><span class="linenos">140</span></a> <span class="n">NVL2_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Redshift-141"><a href="#Redshift-141"><span class="linenos">141</span></a> <span class="n">LAST_DAY_SUPPORTS_DATE_PART</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Redshift-142"><a href="#Redshift-142"><span class="linenos">142</span></a> <span class="n">CAN_IMPLEMENT_ARRAY_ANY</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Redshift-143"><a href="#Redshift-143"><span class="linenos">143</span></a> <span class="n">MULTI_ARG_DISTINCT</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Redshift-144"><a href="#Redshift-144"><span class="linenos">144</span></a> <span class="n">COPY_PARAMS_ARE_WRAPPED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Redshift-145"><a href="#Redshift-145"><span class="linenos">145</span></a> <span class="n">HEX_FUNC</span> <span class="o">=</span> <span class="s2">"TO_HEX"</span> +</span><span id="Redshift-146"><a href="#Redshift-146"><span class="linenos">146</span></a> +</span><span id="Redshift-147"><a href="#Redshift-147"><span class="linenos">147</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-148"><a href="#Redshift-148"><span class="linenos">148</span></a> <span class="o">**</span><span class="n">Postgres</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="Redshift-149"><a href="#Redshift-149"><span class="linenos">149</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">BINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="Redshift-150"><a href="#Redshift-150"><span class="linenos">150</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">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Redshift-151"><a href="#Redshift-151"><span class="linenos">151</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">TIMETZ</span><span class="p">:</span> <span class="s2">"TIME"</span><span class="p">,</span> +</span><span id="Redshift-152"><a href="#Redshift-152"><span class="linenos">152</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">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Redshift-153"><a href="#Redshift-153"><span class="linenos">153</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">VARBINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="Redshift-154"><a href="#Redshift-154"><span class="linenos">154</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">ROWVERSION</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="Redshift-155"><a href="#Redshift-155"><span class="linenos">155</span></a> <span class="p">}</span> +</span><span id="Redshift-156"><a href="#Redshift-156"><span class="linenos">156</span></a> +</span><span id="Redshift-157"><a href="#Redshift-157"><span class="linenos">157</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-158"><a href="#Redshift-158"><span class="linenos">158</span></a> <span class="o">**</span><span class="n">Postgres</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="Redshift-159"><a href="#Redshift-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">:</span> <span class="n">concat_to_dpipe_sql</span><span class="p">,</span> +</span><span id="Redshift-160"><a href="#Redshift-160"><span class="linenos">160</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ConcatWs</span><span class="p">:</span> <span class="n">concat_ws_to_dpipe_sql</span><span class="p">,</span> +</span><span id="Redshift-161"><a href="#Redshift-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> +</span><span id="Redshift-162"><a href="#Redshift-162"><span class="linenos">162</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"APPROXIMATE COUNT(DISTINCT </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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Redshift-163"><a href="#Redshift-163"><span class="linenos">163</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</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="p">(</span> +</span><span id="Redshift-164"><a href="#Redshift-164"><span class="linenos">164</span></a> <span class="s2">"SYSDATE"</span> <span class="k">if</span> <span class="n">e</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">"transaction"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"GETDATE()"</span> +</span><span id="Redshift-165"><a href="#Redshift-165"><span class="linenos">165</span></a> <span class="p">),</span> +</span><span id="Redshift-166"><a href="#Redshift-166"><span class="linenos">166</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> +</span><span id="Redshift-167"><a href="#Redshift-167"><span class="linenos">167</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> +</span><span id="Redshift-168"><a href="#Redshift-168"><span class="linenos">168</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</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">func</span><span class="p">(</span><span class="s2">"DISTKEY"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> +</span><span id="Redshift-169"><a href="#Redshift-169"><span class="linenos">169</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</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">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="Redshift-170"><a href="#Redshift-170"><span class="linenos">170</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FromBase</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRTOL"</span><span class="p">),</span> +</span><span id="Redshift-171"><a href="#Redshift-171"><span class="linenos">171</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">:</span> <span class="n">generatedasidentitycolumnconstraint_sql</span><span class="p">,</span> +</span><span id="Redshift-172"><a href="#Redshift-172"><span class="linenos">172</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">json_extract_segments</span><span class="p">(</span><span class="s2">"JSON_EXTRACT_PATH_TEXT"</span><span class="p">),</span> +</span><span id="Redshift-173"><a href="#Redshift-173"><span class="linenos">173</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">json_extract_segments</span><span class="p">(</span><span class="s2">"JSON_EXTRACT_PATH_TEXT"</span><span class="p">),</span> +</span><span id="Redshift-174"><a href="#Redshift-174"><span class="linenos">174</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LISTAGG"</span><span class="p">),</span> +</span><span id="Redshift-175"><a href="#Redshift-175"><span class="linenos">175</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</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">func</span><span class="p">(</span><span class="s2">"UPPER"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">"TO_HEX"</span><span class="p">,</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="s2">"this"</span><span class="p">))),</span> +</span><span id="Redshift-176"><a href="#Redshift-176"><span class="linenos">176</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ParseJSON</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"JSON_PARSE"</span><span class="p">),</span> +</span><span id="Redshift-177"><a href="#Redshift-177"><span class="linenos">177</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><span id="Redshift-178"><a href="#Redshift-178"><span class="linenos">178</span></a> <span class="p">[</span> +</span><span id="Redshift-179"><a href="#Redshift-179"><span class="linenos">179</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">,</span> +</span><span id="Redshift-180"><a href="#Redshift-180"><span class="linenos">180</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_semi_and_anti_joins</span><span class="p">,</span> +</span><span id="Redshift-181"><a href="#Redshift-181"><span class="linenos">181</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">unqualify_unnest</span><span class="p">,</span> +</span><span id="Redshift-182"><a href="#Redshift-182"><span class="linenos">182</span></a> <span class="p">]</span> +</span><span id="Redshift-183"><a href="#Redshift-183"><span class="linenos">183</span></a> <span class="p">),</span> +</span><span id="Redshift-184"><a href="#Redshift-184"><span class="linenos">184</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> +</span><span id="Redshift-185"><a href="#Redshift-185"><span class="linenos">185</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'COMPOUND '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'compound'</span><span class="p">]</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">SORTKEY(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Redshift-186"><a href="#Redshift-186"><span class="linenos">186</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StartsWith</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> +</span><span id="Redshift-187"><a href="#Redshift-187"><span class="linenos">187</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</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="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2"> LIKE </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="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> || '%'"</span><span class="p">,</span> +</span><span id="Redshift-188"><a href="#Redshift-188"><span class="linenos">188</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="Redshift-189"><a href="#Redshift-189"><span class="linenos">189</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> +</span><span id="Redshift-190"><a href="#Redshift-190"><span class="linenos">190</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> +</span><span id="Redshift-191"><a href="#Redshift-191"><span class="linenos">191</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> +</span><span id="Redshift-192"><a href="#Redshift-192"><span class="linenos">192</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"(TIMESTAMP 'epoch' + </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="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2"> * INTERVAL '1 SECOND')"</span><span class="p">,</span> +</span><span id="Redshift-193"><a href="#Redshift-193"><span class="linenos">193</span></a> <span class="p">}</span> </span><span id="Redshift-194"><a href="#Redshift-194"><span class="linenos">194</span></a> -</span><span id="Redshift-195"><a href="#Redshift-195"><span class="linenos">195</span></a> <span class="c1"># Redshift uses the POW | POWER (expr1, expr2) syntax instead of expr1 ^ expr2 (postgres)</span> -</span><span id="Redshift-196"><a href="#Redshift-196"><span class="linenos">196</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">)</span> +</span><span id="Redshift-195"><a href="#Redshift-195"><span class="linenos">195</span></a> <span class="c1"># Postgres maps exp.Pivot to no_pivot_sql, but Redshift support pivots</span> +</span><span id="Redshift-196"><a href="#Redshift-196"><span class="linenos">196</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">)</span> </span><span id="Redshift-197"><a href="#Redshift-197"><span class="linenos">197</span></a> -</span><span id="Redshift-198"><a href="#Redshift-198"><span class="linenos">198</span></a> <span class="c1"># Redshift supports ANY_VALUE(..)</span> -</span><span id="Redshift-199"><a href="#Redshift-199"><span class="linenos">199</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="p">)</span> +</span><span id="Redshift-198"><a href="#Redshift-198"><span class="linenos">198</span></a> <span class="c1"># Redshift uses the POW | POWER (expr1, expr2) syntax instead of expr1 ^ expr2 (postgres)</span> +</span><span id="Redshift-199"><a href="#Redshift-199"><span class="linenos">199</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">)</span> </span><span id="Redshift-200"><a href="#Redshift-200"><span class="linenos">200</span></a> -</span><span id="Redshift-201"><a href="#Redshift-201"><span class="linenos">201</span></a> <span class="c1"># Redshift supports LAST_DAY(..)</span> -</span><span id="Redshift-202"><a href="#Redshift-202"><span class="linenos">202</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LastDay</span><span class="p">)</span> +</span><span id="Redshift-201"><a href="#Redshift-201"><span class="linenos">201</span></a> <span class="c1"># Redshift supports ANY_VALUE(..)</span> +</span><span id="Redshift-202"><a href="#Redshift-202"><span class="linenos">202</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="p">)</span> </span><span id="Redshift-203"><a href="#Redshift-203"><span class="linenos">203</span></a> -</span><span id="Redshift-204"><a href="#Redshift-204"><span class="linenos">204</span></a> <span class="n">RESERVED_KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift-205"><a href="#Redshift-205"><span class="linenos">205</span></a> <span class="s2">"aes128"</span><span class="p">,</span> -</span><span id="Redshift-206"><a href="#Redshift-206"><span class="linenos">206</span></a> <span class="s2">"aes256"</span><span class="p">,</span> -</span><span id="Redshift-207"><a href="#Redshift-207"><span class="linenos">207</span></a> <span class="s2">"all"</span><span class="p">,</span> -</span><span id="Redshift-208"><a href="#Redshift-208"><span class="linenos">208</span></a> <span class="s2">"allowoverwrite"</span><span class="p">,</span> -</span><span id="Redshift-209"><a href="#Redshift-209"><span class="linenos">209</span></a> <span class="s2">"analyse"</span><span class="p">,</span> -</span><span id="Redshift-210"><a href="#Redshift-210"><span class="linenos">210</span></a> <span class="s2">"analyze"</span><span class="p">,</span> -</span><span id="Redshift-211"><a href="#Redshift-211"><span class="linenos">211</span></a> <span class="s2">"and"</span><span class="p">,</span> -</span><span id="Redshift-212"><a href="#Redshift-212"><span class="linenos">212</span></a> <span class="s2">"any"</span><span class="p">,</span> -</span><span id="Redshift-213"><a href="#Redshift-213"><span class="linenos">213</span></a> <span class="s2">"array"</span><span class="p">,</span> -</span><span id="Redshift-214"><a href="#Redshift-214"><span class="linenos">214</span></a> <span class="s2">"as"</span><span class="p">,</span> -</span><span id="Redshift-215"><a href="#Redshift-215"><span class="linenos">215</span></a> <span class="s2">"asc"</span><span class="p">,</span> -</span><span id="Redshift-216"><a href="#Redshift-216"><span class="linenos">216</span></a> <span class="s2">"authorization"</span><span class="p">,</span> -</span><span id="Redshift-217"><a href="#Redshift-217"><span class="linenos">217</span></a> <span class="s2">"az64"</span><span class="p">,</span> -</span><span id="Redshift-218"><a href="#Redshift-218"><span class="linenos">218</span></a> <span class="s2">"backup"</span><span class="p">,</span> -</span><span id="Redshift-219"><a href="#Redshift-219"><span class="linenos">219</span></a> <span class="s2">"between"</span><span class="p">,</span> -</span><span id="Redshift-220"><a href="#Redshift-220"><span class="linenos">220</span></a> <span class="s2">"binary"</span><span class="p">,</span> -</span><span id="Redshift-221"><a href="#Redshift-221"><span class="linenos">221</span></a> <span class="s2">"blanksasnull"</span><span class="p">,</span> -</span><span id="Redshift-222"><a href="#Redshift-222"><span class="linenos">222</span></a> <span class="s2">"both"</span><span class="p">,</span> -</span><span id="Redshift-223"><a href="#Redshift-223"><span class="linenos">223</span></a> <span class="s2">"bytedict"</span><span class="p">,</span> -</span><span id="Redshift-224"><a href="#Redshift-224"><span class="linenos">224</span></a> <span class="s2">"bzip2"</span><span class="p">,</span> -</span><span id="Redshift-225"><a href="#Redshift-225"><span class="linenos">225</span></a> <span class="s2">"case"</span><span class="p">,</span> -</span><span id="Redshift-226"><a href="#Redshift-226"><span class="linenos">226</span></a> <span class="s2">"cast"</span><span class="p">,</span> -</span><span id="Redshift-227"><a href="#Redshift-227"><span class="linenos">227</span></a> <span class="s2">"check"</span><span class="p">,</span> -</span><span id="Redshift-228"><a href="#Redshift-228"><span class="linenos">228</span></a> <span class="s2">"collate"</span><span class="p">,</span> -</span><span id="Redshift-229"><a href="#Redshift-229"><span class="linenos">229</span></a> <span class="s2">"column"</span><span class="p">,</span> -</span><span id="Redshift-230"><a href="#Redshift-230"><span class="linenos">230</span></a> <span class="s2">"constraint"</span><span class="p">,</span> -</span><span id="Redshift-231"><a href="#Redshift-231"><span class="linenos">231</span></a> <span class="s2">"create"</span><span class="p">,</span> -</span><span id="Redshift-232"><a href="#Redshift-232"><span class="linenos">232</span></a> <span class="s2">"credentials"</span><span class="p">,</span> -</span><span id="Redshift-233"><a href="#Redshift-233"><span class="linenos">233</span></a> <span class="s2">"cross"</span><span class="p">,</span> -</span><span id="Redshift-234"><a href="#Redshift-234"><span class="linenos">234</span></a> <span class="s2">"current_date"</span><span class="p">,</span> -</span><span id="Redshift-235"><a href="#Redshift-235"><span class="linenos">235</span></a> <span class="s2">"current_time"</span><span class="p">,</span> -</span><span id="Redshift-236"><a href="#Redshift-236"><span class="linenos">236</span></a> <span class="s2">"current_timestamp"</span><span class="p">,</span> -</span><span id="Redshift-237"><a href="#Redshift-237"><span class="linenos">237</span></a> <span class="s2">"current_user"</span><span class="p">,</span> -</span><span id="Redshift-238"><a href="#Redshift-238"><span class="linenos">238</span></a> <span class="s2">"current_user_id"</span><span class="p">,</span> -</span><span id="Redshift-239"><a href="#Redshift-239"><span class="linenos">239</span></a> <span class="s2">"default"</span><span class="p">,</span> -</span><span id="Redshift-240"><a href="#Redshift-240"><span class="linenos">240</span></a> <span class="s2">"deferrable"</span><span class="p">,</span> -</span><span id="Redshift-241"><a href="#Redshift-241"><span class="linenos">241</span></a> <span class="s2">"deflate"</span><span class="p">,</span> -</span><span id="Redshift-242"><a href="#Redshift-242"><span class="linenos">242</span></a> <span class="s2">"defrag"</span><span class="p">,</span> -</span><span id="Redshift-243"><a href="#Redshift-243"><span class="linenos">243</span></a> <span class="s2">"delta"</span><span class="p">,</span> -</span><span id="Redshift-244"><a href="#Redshift-244"><span class="linenos">244</span></a> <span class="s2">"delta32k"</span><span class="p">,</span> -</span><span id="Redshift-245"><a href="#Redshift-245"><span class="linenos">245</span></a> <span class="s2">"desc"</span><span class="p">,</span> -</span><span id="Redshift-246"><a href="#Redshift-246"><span class="linenos">246</span></a> <span class="s2">"disable"</span><span class="p">,</span> -</span><span id="Redshift-247"><a href="#Redshift-247"><span class="linenos">247</span></a> <span class="s2">"distinct"</span><span class="p">,</span> -</span><span id="Redshift-248"><a href="#Redshift-248"><span class="linenos">248</span></a> <span class="s2">"do"</span><span class="p">,</span> -</span><span id="Redshift-249"><a href="#Redshift-249"><span class="linenos">249</span></a> <span class="s2">"else"</span><span class="p">,</span> -</span><span id="Redshift-250"><a href="#Redshift-250"><span class="linenos">250</span></a> <span class="s2">"emptyasnull"</span><span class="p">,</span> -</span><span id="Redshift-251"><a href="#Redshift-251"><span class="linenos">251</span></a> <span class="s2">"enable"</span><span class="p">,</span> -</span><span id="Redshift-252"><a href="#Redshift-252"><span class="linenos">252</span></a> <span class="s2">"encode"</span><span class="p">,</span> -</span><span id="Redshift-253"><a href="#Redshift-253"><span class="linenos">253</span></a> <span class="s2">"encrypt "</span><span class="p">,</span> -</span><span id="Redshift-254"><a href="#Redshift-254"><span class="linenos">254</span></a> <span class="s2">"encryption"</span><span class="p">,</span> -</span><span id="Redshift-255"><a href="#Redshift-255"><span class="linenos">255</span></a> <span class="s2">"end"</span><span class="p">,</span> -</span><span id="Redshift-256"><a href="#Redshift-256"><span class="linenos">256</span></a> <span class="s2">"except"</span><span class="p">,</span> -</span><span id="Redshift-257"><a href="#Redshift-257"><span class="linenos">257</span></a> <span class="s2">"explicit"</span><span class="p">,</span> -</span><span id="Redshift-258"><a href="#Redshift-258"><span class="linenos">258</span></a> <span class="s2">"false"</span><span class="p">,</span> -</span><span id="Redshift-259"><a href="#Redshift-259"><span class="linenos">259</span></a> <span class="s2">"for"</span><span class="p">,</span> -</span><span id="Redshift-260"><a href="#Redshift-260"><span class="linenos">260</span></a> <span class="s2">"foreign"</span><span class="p">,</span> -</span><span id="Redshift-261"><a href="#Redshift-261"><span class="linenos">261</span></a> <span class="s2">"freeze"</span><span class="p">,</span> -</span><span id="Redshift-262"><a href="#Redshift-262"><span class="linenos">262</span></a> <span class="s2">"from"</span><span class="p">,</span> -</span><span id="Redshift-263"><a href="#Redshift-263"><span class="linenos">263</span></a> <span class="s2">"full"</span><span class="p">,</span> -</span><span id="Redshift-264"><a href="#Redshift-264"><span class="linenos">264</span></a> <span class="s2">"globaldict256"</span><span class="p">,</span> -</span><span id="Redshift-265"><a href="#Redshift-265"><span class="linenos">265</span></a> <span class="s2">"globaldict64k"</span><span class="p">,</span> -</span><span id="Redshift-266"><a href="#Redshift-266"><span class="linenos">266</span></a> <span class="s2">"grant"</span><span class="p">,</span> -</span><span id="Redshift-267"><a href="#Redshift-267"><span class="linenos">267</span></a> <span class="s2">"group"</span><span class="p">,</span> -</span><span id="Redshift-268"><a href="#Redshift-268"><span class="linenos">268</span></a> <span class="s2">"gzip"</span><span class="p">,</span> -</span><span id="Redshift-269"><a href="#Redshift-269"><span class="linenos">269</span></a> <span class="s2">"having"</span><span class="p">,</span> -</span><span id="Redshift-270"><a href="#Redshift-270"><span class="linenos">270</span></a> <span class="s2">"identity"</span><span class="p">,</span> -</span><span id="Redshift-271"><a href="#Redshift-271"><span class="linenos">271</span></a> <span class="s2">"ignore"</span><span class="p">,</span> -</span><span id="Redshift-272"><a href="#Redshift-272"><span class="linenos">272</span></a> <span class="s2">"ilike"</span><span class="p">,</span> -</span><span id="Redshift-273"><a href="#Redshift-273"><span class="linenos">273</span></a> <span class="s2">"in"</span><span class="p">,</span> -</span><span id="Redshift-274"><a href="#Redshift-274"><span class="linenos">274</span></a> <span class="s2">"initially"</span><span class="p">,</span> -</span><span id="Redshift-275"><a href="#Redshift-275"><span class="linenos">275</span></a> <span class="s2">"inner"</span><span class="p">,</span> -</span><span id="Redshift-276"><a href="#Redshift-276"><span class="linenos">276</span></a> <span class="s2">"intersect"</span><span class="p">,</span> -</span><span id="Redshift-277"><a href="#Redshift-277"><span class="linenos">277</span></a> <span class="s2">"interval"</span><span class="p">,</span> -</span><span id="Redshift-278"><a href="#Redshift-278"><span class="linenos">278</span></a> <span class="s2">"into"</span><span class="p">,</span> -</span><span id="Redshift-279"><a href="#Redshift-279"><span class="linenos">279</span></a> <span class="s2">"is"</span><span class="p">,</span> -</span><span id="Redshift-280"><a href="#Redshift-280"><span class="linenos">280</span></a> <span class="s2">"isnull"</span><span class="p">,</span> -</span><span id="Redshift-281"><a href="#Redshift-281"><span class="linenos">281</span></a> <span class="s2">"join"</span><span class="p">,</span> -</span><span id="Redshift-282"><a href="#Redshift-282"><span class="linenos">282</span></a> <span class="s2">"leading"</span><span class="p">,</span> -</span><span id="Redshift-283"><a href="#Redshift-283"><span class="linenos">283</span></a> <span class="s2">"left"</span><span class="p">,</span> -</span><span id="Redshift-284"><a href="#Redshift-284"><span class="linenos">284</span></a> <span class="s2">"like"</span><span class="p">,</span> -</span><span id="Redshift-285"><a href="#Redshift-285"><span class="linenos">285</span></a> <span class="s2">"limit"</span><span class="p">,</span> -</span><span id="Redshift-286"><a href="#Redshift-286"><span class="linenos">286</span></a> <span class="s2">"localtime"</span><span class="p">,</span> -</span><span id="Redshift-287"><a href="#Redshift-287"><span class="linenos">287</span></a> <span class="s2">"localtimestamp"</span><span class="p">,</span> -</span><span id="Redshift-288"><a href="#Redshift-288"><span class="linenos">288</span></a> <span class="s2">"lun"</span><span class="p">,</span> -</span><span id="Redshift-289"><a href="#Redshift-289"><span class="linenos">289</span></a> <span class="s2">"luns"</span><span class="p">,</span> -</span><span id="Redshift-290"><a href="#Redshift-290"><span class="linenos">290</span></a> <span class="s2">"lzo"</span><span class="p">,</span> -</span><span id="Redshift-291"><a href="#Redshift-291"><span class="linenos">291</span></a> <span class="s2">"lzop"</span><span class="p">,</span> -</span><span id="Redshift-292"><a href="#Redshift-292"><span class="linenos">292</span></a> <span class="s2">"minus"</span><span class="p">,</span> -</span><span id="Redshift-293"><a href="#Redshift-293"><span class="linenos">293</span></a> <span class="s2">"mostly16"</span><span class="p">,</span> -</span><span id="Redshift-294"><a href="#Redshift-294"><span class="linenos">294</span></a> <span class="s2">"mostly32"</span><span class="p">,</span> -</span><span id="Redshift-295"><a href="#Redshift-295"><span class="linenos">295</span></a> <span class="s2">"mostly8"</span><span class="p">,</span> -</span><span id="Redshift-296"><a href="#Redshift-296"><span class="linenos">296</span></a> <span class="s2">"natural"</span><span class="p">,</span> -</span><span id="Redshift-297"><a href="#Redshift-297"><span class="linenos">297</span></a> <span class="s2">"new"</span><span class="p">,</span> -</span><span id="Redshift-298"><a href="#Redshift-298"><span class="linenos">298</span></a> <span class="s2">"not"</span><span class="p">,</span> -</span><span id="Redshift-299"><a href="#Redshift-299"><span class="linenos">299</span></a> <span class="s2">"notnull"</span><span class="p">,</span> -</span><span id="Redshift-300"><a href="#Redshift-300"><span class="linenos">300</span></a> <span class="s2">"null"</span><span class="p">,</span> -</span><span id="Redshift-301"><a href="#Redshift-301"><span class="linenos">301</span></a> <span class="s2">"nulls"</span><span class="p">,</span> -</span><span id="Redshift-302"><a href="#Redshift-302"><span class="linenos">302</span></a> <span class="s2">"off"</span><span class="p">,</span> -</span><span id="Redshift-303"><a href="#Redshift-303"><span class="linenos">303</span></a> <span class="s2">"offline"</span><span class="p">,</span> -</span><span id="Redshift-304"><a href="#Redshift-304"><span class="linenos">304</span></a> <span class="s2">"offset"</span><span class="p">,</span> -</span><span id="Redshift-305"><a href="#Redshift-305"><span class="linenos">305</span></a> <span class="s2">"oid"</span><span class="p">,</span> -</span><span id="Redshift-306"><a href="#Redshift-306"><span class="linenos">306</span></a> <span class="s2">"old"</span><span class="p">,</span> -</span><span id="Redshift-307"><a href="#Redshift-307"><span class="linenos">307</span></a> <span class="s2">"on"</span><span class="p">,</span> -</span><span id="Redshift-308"><a href="#Redshift-308"><span class="linenos">308</span></a> <span class="s2">"only"</span><span class="p">,</span> -</span><span id="Redshift-309"><a href="#Redshift-309"><span class="linenos">309</span></a> <span class="s2">"open"</span><span class="p">,</span> -</span><span id="Redshift-310"><a href="#Redshift-310"><span class="linenos">310</span></a> <span class="s2">"or"</span><span class="p">,</span> -</span><span id="Redshift-311"><a href="#Redshift-311"><span class="linenos">311</span></a> <span class="s2">"order"</span><span class="p">,</span> -</span><span id="Redshift-312"><a href="#Redshift-312"><span class="linenos">312</span></a> <span class="s2">"outer"</span><span class="p">,</span> -</span><span id="Redshift-313"><a href="#Redshift-313"><span class="linenos">313</span></a> <span class="s2">"overlaps"</span><span class="p">,</span> -</span><span id="Redshift-314"><a href="#Redshift-314"><span class="linenos">314</span></a> <span class="s2">"parallel"</span><span class="p">,</span> -</span><span id="Redshift-315"><a href="#Redshift-315"><span class="linenos">315</span></a> <span class="s2">"partition"</span><span class="p">,</span> -</span><span id="Redshift-316"><a href="#Redshift-316"><span class="linenos">316</span></a> <span class="s2">"percent"</span><span class="p">,</span> -</span><span id="Redshift-317"><a href="#Redshift-317"><span class="linenos">317</span></a> <span class="s2">"permissions"</span><span class="p">,</span> -</span><span id="Redshift-318"><a href="#Redshift-318"><span class="linenos">318</span></a> <span class="s2">"pivot"</span><span class="p">,</span> -</span><span id="Redshift-319"><a href="#Redshift-319"><span class="linenos">319</span></a> <span class="s2">"placing"</span><span class="p">,</span> -</span><span id="Redshift-320"><a href="#Redshift-320"><span class="linenos">320</span></a> <span class="s2">"primary"</span><span class="p">,</span> -</span><span id="Redshift-321"><a href="#Redshift-321"><span class="linenos">321</span></a> <span class="s2">"raw"</span><span class="p">,</span> -</span><span id="Redshift-322"><a href="#Redshift-322"><span class="linenos">322</span></a> <span class="s2">"readratio"</span><span class="p">,</span> -</span><span id="Redshift-323"><a href="#Redshift-323"><span class="linenos">323</span></a> <span class="s2">"recover"</span><span class="p">,</span> -</span><span id="Redshift-324"><a href="#Redshift-324"><span class="linenos">324</span></a> <span class="s2">"references"</span><span class="p">,</span> -</span><span id="Redshift-325"><a href="#Redshift-325"><span class="linenos">325</span></a> <span class="s2">"rejectlog"</span><span class="p">,</span> -</span><span id="Redshift-326"><a href="#Redshift-326"><span class="linenos">326</span></a> <span class="s2">"resort"</span><span class="p">,</span> -</span><span id="Redshift-327"><a href="#Redshift-327"><span class="linenos">327</span></a> <span class="s2">"respect"</span><span class="p">,</span> -</span><span id="Redshift-328"><a href="#Redshift-328"><span class="linenos">328</span></a> <span class="s2">"restore"</span><span class="p">,</span> -</span><span id="Redshift-329"><a href="#Redshift-329"><span class="linenos">329</span></a> <span class="s2">"right"</span><span class="p">,</span> -</span><span id="Redshift-330"><a href="#Redshift-330"><span class="linenos">330</span></a> <span class="s2">"select"</span><span class="p">,</span> -</span><span id="Redshift-331"><a href="#Redshift-331"><span class="linenos">331</span></a> <span class="s2">"session_user"</span><span class="p">,</span> -</span><span id="Redshift-332"><a href="#Redshift-332"><span class="linenos">332</span></a> <span class="s2">"similar"</span><span class="p">,</span> -</span><span id="Redshift-333"><a href="#Redshift-333"><span class="linenos">333</span></a> <span class="s2">"snapshot"</span><span class="p">,</span> -</span><span id="Redshift-334"><a href="#Redshift-334"><span class="linenos">334</span></a> <span class="s2">"some"</span><span class="p">,</span> -</span><span id="Redshift-335"><a href="#Redshift-335"><span class="linenos">335</span></a> <span class="s2">"sysdate"</span><span class="p">,</span> -</span><span id="Redshift-336"><a href="#Redshift-336"><span class="linenos">336</span></a> <span class="s2">"system"</span><span class="p">,</span> -</span><span id="Redshift-337"><a href="#Redshift-337"><span class="linenos">337</span></a> <span class="s2">"table"</span><span class="p">,</span> -</span><span id="Redshift-338"><a href="#Redshift-338"><span class="linenos">338</span></a> <span class="s2">"tag"</span><span class="p">,</span> -</span><span id="Redshift-339"><a href="#Redshift-339"><span class="linenos">339</span></a> <span class="s2">"tdes"</span><span class="p">,</span> -</span><span id="Redshift-340"><a href="#Redshift-340"><span class="linenos">340</span></a> <span class="s2">"text255"</span><span class="p">,</span> -</span><span id="Redshift-341"><a href="#Redshift-341"><span class="linenos">341</span></a> <span class="s2">"text32k"</span><span class="p">,</span> -</span><span id="Redshift-342"><a href="#Redshift-342"><span class="linenos">342</span></a> <span class="s2">"then"</span><span class="p">,</span> -</span><span id="Redshift-343"><a href="#Redshift-343"><span class="linenos">343</span></a> <span class="s2">"timestamp"</span><span class="p">,</span> -</span><span id="Redshift-344"><a href="#Redshift-344"><span class="linenos">344</span></a> <span class="s2">"to"</span><span class="p">,</span> -</span><span id="Redshift-345"><a href="#Redshift-345"><span class="linenos">345</span></a> <span class="s2">"top"</span><span class="p">,</span> -</span><span id="Redshift-346"><a href="#Redshift-346"><span class="linenos">346</span></a> <span class="s2">"trailing"</span><span class="p">,</span> -</span><span id="Redshift-347"><a href="#Redshift-347"><span class="linenos">347</span></a> <span class="s2">"true"</span><span class="p">,</span> -</span><span id="Redshift-348"><a href="#Redshift-348"><span class="linenos">348</span></a> <span class="s2">"truncatecolumns"</span><span class="p">,</span> -</span><span id="Redshift-349"><a href="#Redshift-349"><span class="linenos">349</span></a> <span class="s2">"type"</span><span class="p">,</span> -</span><span id="Redshift-350"><a href="#Redshift-350"><span class="linenos">350</span></a> <span class="s2">"union"</span><span class="p">,</span> -</span><span id="Redshift-351"><a href="#Redshift-351"><span class="linenos">351</span></a> <span class="s2">"unique"</span><span class="p">,</span> -</span><span id="Redshift-352"><a href="#Redshift-352"><span class="linenos">352</span></a> <span class="s2">"unnest"</span><span class="p">,</span> -</span><span id="Redshift-353"><a href="#Redshift-353"><span class="linenos">353</span></a> <span class="s2">"unpivot"</span><span class="p">,</span> -</span><span id="Redshift-354"><a href="#Redshift-354"><span class="linenos">354</span></a> <span class="s2">"user"</span><span class="p">,</span> -</span><span id="Redshift-355"><a href="#Redshift-355"><span class="linenos">355</span></a> <span class="s2">"using"</span><span class="p">,</span> -</span><span id="Redshift-356"><a href="#Redshift-356"><span class="linenos">356</span></a> <span class="s2">"verbose"</span><span class="p">,</span> -</span><span id="Redshift-357"><a href="#Redshift-357"><span class="linenos">357</span></a> <span class="s2">"wallet"</span><span class="p">,</span> -</span><span id="Redshift-358"><a href="#Redshift-358"><span class="linenos">358</span></a> <span class="s2">"when"</span><span class="p">,</span> -</span><span id="Redshift-359"><a href="#Redshift-359"><span class="linenos">359</span></a> <span class="s2">"where"</span><span class="p">,</span> -</span><span id="Redshift-360"><a href="#Redshift-360"><span class="linenos">360</span></a> <span class="s2">"with"</span><span class="p">,</span> -</span><span id="Redshift-361"><a href="#Redshift-361"><span class="linenos">361</span></a> <span class="s2">"without"</span><span class="p">,</span> -</span><span id="Redshift-362"><a href="#Redshift-362"><span class="linenos">362</span></a> <span class="p">}</span> -</span><span id="Redshift-363"><a href="#Redshift-363"><span class="linenos">363</span></a> -</span><span id="Redshift-364"><a href="#Redshift-364"><span class="linenos">364</span></a> <span class="k">def</span> <span class="nf">unnest_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">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Redshift-365"><a href="#Redshift-365"><span class="linenos">365</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> -</span><span id="Redshift-366"><a href="#Redshift-366"><span class="linenos">366</span></a> <span class="n">num_args</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> -</span><span id="Redshift-367"><a href="#Redshift-367"><span class="linenos">367</span></a> -</span><span id="Redshift-368"><a href="#Redshift-368"><span class="linenos">368</span></a> <span class="k">if</span> <span class="n">num_args</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> -</span><span id="Redshift-369"><a href="#Redshift-369"><span class="linenos">369</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported number of arguments in UNNEST: </span><span class="si">{</span><span class="n">num_args</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> -</span><span id="Redshift-370"><a href="#Redshift-370"><span class="linenos">370</span></a> <span class="k">return</span> <span class="s2">""</span> -</span><span id="Redshift-371"><a href="#Redshift-371"><span class="linenos">371</span></a> -</span><span id="Redshift-372"><a href="#Redshift-372"><span class="linenos">372</span></a> <span class="n">arg</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">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> -</span><span id="Redshift-373"><a href="#Redshift-373"><span class="linenos">373</span></a> <span class="n">alias</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="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</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="Redshift-374"><a href="#Redshift-374"><span class="linenos">374</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">arg</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">arg</span> -</span><span id="Redshift-375"><a href="#Redshift-375"><span class="linenos">375</span></a> -</span><span id="Redshift-376"><a href="#Redshift-376"><span class="linenos">376</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Redshift-377"><a href="#Redshift-377"><span class="linenos">377</span></a><span class="w"> </span><span class="sd">"""Redshift doesn't have `WITH` as part of their with_properties so we remove it"""</span> -</span><span id="Redshift-378"><a href="#Redshift-378"><span class="linenos">378</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> -</span><span id="Redshift-379"><a href="#Redshift-379"><span class="linenos">379</span></a> -</span><span id="Redshift-380"><a href="#Redshift-380"><span class="linenos">380</span></a> <span class="k">def</span> <span class="nf">cast_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">Cast</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Redshift-381"><a href="#Redshift-381"><span class="linenos">381</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</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">JSON</span><span class="p">):</span> -</span><span id="Redshift-382"><a href="#Redshift-382"><span class="linenos">382</span></a> <span class="c1"># Redshift doesn't support a JSON type, so casting to it is treated as a noop</span> -</span><span id="Redshift-383"><a href="#Redshift-383"><span class="linenos">383</span></a> <span class="k">return</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="Redshift-384"><a href="#Redshift-384"><span class="linenos">384</span></a> -</span><span id="Redshift-385"><a href="#Redshift-385"><span class="linenos">385</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="o">=</span><span class="n">safe_prefix</span><span class="p">)</span> -</span><span id="Redshift-386"><a href="#Redshift-386"><span class="linenos">386</span></a> -</span><span id="Redshift-387"><a href="#Redshift-387"><span class="linenos">387</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="Redshift-388"><a href="#Redshift-388"><span class="linenos">388</span></a><span class="w"> </span><span class="sd">"""</span> -</span><span id="Redshift-389"><a href="#Redshift-389"><span class="linenos">389</span></a><span class="sd"> Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean</span> -</span><span id="Redshift-390"><a href="#Redshift-390"><span class="linenos">390</span></a><span class="sd"> VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type</span> -</span><span id="Redshift-391"><a href="#Redshift-391"><span class="linenos">391</span></a><span class="sd"> without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert</span> -</span><span id="Redshift-392"><a href="#Redshift-392"><span class="linenos">392</span></a><span class="sd"> `TEXT` to `VARCHAR`.</span> -</span><span id="Redshift-393"><a href="#Redshift-393"><span class="linenos">393</span></a><span class="sd"> """</span> -</span><span id="Redshift-394"><a href="#Redshift-394"><span class="linenos">394</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">"text"</span><span class="p">):</span> -</span><span id="Redshift-395"><a href="#Redshift-395"><span class="linenos">395</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</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">VARCHAR</span><span class="p">)</span> -</span><span id="Redshift-396"><a href="#Redshift-396"><span class="linenos">396</span></a> <span class="n">precision</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">"expressions"</span><span class="p">)</span> -</span><span id="Redshift-397"><a href="#Redshift-397"><span class="linenos">397</span></a> -</span><span id="Redshift-398"><a href="#Redshift-398"><span class="linenos">398</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">precision</span><span class="p">:</span> -</span><span id="Redshift-399"><a href="#Redshift-399"><span class="linenos">399</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"MAX"</span><span class="p">))</span> +</span><span id="Redshift-204"><a href="#Redshift-204"><span class="linenos">204</span></a> <span class="c1"># Redshift supports LAST_DAY(..)</span> +</span><span id="Redshift-205"><a href="#Redshift-205"><span class="linenos">205</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LastDay</span><span class="p">)</span> +</span><span id="Redshift-206"><a href="#Redshift-206"><span class="linenos">206</span></a> +</span><span id="Redshift-207"><a href="#Redshift-207"><span class="linenos">207</span></a> <span class="n">RESERVED_KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift-208"><a href="#Redshift-208"><span class="linenos">208</span></a> <span class="s2">"aes128"</span><span class="p">,</span> +</span><span id="Redshift-209"><a href="#Redshift-209"><span class="linenos">209</span></a> <span class="s2">"aes256"</span><span class="p">,</span> +</span><span id="Redshift-210"><a href="#Redshift-210"><span class="linenos">210</span></a> <span class="s2">"all"</span><span class="p">,</span> +</span><span id="Redshift-211"><a href="#Redshift-211"><span class="linenos">211</span></a> <span class="s2">"allowoverwrite"</span><span class="p">,</span> +</span><span id="Redshift-212"><a href="#Redshift-212"><span class="linenos">212</span></a> <span class="s2">"analyse"</span><span class="p">,</span> +</span><span id="Redshift-213"><a href="#Redshift-213"><span class="linenos">213</span></a> <span class="s2">"analyze"</span><span class="p">,</span> +</span><span id="Redshift-214"><a href="#Redshift-214"><span class="linenos">214</span></a> <span class="s2">"and"</span><span class="p">,</span> +</span><span id="Redshift-215"><a href="#Redshift-215"><span class="linenos">215</span></a> <span class="s2">"any"</span><span class="p">,</span> +</span><span id="Redshift-216"><a href="#Redshift-216"><span class="linenos">216</span></a> <span class="s2">"array"</span><span class="p">,</span> +</span><span id="Redshift-217"><a href="#Redshift-217"><span class="linenos">217</span></a> <span class="s2">"as"</span><span class="p">,</span> +</span><span id="Redshift-218"><a href="#Redshift-218"><span class="linenos">218</span></a> <span class="s2">"asc"</span><span class="p">,</span> +</span><span id="Redshift-219"><a href="#Redshift-219"><span class="linenos">219</span></a> <span class="s2">"authorization"</span><span class="p">,</span> +</span><span id="Redshift-220"><a href="#Redshift-220"><span class="linenos">220</span></a> <span class="s2">"az64"</span><span class="p">,</span> +</span><span id="Redshift-221"><a href="#Redshift-221"><span class="linenos">221</span></a> <span class="s2">"backup"</span><span class="p">,</span> +</span><span id="Redshift-222"><a href="#Redshift-222"><span class="linenos">222</span></a> <span class="s2">"between"</span><span class="p">,</span> +</span><span id="Redshift-223"><a href="#Redshift-223"><span class="linenos">223</span></a> <span class="s2">"binary"</span><span class="p">,</span> +</span><span id="Redshift-224"><a href="#Redshift-224"><span class="linenos">224</span></a> <span class="s2">"blanksasnull"</span><span class="p">,</span> +</span><span id="Redshift-225"><a href="#Redshift-225"><span class="linenos">225</span></a> <span class="s2">"both"</span><span class="p">,</span> +</span><span id="Redshift-226"><a href="#Redshift-226"><span class="linenos">226</span></a> <span class="s2">"bytedict"</span><span class="p">,</span> +</span><span id="Redshift-227"><a href="#Redshift-227"><span class="linenos">227</span></a> <span class="s2">"bzip2"</span><span class="p">,</span> +</span><span id="Redshift-228"><a href="#Redshift-228"><span class="linenos">228</span></a> <span class="s2">"case"</span><span class="p">,</span> +</span><span id="Redshift-229"><a href="#Redshift-229"><span class="linenos">229</span></a> <span class="s2">"cast"</span><span class="p">,</span> +</span><span id="Redshift-230"><a href="#Redshift-230"><span class="linenos">230</span></a> <span class="s2">"check"</span><span class="p">,</span> +</span><span id="Redshift-231"><a href="#Redshift-231"><span class="linenos">231</span></a> <span class="s2">"collate"</span><span class="p">,</span> +</span><span id="Redshift-232"><a href="#Redshift-232"><span class="linenos">232</span></a> <span class="s2">"column"</span><span class="p">,</span> +</span><span id="Redshift-233"><a href="#Redshift-233"><span class="linenos">233</span></a> <span class="s2">"constraint"</span><span class="p">,</span> +</span><span id="Redshift-234"><a href="#Redshift-234"><span class="linenos">234</span></a> <span class="s2">"create"</span><span class="p">,</span> +</span><span id="Redshift-235"><a href="#Redshift-235"><span class="linenos">235</span></a> <span class="s2">"credentials"</span><span class="p">,</span> +</span><span id="Redshift-236"><a href="#Redshift-236"><span class="linenos">236</span></a> <span class="s2">"cross"</span><span class="p">,</span> +</span><span id="Redshift-237"><a href="#Redshift-237"><span class="linenos">237</span></a> <span class="s2">"current_date"</span><span class="p">,</span> +</span><span id="Redshift-238"><a href="#Redshift-238"><span class="linenos">238</span></a> <span class="s2">"current_time"</span><span class="p">,</span> +</span><span id="Redshift-239"><a href="#Redshift-239"><span class="linenos">239</span></a> <span class="s2">"current_timestamp"</span><span class="p">,</span> +</span><span id="Redshift-240"><a href="#Redshift-240"><span class="linenos">240</span></a> <span class="s2">"current_user"</span><span class="p">,</span> +</span><span id="Redshift-241"><a href="#Redshift-241"><span class="linenos">241</span></a> <span class="s2">"current_user_id"</span><span class="p">,</span> +</span><span id="Redshift-242"><a href="#Redshift-242"><span class="linenos">242</span></a> <span class="s2">"default"</span><span class="p">,</span> +</span><span id="Redshift-243"><a href="#Redshift-243"><span class="linenos">243</span></a> <span class="s2">"deferrable"</span><span class="p">,</span> +</span><span id="Redshift-244"><a href="#Redshift-244"><span class="linenos">244</span></a> <span class="s2">"deflate"</span><span class="p">,</span> +</span><span id="Redshift-245"><a href="#Redshift-245"><span class="linenos">245</span></a> <span class="s2">"defrag"</span><span class="p">,</span> +</span><span id="Redshift-246"><a href="#Redshift-246"><span class="linenos">246</span></a> <span class="s2">"delta"</span><span class="p">,</span> +</span><span id="Redshift-247"><a href="#Redshift-247"><span class="linenos">247</span></a> <span class="s2">"delta32k"</span><span class="p">,</span> +</span><span id="Redshift-248"><a href="#Redshift-248"><span class="linenos">248</span></a> <span class="s2">"desc"</span><span class="p">,</span> +</span><span id="Redshift-249"><a href="#Redshift-249"><span class="linenos">249</span></a> <span class="s2">"disable"</span><span class="p">,</span> +</span><span id="Redshift-250"><a href="#Redshift-250"><span class="linenos">250</span></a> <span class="s2">"distinct"</span><span class="p">,</span> +</span><span id="Redshift-251"><a href="#Redshift-251"><span class="linenos">251</span></a> <span class="s2">"do"</span><span class="p">,</span> +</span><span id="Redshift-252"><a href="#Redshift-252"><span class="linenos">252</span></a> <span class="s2">"else"</span><span class="p">,</span> +</span><span id="Redshift-253"><a href="#Redshift-253"><span class="linenos">253</span></a> <span class="s2">"emptyasnull"</span><span class="p">,</span> +</span><span id="Redshift-254"><a href="#Redshift-254"><span class="linenos">254</span></a> <span class="s2">"enable"</span><span class="p">,</span> +</span><span id="Redshift-255"><a href="#Redshift-255"><span class="linenos">255</span></a> <span class="s2">"encode"</span><span class="p">,</span> +</span><span id="Redshift-256"><a href="#Redshift-256"><span class="linenos">256</span></a> <span class="s2">"encrypt "</span><span class="p">,</span> +</span><span id="Redshift-257"><a href="#Redshift-257"><span class="linenos">257</span></a> <span class="s2">"encryption"</span><span class="p">,</span> +</span><span id="Redshift-258"><a href="#Redshift-258"><span class="linenos">258</span></a> <span class="s2">"end"</span><span class="p">,</span> +</span><span id="Redshift-259"><a href="#Redshift-259"><span class="linenos">259</span></a> <span class="s2">"except"</span><span class="p">,</span> +</span><span id="Redshift-260"><a href="#Redshift-260"><span class="linenos">260</span></a> <span class="s2">"explicit"</span><span class="p">,</span> +</span><span id="Redshift-261"><a href="#Redshift-261"><span class="linenos">261</span></a> <span class="s2">"false"</span><span class="p">,</span> +</span><span id="Redshift-262"><a href="#Redshift-262"><span class="linenos">262</span></a> <span class="s2">"for"</span><span class="p">,</span> +</span><span id="Redshift-263"><a href="#Redshift-263"><span class="linenos">263</span></a> <span class="s2">"foreign"</span><span class="p">,</span> +</span><span id="Redshift-264"><a href="#Redshift-264"><span class="linenos">264</span></a> <span class="s2">"freeze"</span><span class="p">,</span> +</span><span id="Redshift-265"><a href="#Redshift-265"><span class="linenos">265</span></a> <span class="s2">"from"</span><span class="p">,</span> +</span><span id="Redshift-266"><a href="#Redshift-266"><span class="linenos">266</span></a> <span class="s2">"full"</span><span class="p">,</span> +</span><span id="Redshift-267"><a href="#Redshift-267"><span class="linenos">267</span></a> <span class="s2">"globaldict256"</span><span class="p">,</span> +</span><span id="Redshift-268"><a href="#Redshift-268"><span class="linenos">268</span></a> <span class="s2">"globaldict64k"</span><span class="p">,</span> +</span><span id="Redshift-269"><a href="#Redshift-269"><span class="linenos">269</span></a> <span class="s2">"grant"</span><span class="p">,</span> +</span><span id="Redshift-270"><a href="#Redshift-270"><span class="linenos">270</span></a> <span class="s2">"group"</span><span class="p">,</span> +</span><span id="Redshift-271"><a href="#Redshift-271"><span class="linenos">271</span></a> <span class="s2">"gzip"</span><span class="p">,</span> +</span><span id="Redshift-272"><a href="#Redshift-272"><span class="linenos">272</span></a> <span class="s2">"having"</span><span class="p">,</span> +</span><span id="Redshift-273"><a href="#Redshift-273"><span class="linenos">273</span></a> <span class="s2">"identity"</span><span class="p">,</span> +</span><span id="Redshift-274"><a href="#Redshift-274"><span class="linenos">274</span></a> <span class="s2">"ignore"</span><span class="p">,</span> +</span><span id="Redshift-275"><a href="#Redshift-275"><span class="linenos">275</span></a> <span class="s2">"ilike"</span><span class="p">,</span> +</span><span id="Redshift-276"><a href="#Redshift-276"><span class="linenos">276</span></a> <span class="s2">"in"</span><span class="p">,</span> +</span><span id="Redshift-277"><a href="#Redshift-277"><span class="linenos">277</span></a> <span class="s2">"initially"</span><span class="p">,</span> +</span><span id="Redshift-278"><a href="#Redshift-278"><span class="linenos">278</span></a> <span class="s2">"inner"</span><span class="p">,</span> +</span><span id="Redshift-279"><a href="#Redshift-279"><span class="linenos">279</span></a> <span class="s2">"intersect"</span><span class="p">,</span> +</span><span id="Redshift-280"><a href="#Redshift-280"><span class="linenos">280</span></a> <span class="s2">"interval"</span><span class="p">,</span> +</span><span id="Redshift-281"><a href="#Redshift-281"><span class="linenos">281</span></a> <span class="s2">"into"</span><span class="p">,</span> +</span><span id="Redshift-282"><a href="#Redshift-282"><span class="linenos">282</span></a> <span class="s2">"is"</span><span class="p">,</span> +</span><span id="Redshift-283"><a href="#Redshift-283"><span class="linenos">283</span></a> <span class="s2">"isnull"</span><span class="p">,</span> +</span><span id="Redshift-284"><a href="#Redshift-284"><span class="linenos">284</span></a> <span class="s2">"join"</span><span class="p">,</span> +</span><span id="Redshift-285"><a href="#Redshift-285"><span class="linenos">285</span></a> <span class="s2">"leading"</span><span class="p">,</span> +</span><span id="Redshift-286"><a href="#Redshift-286"><span class="linenos">286</span></a> <span class="s2">"left"</span><span class="p">,</span> +</span><span id="Redshift-287"><a href="#Redshift-287"><span class="linenos">287</span></a> <span class="s2">"like"</span><span class="p">,</span> +</span><span id="Redshift-288"><a href="#Redshift-288"><span class="linenos">288</span></a> <span class="s2">"limit"</span><span class="p">,</span> +</span><span id="Redshift-289"><a href="#Redshift-289"><span class="linenos">289</span></a> <span class="s2">"localtime"</span><span class="p">,</span> +</span><span id="Redshift-290"><a href="#Redshift-290"><span class="linenos">290</span></a> <span class="s2">"localtimestamp"</span><span class="p">,</span> +</span><span id="Redshift-291"><a href="#Redshift-291"><span class="linenos">291</span></a> <span class="s2">"lun"</span><span class="p">,</span> +</span><span id="Redshift-292"><a href="#Redshift-292"><span class="linenos">292</span></a> <span class="s2">"luns"</span><span class="p">,</span> +</span><span id="Redshift-293"><a href="#Redshift-293"><span class="linenos">293</span></a> <span class="s2">"lzo"</span><span class="p">,</span> +</span><span id="Redshift-294"><a href="#Redshift-294"><span class="linenos">294</span></a> <span class="s2">"lzop"</span><span class="p">,</span> +</span><span id="Redshift-295"><a href="#Redshift-295"><span class="linenos">295</span></a> <span class="s2">"minus"</span><span class="p">,</span> +</span><span id="Redshift-296"><a href="#Redshift-296"><span class="linenos">296</span></a> <span class="s2">"mostly16"</span><span class="p">,</span> +</span><span id="Redshift-297"><a href="#Redshift-297"><span class="linenos">297</span></a> <span class="s2">"mostly32"</span><span class="p">,</span> +</span><span id="Redshift-298"><a href="#Redshift-298"><span class="linenos">298</span></a> <span class="s2">"mostly8"</span><span class="p">,</span> +</span><span id="Redshift-299"><a href="#Redshift-299"><span class="linenos">299</span></a> <span class="s2">"natural"</span><span class="p">,</span> +</span><span id="Redshift-300"><a href="#Redshift-300"><span class="linenos">300</span></a> <span class="s2">"new"</span><span class="p">,</span> +</span><span id="Redshift-301"><a href="#Redshift-301"><span class="linenos">301</span></a> <span class="s2">"not"</span><span class="p">,</span> +</span><span id="Redshift-302"><a href="#Redshift-302"><span class="linenos">302</span></a> <span class="s2">"notnull"</span><span class="p">,</span> +</span><span id="Redshift-303"><a href="#Redshift-303"><span class="linenos">303</span></a> <span class="s2">"null"</span><span class="p">,</span> +</span><span id="Redshift-304"><a href="#Redshift-304"><span class="linenos">304</span></a> <span class="s2">"nulls"</span><span class="p">,</span> +</span><span id="Redshift-305"><a href="#Redshift-305"><span class="linenos">305</span></a> <span class="s2">"off"</span><span class="p">,</span> +</span><span id="Redshift-306"><a href="#Redshift-306"><span class="linenos">306</span></a> <span class="s2">"offline"</span><span class="p">,</span> +</span><span id="Redshift-307"><a href="#Redshift-307"><span class="linenos">307</span></a> <span class="s2">"offset"</span><span class="p">,</span> +</span><span id="Redshift-308"><a href="#Redshift-308"><span class="linenos">308</span></a> <span class="s2">"oid"</span><span class="p">,</span> +</span><span id="Redshift-309"><a href="#Redshift-309"><span class="linenos">309</span></a> <span class="s2">"old"</span><span class="p">,</span> +</span><span id="Redshift-310"><a href="#Redshift-310"><span class="linenos">310</span></a> <span class="s2">"on"</span><span class="p">,</span> +</span><span id="Redshift-311"><a href="#Redshift-311"><span class="linenos">311</span></a> <span class="s2">"only"</span><span class="p">,</span> +</span><span id="Redshift-312"><a href="#Redshift-312"><span class="linenos">312</span></a> <span class="s2">"open"</span><span class="p">,</span> +</span><span id="Redshift-313"><a href="#Redshift-313"><span class="linenos">313</span></a> <span class="s2">"or"</span><span class="p">,</span> +</span><span id="Redshift-314"><a href="#Redshift-314"><span class="linenos">314</span></a> <span class="s2">"order"</span><span class="p">,</span> +</span><span id="Redshift-315"><a href="#Redshift-315"><span class="linenos">315</span></a> <span class="s2">"outer"</span><span class="p">,</span> +</span><span id="Redshift-316"><a href="#Redshift-316"><span class="linenos">316</span></a> <span class="s2">"overlaps"</span><span class="p">,</span> +</span><span id="Redshift-317"><a href="#Redshift-317"><span class="linenos">317</span></a> <span class="s2">"parallel"</span><span class="p">,</span> +</span><span id="Redshift-318"><a href="#Redshift-318"><span class="linenos">318</span></a> <span class="s2">"partition"</span><span class="p">,</span> +</span><span id="Redshift-319"><a href="#Redshift-319"><span class="linenos">319</span></a> <span class="s2">"percent"</span><span class="p">,</span> +</span><span id="Redshift-320"><a href="#Redshift-320"><span class="linenos">320</span></a> <span class="s2">"permissions"</span><span class="p">,</span> +</span><span id="Redshift-321"><a href="#Redshift-321"><span class="linenos">321</span></a> <span class="s2">"pivot"</span><span class="p">,</span> +</span><span id="Redshift-322"><a href="#Redshift-322"><span class="linenos">322</span></a> <span class="s2">"placing"</span><span class="p">,</span> +</span><span id="Redshift-323"><a href="#Redshift-323"><span class="linenos">323</span></a> <span class="s2">"primary"</span><span class="p">,</span> +</span><span id="Redshift-324"><a href="#Redshift-324"><span class="linenos">324</span></a> <span class="s2">"raw"</span><span class="p">,</span> +</span><span id="Redshift-325"><a href="#Redshift-325"><span class="linenos">325</span></a> <span class="s2">"readratio"</span><span class="p">,</span> +</span><span id="Redshift-326"><a href="#Redshift-326"><span class="linenos">326</span></a> <span class="s2">"recover"</span><span class="p">,</span> +</span><span id="Redshift-327"><a href="#Redshift-327"><span class="linenos">327</span></a> <span class="s2">"references"</span><span class="p">,</span> +</span><span id="Redshift-328"><a href="#Redshift-328"><span class="linenos">328</span></a> <span class="s2">"rejectlog"</span><span class="p">,</span> +</span><span id="Redshift-329"><a href="#Redshift-329"><span class="linenos">329</span></a> <span class="s2">"resort"</span><span class="p">,</span> +</span><span id="Redshift-330"><a href="#Redshift-330"><span class="linenos">330</span></a> <span class="s2">"respect"</span><span class="p">,</span> +</span><span id="Redshift-331"><a href="#Redshift-331"><span class="linenos">331</span></a> <span class="s2">"restore"</span><span class="p">,</span> +</span><span id="Redshift-332"><a href="#Redshift-332"><span class="linenos">332</span></a> <span class="s2">"right"</span><span class="p">,</span> +</span><span id="Redshift-333"><a href="#Redshift-333"><span class="linenos">333</span></a> <span class="s2">"select"</span><span class="p">,</span> +</span><span id="Redshift-334"><a href="#Redshift-334"><span class="linenos">334</span></a> <span class="s2">"session_user"</span><span class="p">,</span> +</span><span id="Redshift-335"><a href="#Redshift-335"><span class="linenos">335</span></a> <span class="s2">"similar"</span><span class="p">,</span> +</span><span id="Redshift-336"><a href="#Redshift-336"><span class="linenos">336</span></a> <span class="s2">"snapshot"</span><span class="p">,</span> +</span><span id="Redshift-337"><a href="#Redshift-337"><span class="linenos">337</span></a> <span class="s2">"some"</span><span class="p">,</span> +</span><span id="Redshift-338"><a href="#Redshift-338"><span class="linenos">338</span></a> <span class="s2">"sysdate"</span><span class="p">,</span> +</span><span id="Redshift-339"><a href="#Redshift-339"><span class="linenos">339</span></a> <span class="s2">"system"</span><span class="p">,</span> +</span><span id="Redshift-340"><a href="#Redshift-340"><span class="linenos">340</span></a> <span class="s2">"table"</span><span class="p">,</span> +</span><span id="Redshift-341"><a href="#Redshift-341"><span class="linenos">341</span></a> <span class="s2">"tag"</span><span class="p">,</span> +</span><span id="Redshift-342"><a href="#Redshift-342"><span class="linenos">342</span></a> <span class="s2">"tdes"</span><span class="p">,</span> +</span><span id="Redshift-343"><a href="#Redshift-343"><span class="linenos">343</span></a> <span class="s2">"text255"</span><span class="p">,</span> +</span><span id="Redshift-344"><a href="#Redshift-344"><span class="linenos">344</span></a> <span class="s2">"text32k"</span><span class="p">,</span> +</span><span id="Redshift-345"><a href="#Redshift-345"><span class="linenos">345</span></a> <span class="s2">"then"</span><span class="p">,</span> +</span><span id="Redshift-346"><a href="#Redshift-346"><span class="linenos">346</span></a> <span class="s2">"timestamp"</span><span class="p">,</span> +</span><span id="Redshift-347"><a href="#Redshift-347"><span class="linenos">347</span></a> <span class="s2">"to"</span><span class="p">,</span> +</span><span id="Redshift-348"><a href="#Redshift-348"><span class="linenos">348</span></a> <span class="s2">"top"</span><span class="p">,</span> +</span><span id="Redshift-349"><a href="#Redshift-349"><span class="linenos">349</span></a> <span class="s2">"trailing"</span><span class="p">,</span> +</span><span id="Redshift-350"><a href="#Redshift-350"><span class="linenos">350</span></a> <span class="s2">"true"</span><span class="p">,</span> +</span><span id="Redshift-351"><a href="#Redshift-351"><span class="linenos">351</span></a> <span class="s2">"truncatecolumns"</span><span class="p">,</span> +</span><span id="Redshift-352"><a href="#Redshift-352"><span class="linenos">352</span></a> <span class="s2">"type"</span><span class="p">,</span> +</span><span id="Redshift-353"><a href="#Redshift-353"><span class="linenos">353</span></a> <span class="s2">"union"</span><span class="p">,</span> +</span><span id="Redshift-354"><a href="#Redshift-354"><span class="linenos">354</span></a> <span class="s2">"unique"</span><span class="p">,</span> +</span><span id="Redshift-355"><a href="#Redshift-355"><span class="linenos">355</span></a> <span class="s2">"unnest"</span><span class="p">,</span> +</span><span id="Redshift-356"><a href="#Redshift-356"><span class="linenos">356</span></a> <span class="s2">"unpivot"</span><span class="p">,</span> +</span><span id="Redshift-357"><a href="#Redshift-357"><span class="linenos">357</span></a> <span class="s2">"user"</span><span class="p">,</span> +</span><span id="Redshift-358"><a href="#Redshift-358"><span class="linenos">358</span></a> <span class="s2">"using"</span><span class="p">,</span> +</span><span id="Redshift-359"><a href="#Redshift-359"><span class="linenos">359</span></a> <span class="s2">"verbose"</span><span class="p">,</span> +</span><span id="Redshift-360"><a href="#Redshift-360"><span class="linenos">360</span></a> <span class="s2">"wallet"</span><span class="p">,</span> +</span><span id="Redshift-361"><a href="#Redshift-361"><span class="linenos">361</span></a> <span class="s2">"when"</span><span class="p">,</span> +</span><span id="Redshift-362"><a href="#Redshift-362"><span class="linenos">362</span></a> <span class="s2">"where"</span><span class="p">,</span> +</span><span id="Redshift-363"><a href="#Redshift-363"><span class="linenos">363</span></a> <span class="s2">"with"</span><span class="p">,</span> +</span><span id="Redshift-364"><a href="#Redshift-364"><span class="linenos">364</span></a> <span class="s2">"without"</span><span class="p">,</span> +</span><span id="Redshift-365"><a href="#Redshift-365"><span class="linenos">365</span></a> <span class="p">}</span> +</span><span id="Redshift-366"><a href="#Redshift-366"><span class="linenos">366</span></a> +</span><span id="Redshift-367"><a href="#Redshift-367"><span class="linenos">367</span></a> <span class="k">def</span> <span class="nf">unnest_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">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift-368"><a href="#Redshift-368"><span class="linenos">368</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Redshift-369"><a href="#Redshift-369"><span class="linenos">369</span></a> <span class="n">num_args</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="Redshift-370"><a href="#Redshift-370"><span class="linenos">370</span></a> +</span><span id="Redshift-371"><a href="#Redshift-371"><span class="linenos">371</span></a> <span class="k">if</span> <span class="n">num_args</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Redshift-372"><a href="#Redshift-372"><span class="linenos">372</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported number of arguments in UNNEST: </span><span class="si">{</span><span class="n">num_args</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Redshift-373"><a href="#Redshift-373"><span class="linenos">373</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Redshift-374"><a href="#Redshift-374"><span class="linenos">374</span></a> +</span><span id="Redshift-375"><a href="#Redshift-375"><span class="linenos">375</span></a> <span class="n">arg</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">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> +</span><span id="Redshift-376"><a href="#Redshift-376"><span class="linenos">376</span></a> <span class="n">alias</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="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</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="Redshift-377"><a href="#Redshift-377"><span class="linenos">377</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">arg</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">arg</span> +</span><span id="Redshift-378"><a href="#Redshift-378"><span class="linenos">378</span></a> +</span><span id="Redshift-379"><a href="#Redshift-379"><span class="linenos">379</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift-380"><a href="#Redshift-380"><span class="linenos">380</span></a><span class="w"> </span><span class="sd">"""Redshift doesn't have `WITH` as part of their with_properties so we remove it"""</span> +</span><span id="Redshift-381"><a href="#Redshift-381"><span class="linenos">381</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Redshift-382"><a href="#Redshift-382"><span class="linenos">382</span></a> +</span><span id="Redshift-383"><a href="#Redshift-383"><span class="linenos">383</span></a> <span class="k">def</span> <span class="nf">cast_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">Cast</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift-384"><a href="#Redshift-384"><span class="linenos">384</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</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">JSON</span><span class="p">):</span> +</span><span id="Redshift-385"><a href="#Redshift-385"><span class="linenos">385</span></a> <span class="c1"># Redshift doesn't support a JSON type, so casting to it is treated as a noop</span> +</span><span id="Redshift-386"><a href="#Redshift-386"><span class="linenos">386</span></a> <span class="k">return</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="Redshift-387"><a href="#Redshift-387"><span class="linenos">387</span></a> +</span><span id="Redshift-388"><a href="#Redshift-388"><span class="linenos">388</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="o">=</span><span class="n">safe_prefix</span><span class="p">)</span> +</span><span id="Redshift-389"><a href="#Redshift-389"><span class="linenos">389</span></a> +</span><span id="Redshift-390"><a href="#Redshift-390"><span class="linenos">390</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="Redshift-391"><a href="#Redshift-391"><span class="linenos">391</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Redshift-392"><a href="#Redshift-392"><span class="linenos">392</span></a><span class="sd"> Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean</span> +</span><span id="Redshift-393"><a href="#Redshift-393"><span class="linenos">393</span></a><span class="sd"> VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type</span> +</span><span id="Redshift-394"><a href="#Redshift-394"><span class="linenos">394</span></a><span class="sd"> without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert</span> +</span><span id="Redshift-395"><a href="#Redshift-395"><span class="linenos">395</span></a><span class="sd"> `TEXT` to `VARCHAR`.</span> +</span><span id="Redshift-396"><a href="#Redshift-396"><span class="linenos">396</span></a><span class="sd"> """</span> +</span><span id="Redshift-397"><a href="#Redshift-397"><span class="linenos">397</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">"text"</span><span class="p">):</span> +</span><span id="Redshift-398"><a href="#Redshift-398"><span class="linenos">398</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</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">VARCHAR</span><span class="p">)</span> +</span><span id="Redshift-399"><a href="#Redshift-399"><span class="linenos">399</span></a> <span class="n">precision</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">"expressions"</span><span class="p">)</span> </span><span id="Redshift-400"><a href="#Redshift-400"><span class="linenos">400</span></a> -</span><span id="Redshift-401"><a href="#Redshift-401"><span class="linenos">401</span></a> <span class="k">return</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="Redshift-401"><a href="#Redshift-401"><span class="linenos">401</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">precision</span><span class="p">:</span> +</span><span id="Redshift-402"><a href="#Redshift-402"><span class="linenos">402</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"MAX"</span><span class="p">))</span> +</span><span id="Redshift-403"><a href="#Redshift-403"><span class="linenos">403</span></a> +</span><span id="Redshift-404"><a href="#Redshift-404"><span class="linenos">404</span></a> <span class="k">return</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></pre></div> @@ -1085,6 +1097,20 @@ </div> + <div id="Redshift.HEX_LOWERCASE" class="classattr"> + <div class="attr variable"> + <span class="name">HEX_LOWERCASE</span> = +<span class="default_value">True</span> + + + </div> + <a class="headerlink" href="#Redshift.HEX_LOWERCASE"></a> + + <div class="docstring"><p>Whether the <code>HEX</code> function returns a lowercase hexadecimal string.</p> +</div> + + + </div> <div id="Redshift.TIME_FORMAT" class="classattr"> <div class="attr variable"> <span class="name">TIME_FORMAT</span> = @@ -1381,7 +1407,6 @@ <dd id="Redshift.WEEK_OFFSET" class="variable"><a href="dialect.html#Dialect.WEEK_OFFSET">WEEK_OFFSET</a></dd> <dd id="Redshift.UNNEST_COLUMN_ONLY" class="variable"><a href="dialect.html#Dialect.UNNEST_COLUMN_ONLY">UNNEST_COLUMN_ONLY</a></dd> <dd id="Redshift.ALIAS_POST_TABLESAMPLE" class="variable"><a href="dialect.html#Dialect.ALIAS_POST_TABLESAMPLE">ALIAS_POST_TABLESAMPLE</a></dd> - <dd id="Redshift.TABLESAMPLE_SIZE_IS_PERCENT" class="variable"><a href="dialect.html#Dialect.TABLESAMPLE_SIZE_IS_PERCENT">TABLESAMPLE_SIZE_IS_PERCENT</a></dd> <dd id="Redshift.IDENTIFIERS_CAN_START_WITH_DIGIT" class="variable"><a href="dialect.html#Dialect.IDENTIFIERS_CAN_START_WITH_DIGIT">IDENTIFIERS_CAN_START_WITH_DIGIT</a></dd> <dd id="Redshift.DPIPE_IS_STRING_CONCAT" class="variable"><a href="dialect.html#Dialect.DPIPE_IS_STRING_CONCAT">DPIPE_IS_STRING_CONCAT</a></dd> <dd id="Redshift.STRICT_STRING_CONCAT" class="variable"><a href="dialect.html#Dialect.STRICT_STRING_CONCAT">STRICT_STRING_CONCAT</a></dd> @@ -1415,6 +1440,7 @@ <dd id="Redshift.TYPED_DIVISION" class="variable"><a href="postgres.html#Postgres.TYPED_DIVISION">TYPED_DIVISION</a></dd> <dd id="Redshift.CONCAT_COALESCE" class="variable"><a href="postgres.html#Postgres.CONCAT_COALESCE">CONCAT_COALESCE</a></dd> <dd id="Redshift.NULL_ORDERING" class="variable"><a href="postgres.html#Postgres.NULL_ORDERING">NULL_ORDERING</a></dd> + <dd id="Redshift.TABLESAMPLE_SIZE_IS_PERCENT" class="variable"><a href="postgres.html#Postgres.TABLESAMPLE_SIZE_IS_PERCENT">TABLESAMPLE_SIZE_IS_PERCENT</a></dd> </div> </dl> @@ -1431,69 +1457,69 @@ </div> <a class="headerlink" href="#Redshift.Parser"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Parser-51"><a href="#Redshift.Parser-51"><span class="linenos"> 51</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> -</span><span id="Redshift.Parser-52"><a href="#Redshift.Parser-52"><span class="linenos"> 52</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift.Parser-53"><a href="#Redshift.Parser-53"><span class="linenos"> 53</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> -</span><span id="Redshift.Parser-54"><a href="#Redshift.Parser-54"><span class="linenos"> 54</span></a> <span class="s2">"ADD_MONTHS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">(</span> -</span><span id="Redshift.Parser-55"><a href="#Redshift.Parser-55"><span class="linenos"> 55</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> -</span><span id="Redshift.Parser-56"><a href="#Redshift.Parser-56"><span class="linenos"> 56</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> -</span><span id="Redshift.Parser-57"><a href="#Redshift.Parser-57"><span class="linenos"> 57</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"month"</span><span class="p">),</span> -</span><span id="Redshift.Parser-58"><a href="#Redshift.Parser-58"><span class="linenos"> 58</span></a> <span class="n">return_type</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">build</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">),</span> -</span><span id="Redshift.Parser-59"><a href="#Redshift.Parser-59"><span class="linenos"> 59</span></a> <span class="p">),</span> -</span><span id="Redshift.Parser-60"><a href="#Redshift.Parser-60"><span class="linenos"> 60</span></a> <span class="s2">"DATEADD"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">),</span> -</span><span id="Redshift.Parser-61"><a href="#Redshift.Parser-61"><span class="linenos"> 61</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">),</span> -</span><span id="Redshift.Parser-62"><a href="#Redshift.Parser-62"><span class="linenos"> 62</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">),</span> -</span><span id="Redshift.Parser-63"><a href="#Redshift.Parser-63"><span class="linenos"> 63</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">),</span> -</span><span id="Redshift.Parser-64"><a href="#Redshift.Parser-64"><span class="linenos"> 64</span></a> <span class="s2">"GETDATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Redshift.Parser-65"><a href="#Redshift.Parser-65"><span class="linenos"> 65</span></a> <span class="s2">"LISTAGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Redshift.Parser-66"><a href="#Redshift.Parser-66"><span class="linenos"> 66</span></a> <span class="s2">"STRTOL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">FromBase</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> -</span><span id="Redshift.Parser-67"><a href="#Redshift.Parser-67"><span class="linenos"> 67</span></a> <span class="p">}</span> -</span><span id="Redshift.Parser-68"><a href="#Redshift.Parser-68"><span class="linenos"> 68</span></a> -</span><span id="Redshift.Parser-69"><a href="#Redshift.Parser-69"><span class="linenos"> 69</span></a> <span class="n">NO_PAREN_FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift.Parser-70"><a href="#Redshift.Parser-70"><span class="linenos"> 70</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTION_PARSERS</span><span class="p">,</span> -</span><span id="Redshift.Parser-71"><a href="#Redshift.Parser-71"><span class="linenos"> 71</span></a> <span class="s2">"APPROXIMATE"</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_approximate_count</span><span class="p">(),</span> -</span><span id="Redshift.Parser-72"><a href="#Redshift.Parser-72"><span class="linenos"> 72</span></a> <span class="s2">"SYSDATE"</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">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">,</span> <span class="n">transaction</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> -</span><span id="Redshift.Parser-73"><a href="#Redshift.Parser-73"><span class="linenos"> 73</span></a> <span class="p">}</span> -</span><span id="Redshift.Parser-74"><a href="#Redshift.Parser-74"><span class="linenos"> 74</span></a> -</span><span id="Redshift.Parser-75"><a href="#Redshift.Parser-75"><span class="linenos"> 75</span></a> <span class="n">SUPPORTS_IMPLICIT_UNNEST</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Redshift.Parser-76"><a href="#Redshift.Parser-76"><span class="linenos"> 76</span></a> -</span><span id="Redshift.Parser-77"><a href="#Redshift.Parser-77"><span class="linenos"> 77</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> -</span><span id="Redshift.Parser-78"><a href="#Redshift.Parser-78"><span class="linenos"> 78</span></a> <span class="bp">self</span><span class="p">,</span> -</span><span id="Redshift.Parser-79"><a href="#Redshift.Parser-79"><span class="linenos"> 79</span></a> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="Redshift.Parser-80"><a href="#Redshift.Parser-80"><span class="linenos"> 80</span></a> <span class="n">joins</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="Redshift.Parser-81"><a href="#Redshift.Parser-81"><span class="linenos"> 81</span></a> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> -</span><span id="Redshift.Parser-82"><a href="#Redshift.Parser-82"><span class="linenos"> 82</span></a> <span class="n">parse_bracket</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="Redshift.Parser-83"><a href="#Redshift.Parser-83"><span class="linenos"> 83</span></a> <span class="n">is_db_reference</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="Redshift.Parser-84"><a href="#Redshift.Parser-84"><span class="linenos"> 84</span></a> <span class="n">parse_partition</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> -</span><span id="Redshift.Parser-85"><a href="#Redshift.Parser-85"><span class="linenos"> 85</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> -</span><span id="Redshift.Parser-86"><a href="#Redshift.Parser-86"><span class="linenos"> 86</span></a> <span class="c1"># Redshift supports UNPIVOTing SUPER objects, e.g. `UNPIVOT foo.obj[0] AS val AT attr`</span> -</span><span id="Redshift.Parser-87"><a href="#Redshift.Parser-87"><span class="linenos"> 87</span></a> <span class="n">unpivot</span> <span class="o">=</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">UNPIVOT</span><span class="p">)</span> -</span><span id="Redshift.Parser-88"><a href="#Redshift.Parser-88"><span class="linenos"> 88</span></a> <span class="n">table</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span> -</span><span id="Redshift.Parser-89"><a href="#Redshift.Parser-89"><span class="linenos"> 89</span></a> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> -</span><span id="Redshift.Parser-90"><a href="#Redshift.Parser-90"><span class="linenos"> 90</span></a> <span class="n">joins</span><span class="o">=</span><span class="n">joins</span><span class="p">,</span> -</span><span id="Redshift.Parser-91"><a href="#Redshift.Parser-91"><span class="linenos"> 91</span></a> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">,</span> -</span><span id="Redshift.Parser-92"><a href="#Redshift.Parser-92"><span class="linenos"> 92</span></a> <span class="n">parse_bracket</span><span class="o">=</span><span class="n">parse_bracket</span><span class="p">,</span> -</span><span id="Redshift.Parser-93"><a href="#Redshift.Parser-93"><span class="linenos"> 93</span></a> <span class="n">is_db_reference</span><span class="o">=</span><span class="n">is_db_reference</span><span class="p">,</span> -</span><span id="Redshift.Parser-94"><a href="#Redshift.Parser-94"><span class="linenos"> 94</span></a> <span class="p">)</span> -</span><span id="Redshift.Parser-95"><a href="#Redshift.Parser-95"><span class="linenos"> 95</span></a> -</span><span id="Redshift.Parser-96"><a href="#Redshift.Parser-96"><span class="linenos"> 96</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">Pivot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">unpivot</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="k">if</span> <span class="n">unpivot</span> <span class="k">else</span> <span class="n">table</span> -</span><span id="Redshift.Parser-97"><a href="#Redshift.Parser-97"><span class="linenos"> 97</span></a> -</span><span id="Redshift.Parser-98"><a href="#Redshift.Parser-98"><span class="linenos"> 98</span></a> <span class="k">def</span> <span class="nf">_parse_convert</span><span class="p">(</span> -</span><span id="Redshift.Parser-99"><a href="#Redshift.Parser-99"><span class="linenos"> 99</span></a> <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="n">safe</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> -</span><span id="Redshift.Parser-100"><a href="#Redshift.Parser-100"><span class="linenos">100</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> -</span><span id="Redshift.Parser-101"><a href="#Redshift.Parser-101"><span class="linenos">101</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> -</span><span id="Redshift.Parser-102"><a href="#Redshift.Parser-102"><span class="linenos">102</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">COMMA</span><span class="p">)</span> -</span><span id="Redshift.Parser-103"><a href="#Redshift.Parser-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_bitwise</span><span class="p">()</span> -</span><span id="Redshift.Parser-104"><a href="#Redshift.Parser-104"><span class="linenos">104</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">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 class="n">safe</span><span class="o">=</span><span class="n">safe</span><span class="p">)</span> -</span><span id="Redshift.Parser-105"><a href="#Redshift.Parser-105"><span class="linenos">105</span></a> -</span><span id="Redshift.Parser-106"><a href="#Redshift.Parser-106"><span class="linenos">106</span></a> <span class="k">def</span> <span class="nf">_parse_approximate_count</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">]:</span> -</span><span id="Redshift.Parser-107"><a href="#Redshift.Parser-107"><span class="linenos">107</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">-</span> <span class="mi">1</span> -</span><span id="Redshift.Parser-108"><a href="#Redshift.Parser-108"><span class="linenos">108</span></a> <span class="n">func</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> -</span><span id="Redshift.Parser-109"><a href="#Redshift.Parser-109"><span class="linenos">109</span></a> -</span><span id="Redshift.Parser-110"><a href="#Redshift.Parser-110"><span class="linenos">110</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> -</span><span id="Redshift.Parser-111"><a href="#Redshift.Parser-111"><span class="linenos">111</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">ApproxDistinct</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> -</span><span id="Redshift.Parser-112"><a href="#Redshift.Parser-112"><span class="linenos">112</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> -</span><span id="Redshift.Parser-113"><a href="#Redshift.Parser-113"><span class="linenos">113</span></a> <span class="k">return</span> <span class="kc">None</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Parser-52"><a href="#Redshift.Parser-52"><span class="linenos"> 52</span></a> <span class="k">class</span> <span class="nc">Parser</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="p">):</span> +</span><span id="Redshift.Parser-53"><a href="#Redshift.Parser-53"><span class="linenos"> 53</span></a> <span class="n">FUNCTIONS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift.Parser-54"><a href="#Redshift.Parser-54"><span class="linenos"> 54</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">FUNCTIONS</span><span class="p">,</span> +</span><span id="Redshift.Parser-55"><a href="#Redshift.Parser-55"><span class="linenos"> 55</span></a> <span class="s2">"ADD_MONTHS"</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">args</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">(</span> +</span><span id="Redshift.Parser-56"><a href="#Redshift.Parser-56"><span class="linenos"> 56</span></a> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> +</span><span id="Redshift.Parser-57"><a href="#Redshift.Parser-57"><span class="linenos"> 57</span></a> <span class="n">expression</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> +</span><span id="Redshift.Parser-58"><a href="#Redshift.Parser-58"><span class="linenos"> 58</span></a> <span class="n">unit</span><span class="o">=</span><span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"month"</span><span class="p">),</span> +</span><span id="Redshift.Parser-59"><a href="#Redshift.Parser-59"><span class="linenos"> 59</span></a> <span class="n">return_type</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">build</span><span class="p">(</span><span class="s2">"TIMESTAMP"</span><span class="p">),</span> +</span><span id="Redshift.Parser-60"><a href="#Redshift.Parser-60"><span class="linenos"> 60</span></a> <span class="p">),</span> +</span><span id="Redshift.Parser-61"><a href="#Redshift.Parser-61"><span class="linenos"> 61</span></a> <span class="s2">"DATEADD"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">),</span> +</span><span id="Redshift.Parser-62"><a href="#Redshift.Parser-62"><span class="linenos"> 62</span></a> <span class="s2">"DATE_ADD"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">),</span> +</span><span id="Redshift.Parser-63"><a href="#Redshift.Parser-63"><span class="linenos"> 63</span></a> <span class="s2">"DATEDIFF"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">),</span> +</span><span id="Redshift.Parser-64"><a href="#Redshift.Parser-64"><span class="linenos"> 64</span></a> <span class="s2">"DATE_DIFF"</span><span class="p">:</span> <span class="n">_build_date_delta</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">),</span> +</span><span id="Redshift.Parser-65"><a href="#Redshift.Parser-65"><span class="linenos"> 65</span></a> <span class="s2">"GETDATE"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Redshift.Parser-66"><a href="#Redshift.Parser-66"><span class="linenos"> 66</span></a> <span class="s2">"LISTAGG"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Redshift.Parser-67"><a href="#Redshift.Parser-67"><span class="linenos"> 67</span></a> <span class="s2">"STRTOL"</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">FromBase</span><span class="o">.</span><span class="n">from_arg_list</span><span class="p">,</span> +</span><span id="Redshift.Parser-68"><a href="#Redshift.Parser-68"><span class="linenos"> 68</span></a> <span class="p">}</span> +</span><span id="Redshift.Parser-69"><a href="#Redshift.Parser-69"><span class="linenos"> 69</span></a> +</span><span id="Redshift.Parser-70"><a href="#Redshift.Parser-70"><span class="linenos"> 70</span></a> <span class="n">NO_PAREN_FUNCTION_PARSERS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift.Parser-71"><a href="#Redshift.Parser-71"><span class="linenos"> 71</span></a> <span class="o">**</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Parser</span><span class="o">.</span><span class="n">NO_PAREN_FUNCTION_PARSERS</span><span class="p">,</span> +</span><span id="Redshift.Parser-72"><a href="#Redshift.Parser-72"><span class="linenos"> 72</span></a> <span class="s2">"APPROXIMATE"</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_approximate_count</span><span class="p">(),</span> +</span><span id="Redshift.Parser-73"><a href="#Redshift.Parser-73"><span class="linenos"> 73</span></a> <span class="s2">"SYSDATE"</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">expression</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</span><span class="p">,</span> <span class="n">transaction</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span> +</span><span id="Redshift.Parser-74"><a href="#Redshift.Parser-74"><span class="linenos"> 74</span></a> <span class="p">}</span> +</span><span id="Redshift.Parser-75"><a href="#Redshift.Parser-75"><span class="linenos"> 75</span></a> +</span><span id="Redshift.Parser-76"><a href="#Redshift.Parser-76"><span class="linenos"> 76</span></a> <span class="n">SUPPORTS_IMPLICIT_UNNEST</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Redshift.Parser-77"><a href="#Redshift.Parser-77"><span class="linenos"> 77</span></a> +</span><span id="Redshift.Parser-78"><a href="#Redshift.Parser-78"><span class="linenos"> 78</span></a> <span class="k">def</span> <span class="nf">_parse_table</span><span class="p">(</span> +</span><span id="Redshift.Parser-79"><a href="#Redshift.Parser-79"><span class="linenos"> 79</span></a> <span class="bp">self</span><span class="p">,</span> +</span><span id="Redshift.Parser-80"><a href="#Redshift.Parser-80"><span class="linenos"> 80</span></a> <span class="n">schema</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Redshift.Parser-81"><a href="#Redshift.Parser-81"><span class="linenos"> 81</span></a> <span class="n">joins</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Redshift.Parser-82"><a href="#Redshift.Parser-82"><span class="linenos"> 82</span></a> <span class="n">alias_tokens</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">t</span><span class="o">.</span><span class="n">Collection</span><span class="p">[</span><span class="n">TokenType</span><span class="p">]]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> +</span><span id="Redshift.Parser-83"><a href="#Redshift.Parser-83"><span class="linenos"> 83</span></a> <span class="n">parse_bracket</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Redshift.Parser-84"><a href="#Redshift.Parser-84"><span class="linenos"> 84</span></a> <span class="n">is_db_reference</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Redshift.Parser-85"><a href="#Redshift.Parser-85"><span class="linenos"> 85</span></a> <span class="n">parse_partition</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">,</span> +</span><span id="Redshift.Parser-86"><a href="#Redshift.Parser-86"><span class="linenos"> 86</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Redshift.Parser-87"><a href="#Redshift.Parser-87"><span class="linenos"> 87</span></a> <span class="c1"># Redshift supports UNPIVOTing SUPER objects, e.g. `UNPIVOT foo.obj[0] AS val AT attr`</span> +</span><span id="Redshift.Parser-88"><a href="#Redshift.Parser-88"><span class="linenos"> 88</span></a> <span class="n">unpivot</span> <span class="o">=</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">UNPIVOT</span><span class="p">)</span> +</span><span id="Redshift.Parser-89"><a href="#Redshift.Parser-89"><span class="linenos"> 89</span></a> <span class="n">table</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">_parse_table</span><span class="p">(</span> +</span><span id="Redshift.Parser-90"><a href="#Redshift.Parser-90"><span class="linenos"> 90</span></a> <span class="n">schema</span><span class="o">=</span><span class="n">schema</span><span class="p">,</span> +</span><span id="Redshift.Parser-91"><a href="#Redshift.Parser-91"><span class="linenos"> 91</span></a> <span class="n">joins</span><span class="o">=</span><span class="n">joins</span><span class="p">,</span> +</span><span id="Redshift.Parser-92"><a href="#Redshift.Parser-92"><span class="linenos"> 92</span></a> <span class="n">alias_tokens</span><span class="o">=</span><span class="n">alias_tokens</span><span class="p">,</span> +</span><span id="Redshift.Parser-93"><a href="#Redshift.Parser-93"><span class="linenos"> 93</span></a> <span class="n">parse_bracket</span><span class="o">=</span><span class="n">parse_bracket</span><span class="p">,</span> +</span><span id="Redshift.Parser-94"><a href="#Redshift.Parser-94"><span class="linenos"> 94</span></a> <span class="n">is_db_reference</span><span class="o">=</span><span class="n">is_db_reference</span><span class="p">,</span> +</span><span id="Redshift.Parser-95"><a href="#Redshift.Parser-95"><span class="linenos"> 95</span></a> <span class="p">)</span> +</span><span id="Redshift.Parser-96"><a href="#Redshift.Parser-96"><span class="linenos"> 96</span></a> +</span><span id="Redshift.Parser-97"><a href="#Redshift.Parser-97"><span class="linenos"> 97</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">Pivot</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">table</span><span class="p">,</span> <span class="n">unpivot</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> <span class="k">if</span> <span class="n">unpivot</span> <span class="k">else</span> <span class="n">table</span> +</span><span id="Redshift.Parser-98"><a href="#Redshift.Parser-98"><span class="linenos"> 98</span></a> +</span><span id="Redshift.Parser-99"><a href="#Redshift.Parser-99"><span class="linenos"> 99</span></a> <span class="k">def</span> <span class="nf">_parse_convert</span><span class="p">(</span> +</span><span id="Redshift.Parser-100"><a href="#Redshift.Parser-100"><span class="linenos">100</span></a> <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="n">safe</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span> +</span><span id="Redshift.Parser-101"><a href="#Redshift.Parser-101"><span class="linenos">101</span></a> <span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">Expression</span><span class="p">]:</span> +</span><span id="Redshift.Parser-102"><a href="#Redshift.Parser-102"><span class="linenos">102</span></a> <span class="n">to</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_types</span><span class="p">()</span> +</span><span id="Redshift.Parser-103"><a href="#Redshift.Parser-103"><span class="linenos">103</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">COMMA</span><span class="p">)</span> +</span><span id="Redshift.Parser-104"><a href="#Redshift.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_bitwise</span><span class="p">()</span> +</span><span id="Redshift.Parser-105"><a href="#Redshift.Parser-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 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 class="n">safe</span><span class="o">=</span><span class="n">safe</span><span class="p">)</span> +</span><span id="Redshift.Parser-106"><a href="#Redshift.Parser-106"><span class="linenos">106</span></a> +</span><span id="Redshift.Parser-107"><a href="#Redshift.Parser-107"><span class="linenos">107</span></a> <span class="k">def</span> <span class="nf">_parse_approximate_count</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">]:</span> +</span><span id="Redshift.Parser-108"><a href="#Redshift.Parser-108"><span class="linenos">108</span></a> <span class="n">index</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_index</span> <span class="o">-</span> <span class="mi">1</span> +</span><span id="Redshift.Parser-109"><a href="#Redshift.Parser-109"><span class="linenos">109</span></a> <span class="n">func</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_parse_function</span><span class="p">()</span> +</span><span id="Redshift.Parser-110"><a href="#Redshift.Parser-110"><span class="linenos">110</span></a> +</span><span id="Redshift.Parser-111"><a href="#Redshift.Parser-111"><span class="linenos">111</span></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">func</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Count</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">this</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">Distinct</span><span class="p">):</span> +</span><span id="Redshift.Parser-112"><a href="#Redshift.Parser-112"><span class="linenos">112</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">ApproxDistinct</span><span class="p">,</span> <span class="n">this</span><span class="o">=</span><span class="n">seq_get</span><span class="p">(</span><span class="n">func</span><span class="o">.</span><span class="n">this</span><span class="o">.</span><span class="n">expressions</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> +</span><span id="Redshift.Parser-113"><a href="#Redshift.Parser-113"><span class="linenos">113</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">_retreat</span><span class="p">(</span><span class="n">index</span><span class="p">)</span> +</span><span id="Redshift.Parser-114"><a href="#Redshift.Parser-114"><span class="linenos">114</span></a> <span class="k">return</span> <span class="kc">None</span> </span></pre></div> @@ -1518,7 +1544,7 @@ Default: 3</li> <div class="attr variable"> <span class="name">FUNCTIONS</span> = <input id="Redshift.Parser.FUNCTIONS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> - <label class="view-value-button pdoc-button" for="Redshift.Parser.FUNCTIONS-view-value"></label><span class="default_value">{'ABS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Abs">sqlglot.expressions.Abs</a>'>>, 'ADD_MONTHS': <function <a href="#Redshift.Parser">Redshift.Parser</a>.<lambda>>, 'ANONYMOUS_AGG_FUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#AnonymousAggFunc">sqlglot.expressions.AnonymousAggFunc</a>'>>, 'ANY_VALUE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#AnyValue">sqlglot.expressions.AnyValue</a>'>>, 'APPROX_DISTINCT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a>'>>, 'APPROX_COUNT_DISTINCT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a>'>>, 'APPROX_QUANTILE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxQuantile">sqlglot.expressions.ApproxQuantile</a>'>>, 'APPROX_TOP_K': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxTopK">sqlglot.expressions.ApproxTopK</a>'>>, 'ARG_MAX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>>, 'ARGMAX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>>, 'MAX_BY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>>, 'ARG_MIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>>, 'ARGMIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>>, 'MIN_BY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>>, 'ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Array">sqlglot.expressions.Array</a>'>>, 'ARRAY_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayAgg">sqlglot.expressions.ArrayAgg</a>'>>, 'ARRAY_ALL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayAll">sqlglot.expressions.ArrayAll</a>'>>, 'ARRAY_ANY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayAny">sqlglot.expressions.ArrayAny</a>'>>, 'ARRAY_CONCAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayConcat">sqlglot.expressions.ArrayConcat</a>'>>, 'ARRAY_CAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayConcat">sqlglot.expressions.ArrayConcat</a>'>>, 'ARRAY_CONTAINS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayContains">sqlglot.expressions.ArrayContains</a>'>>, 'FILTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayFilter">sqlglot.expressions.ArrayFilter</a>'>>, 'ARRAY_FILTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayFilter">sqlglot.expressions.ArrayFilter</a>'>>, 'ARRAY_OVERLAPS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayOverlaps">sqlglot.expressions.ArrayOverlaps</a>'>>, 'ARRAY_SIZE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySize">sqlglot.expressions.ArraySize</a>'>>, 'ARRAY_LENGTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySize">sqlglot.expressions.ArraySize</a>'>>, 'ARRAY_SORT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySort">sqlglot.expressions.ArraySort</a>'>>, 'ARRAY_SUM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySum">sqlglot.expressions.ArraySum</a>'>>, 'ARRAY_TO_STRING': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayToString">sqlglot.expressions.ArrayToString</a>'>>, 'ARRAY_JOIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayToString">sqlglot.expressions.ArrayToString</a>'>>, 'ARRAY_UNION_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayUnionAgg">sqlglot.expressions.ArrayUnionAgg</a>'>>, 'ARRAY_UNIQUE_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayUniqueAgg">sqlglot.expressions.ArrayUniqueAgg</a>'>>, 'AVG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Avg">sqlglot.expressions.Avg</a>'>>, 'CASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Case">sqlglot.expressions.Case</a>'>>, 'CAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Cast">sqlglot.expressions.Cast</a>'>>, 'CAST_TO_STR_TYPE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CastToStrType">sqlglot.expressions.CastToStrType</a>'>>, 'CBRT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Cbrt">sqlglot.expressions.Cbrt</a>'>>, 'CEIL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Ceil">sqlglot.expressions.Ceil</a>'>>, 'CEILING': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Ceil">sqlglot.expressions.Ceil</a>'>>, 'CHR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Chr">sqlglot.expressions.Chr</a>'>>, 'CHAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Chr">sqlglot.expressions.Chr</a>'>>, 'COALESCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a>'>>, 'IFNULL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a>'>>, 'NVL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a>'>>, 'COLLATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Collate">sqlglot.expressions.Collate</a>'>>, 'COMBINED_AGG_FUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CombinedAggFunc">sqlglot.expressions.CombinedAggFunc</a>'>>, 'COMBINED_PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CombinedParameterizedAgg">sqlglot.expressions.CombinedParameterizedAgg</a>'>>, 'CONCAT': <function Parser.<lambda>>, 'CONCAT_WS': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ConnectByRoot">sqlglot.expressions.ConnectByRoot</a>'>>, 'CONVERT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Convert">sqlglot.expressions.Convert</a>'>>, 'CORR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Corr">sqlglot.expressions.Corr</a>'>>, 'COUNT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Count">sqlglot.expressions.Count</a>'>>, 'COUNT_IF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CountIf">sqlglot.expressions.CountIf</a>'>>, 'COUNTIF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CountIf">sqlglot.expressions.CountIf</a>'>>, 'COVAR_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CovarPop">sqlglot.expressions.CovarPop</a>'>>, 'COVAR_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CovarSamp">sqlglot.expressions.CovarSamp</a>'>>, 'CURRENT_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentDate">sqlglot.expressions.CurrentDate</a>'>>, 'CURRENT_DATETIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentDatetime">sqlglot.expressions.CurrentDatetime</a>'>>, 'CURRENT_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTime">sqlglot.expressions.CurrentTime</a>'>>, 'CURRENT_TIMESTAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentUser">sqlglot.expressions.CurrentUser</a>'>>, 'DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Date">sqlglot.expressions.Date</a>'>>, 'DATE_ADD': <function _build_date_delta.<locals>._builder>, 'DATEDIFF': <function _build_date_delta.<locals>._builder>, 'DATE_DIFF': <function _build_date_delta.<locals>._builder>, 'DATE_FROM_PARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateFromParts">sqlglot.expressions.DateFromParts</a>'>>, 'DATEFROMPARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateFromParts">sqlglot.expressions.DateFromParts</a>'>>, 'DATE_STR_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateStrToDate">sqlglot.expressions.DateStrToDate</a>'>>, 'DATE_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateSub">sqlglot.expressions.DateSub</a>'>>, 'DATE_TO_DATE_STR': <function Parser.<lambda>>, 'DATE_TO_DI': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateToDi">sqlglot.expressions.DateToDi</a>'>>, 'DATE_TRUNC': <function build_timestamp_trunc>, 'DATETIME_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeAdd">sqlglot.expressions.DatetimeAdd</a>'>>, 'DATETIME_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeDiff">sqlglot.expressions.DatetimeDiff</a>'>>, 'DATETIME_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeSub">sqlglot.expressions.DatetimeSub</a>'>>, 'DATETIME_TRUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeTrunc">sqlglot.expressions.DatetimeTrunc</a>'>>, 'DAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Day">sqlglot.expressions.Day</a>'>>, 'DAY_OF_MONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfMonth">sqlglot.expressions.DayOfMonth</a>'>>, 'DAYOFMONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfMonth">sqlglot.expressions.DayOfMonth</a>'>>, 'DAY_OF_WEEK': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfWeek">sqlglot.expressions.DayOfWeek</a>'>>, 'DAYOFWEEK': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfWeek">sqlglot.expressions.DayOfWeek</a>'>>, 'DAY_OF_YEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfYear">sqlglot.expressions.DayOfYear</a>'>>, 'DAYOFYEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfYear">sqlglot.expressions.DayOfYear</a>'>>, 'DECODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Decode">sqlglot.expressions.Decode</a>'>>, 'DI_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DiToDate">sqlglot.expressions.DiToDate</a>'>>, 'ENCODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Encode">sqlglot.expressions.Encode</a>'>>, 'EXP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Exp">sqlglot.expressions.Exp</a>'>>, 'EXPLODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Explode">sqlglot.expressions.Explode</a>'>>, 'EXPLODE_OUTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ExplodeOuter">sqlglot.expressions.ExplodeOuter</a>'>>, 'EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Extract">sqlglot.expressions.Extract</a>'>>, 'FIRST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#First">sqlglot.expressions.First</a>'>>, 'FIRST_VALUE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#FirstValue">sqlglot.expressions.FirstValue</a>'>>, 'FLATTEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Flatten">sqlglot.expressions.Flatten</a>'>>, 'FLOOR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Floor">sqlglot.expressions.Floor</a>'>>, 'FROM_BASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#FromBase">sqlglot.expressions.FromBase</a>'>>, 'FROM_BASE64': <bound method Func.from_arg_list of <class '<a href="../expressions.html#FromBase64">sqlglot.expressions.FromBase64</a>'>>, 'GENERATE_DATE_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GenerateDateArray">sqlglot.expressions.GenerateDateArray</a>'>>, 'GENERATE_SERIES': <function _build_generate_series>, 'GREATEST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Greatest">sqlglot.expressions.Greatest</a>'>>, 'GROUP_CONCAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GroupConcat">sqlglot.expressions.GroupConcat</a>'>>, 'HEX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Hex">sqlglot.expressions.Hex</a>'>>, 'HLL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Hll">sqlglot.expressions.Hll</a>'>>, 'IF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#If">sqlglot.expressions.If</a>'>>, 'IIF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#If">sqlglot.expressions.If</a>'>>, 'INITCAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Initcap">sqlglot.expressions.Initcap</a>'>>, 'IS_INF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsInf">sqlglot.expressions.IsInf</a>'>>, 'ISINF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsInf">sqlglot.expressions.IsInf</a>'>>, 'IS_NAN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsNan">sqlglot.expressions.IsNan</a>'>>, 'ISNAN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsNan">sqlglot.expressions.IsNan</a>'>>, 'J_S_O_N_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONArray">sqlglot.expressions.JSONArray</a>'>>, 'J_S_O_N_ARRAY_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONArrayAgg">sqlglot.expressions.JSONArrayAgg</a>'>>, 'JSON_ARRAY_CONTAINS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONArrayContains">sqlglot.expressions.JSONArrayContains</a>'>>, 'JSONB_EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONBExtract">sqlglot.expressions.JSONBExtract</a>'>>, 'JSONB_EXTRACT_SCALAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONBExtractScalar">sqlglot.expressions.JSONBExtractScalar</a>'>>, 'JSON_EXTRACT': <function build_extract_json_with_path.<locals>._builder>, 'JSON_EXTRACT_SCALAR': <function build_extract_json_with_path.<locals>._builder>, 'JSON_FORMAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONFormat">sqlglot.expressions.JSONFormat</a>'>>, 'J_S_O_N_OBJECT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONObject">sqlglot.expressions.JSONObject</a>'>>, 'J_S_O_N_OBJECT_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONObjectAgg">sqlglot.expressions.JSONObjectAgg</a>'>>, 'J_S_O_N_TABLE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONTable">sqlglot.expressions.JSONTable</a>'>>, 'LAG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Lag">sqlglot.expressions.Lag</a>'>>, 'LAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Last">sqlglot.expressions.Last</a>'>>, 'LAST_DAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LastDay">sqlglot.expressions.LastDay</a>'>>, 'LAST_DAY_OF_MONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LastDay">sqlglot.expressions.LastDay</a>'>>, 'LAST_VALUE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LastValue">sqlglot.expressions.LastValue</a>'>>, 'LEAD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Lead">sqlglot.expressions.Lead</a>'>>, 'LEAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Least">sqlglot.expressions.Least</a>'>>, 'LEFT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Left">sqlglot.expressions.Left</a>'>>, 'LENGTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Length">sqlglot.expressions.Length</a>'>>, 'LEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Length">sqlglot.expressions.Length</a>'>>, 'LEVENSHTEIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Levenshtein">sqlglot.expressions.Levenshtein</a>'>>, 'LN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Ln">sqlglot.expressions.Ln</a>'>>, 'LOG': <function build_logarithm>, 'LOGICAL_AND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>>, 'BOOL_AND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>>, 'BOOLAND_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>>, 'LOGICAL_OR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>>, 'BOOL_OR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>>, 'BOOLOR_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>>, 'LOWER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Lower">sqlglot.expressions.Lower</a>'>>, 'LCASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Lower">sqlglot.expressions.Lower</a>'>>, 'MD5': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MD5">sqlglot.expressions.MD5</a>'>>, 'MD5_DIGEST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MD5Digest">sqlglot.expressions.MD5Digest</a>'>>, 'MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Map">sqlglot.expressions.Map</a>'>>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MapFromEntries">sqlglot.expressions.MapFromEntries</a>'>>, 'MATCH_AGAINST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MatchAgainst">sqlglot.expressions.MatchAgainst</a>'>>, 'MAX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Max">sqlglot.expressions.Max</a>'>>, 'MIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Min">sqlglot.expressions.Min</a>'>>, 'MONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Month">sqlglot.expressions.Month</a>'>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MonthsBetween">sqlglot.expressions.MonthsBetween</a>'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#NextValueFor">sqlglot.expressions.NextValueFor</a>'>>, 'NTH_VALUE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#NthValue">sqlglot.expressions.NthValue</a>'>>, 'NULLIF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Nullif">sqlglot.expressions.Nullif</a>'>>, 'NUMBER_TO_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#NumberToStr">sqlglot.expressions.NumberToStr</a>'>>, 'NVL2': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Nvl2">sqlglot.expressions.Nvl2</a>'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class '<a href="../expressions.html#OpenJSON">sqlglot.expressions.OpenJSON</a>'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ParameterizedAgg">sqlglot.expressions.ParameterizedAgg</a>'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ParseJSON">sqlglot.expressions.ParseJSON</a>'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ParseJSON">sqlglot.expressions.ParseJSON</a>'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#PercentileCont">sqlglot.expressions.PercentileCont</a>'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#PercentileDisc">sqlglot.expressions.PercentileDisc</a>'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Posexplode">sqlglot.expressions.Posexplode</a>'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#PosexplodeOuter">sqlglot.expressions.PosexplodeOuter</a>'>>, 'POWER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Pow">sqlglot.expressions.Pow</a>'>>, 'POW': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Pow">sqlglot.expressions.Pow</a>'>>, 'PREDICT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Predict">sqlglot.expressions.Predict</a>'>>, 'QUANTILE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Quantile">sqlglot.expressions.Quantile</a>'>>, 'QUARTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Quarter">sqlglot.expressions.Quarter</a>'>>, 'RAND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Rand">sqlglot.expressions.Rand</a>'>>, 'RANDOM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Rand">sqlglot.expressions.Rand</a>'>>, 'RANDN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Randn">sqlglot.expressions.Randn</a>'>>, 'RANGE_N': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RangeN">sqlglot.expressions.RangeN</a>'>>, 'READ_CSV': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ReadCSV">sqlglot.expressions.ReadCSV</a>'>>, 'REDUCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Reduce">sqlglot.expressions.Reduce</a>'>>, 'REGEXP_EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpExtract">sqlglot.expressions.RegexpExtract</a>'>>, 'REGEXP_I_LIKE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpILike">sqlglot.expressions.RegexpILike</a>'>>, 'REGEXP_LIKE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpLike">sqlglot.expressions.RegexpLike</a>'>>, 'REGEXP_REPLACE': <function _build_regexp_replace>, 'REGEXP_SPLIT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpSplit">sqlglot.expressions.RegexpSplit</a>'>>, 'REPEAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Repeat">sqlglot.expressions.Repeat</a>'>>, 'RIGHT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Right">sqlglot.expressions.Right</a>'>>, 'ROUND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Round">sqlglot.expressions.Round</a>'>>, 'ROW_NUMBER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RowNumber">sqlglot.expressions.RowNumber</a>'>>, 'SHA': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SHA">sqlglot.expressions.SHA</a>'>>, 'SHA1': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SHA">sqlglot.expressions.SHA</a>'>>, 'SHA2': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SHA2">sqlglot.expressions.SHA2</a>'>>, 'SAFE_DIVIDE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SafeDivide">sqlglot.expressions.SafeDivide</a>'>>, 'SIGN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Sign">sqlglot.expressions.Sign</a>'>>, 'SIGNUM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Sign">sqlglot.expressions.Sign</a>'>>, 'SORT_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SortArray">sqlglot.expressions.SortArray</a>'>>, 'SPLIT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Split">sqlglot.expressions.Split</a>'>>, 'SQRT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Sqrt">sqlglot.expressions.Sqrt</a>'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StandardHash">sqlglot.expressions.StandardHash</a>'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StarMap">sqlglot.expressions.StarMap</a>'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StartsWith">sqlglot.expressions.StartsWith</a>'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StartsWith">sqlglot.expressions.StartsWith</a>'>>, 'STDDEV': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Stddev">sqlglot.expressions.Stddev</a>'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StddevPop">sqlglot.expressions.StddevPop</a>'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StddevSamp">sqlglot.expressions.StddevSamp</a>'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrPosition">sqlglot.expressions.StrPosition</a>'>>, 'STR_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToDate">sqlglot.expressions.StrToDate</a>'>>, 'STR_TO_MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToMap">sqlglot.expressions.StrToMap</a>'>>, 'STR_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToTime">sqlglot.expressions.StrToTime</a>'>>, 'STR_TO_UNIX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToUnix">sqlglot.expressions.StrToUnix</a>'>>, 'STRUCT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Struct">sqlglot.expressions.Struct</a>'>>, 'STRUCT_EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StructExtract">sqlglot.expressions.StructExtract</a>'>>, 'STUFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Stuff">sqlglot.expressions.Stuff</a>'>>, 'INSERT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Stuff">sqlglot.expressions.Stuff</a>'>>, 'SUBSTRING': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Substring">sqlglot.expressions.Substring</a>'>>, 'SUM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Sum">sqlglot.expressions.Sum</a>'>>, 'TIME_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeAdd">sqlglot.expressions.TimeAdd</a>'>>, 'TIME_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeDiff">sqlglot.expressions.TimeDiff</a>'>>, 'TIME_FROM_PARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeFromParts">sqlglot.expressions.TimeFromParts</a>'>>, 'TIMEFROMPARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeFromParts">sqlglot.expressions.TimeFromParts</a>'>>, 'TIME_STR_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeStrToDate">sqlglot.expressions.TimeStrToDate</a>'>>, 'TIME_STR_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeStrToTime">sqlglot.expressions.TimeStrToTime</a>'>>, 'TIME_STR_TO_UNIX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeStrToUnix">sqlglot.expressions.TimeStrToUnix</a>'>>, 'TIME_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeSub">sqlglot.expressions.TimeSub</a>'>>, 'TIME_TO_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeToStr">sqlglot.expressions.TimeToStr</a>'>>, 'TIME_TO_TIME_STR': <function Parser.<lambda>>, 'TIME_TO_UNIX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeToUnix">sqlglot.expressions.TimeToUnix</a>'>>, 'TIME_TRUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeTrunc">sqlglot.expressions.TimeTrunc</a>'>>, 'TIMESTAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Timestamp">sqlglot.expressions.Timestamp</a>'>>, 'TIMESTAMP_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampAdd">sqlglot.expressions.TimestampAdd</a>'>>, 'TIMESTAMPDIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampDiff">sqlglot.expressions.TimestampDiff</a>'>>, 'TIMESTAMP_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampDiff">sqlglot.expressions.TimestampDiff</a>'>>, 'TIMESTAMP_FROM_PARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampFromParts">sqlglot.expressions.TimestampFromParts</a>'>>, 'TIMESTAMPFROMPARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampFromParts">sqlglot.expressions.TimestampFromParts</a>'>>, 'TIMESTAMP_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampSub">sqlglot.expressions.TimestampSub</a>'>>, 'TIMESTAMP_TRUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampTrunc">sqlglot.expressions.TimestampTrunc</a>'>>, 'TO_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToArray">sqlglot.expressions.ToArray</a>'>>, 'TO_BASE64': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToBase64">sqlglot.expressions.ToBase64</a>'>>, 'TO_CHAR': <function build_formatted_time.<locals>._builder>, 'TO_DAYS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToDays">sqlglot.expressions.ToDays</a>'>>, 'TO_MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToMap">sqlglot.expressions.ToMap</a>'>>, 'TO_NUMBER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToNumber">sqlglot.expressions.ToNumber</a>'>>, 'TRANSFORM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Transform">sqlglot.expressions.Transform</a>'>>, 'TRIM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Trim">sqlglot.expressions.Trim</a>'>>, 'TRY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Try">sqlglot.expressions.Try</a>'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TryCast">sqlglot.expressions.TryCast</a>'>>, 'TS_OR_DI_TO_DI': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDiToDi">sqlglot.expressions.TsOrDiToDi</a>'>>, 'TS_OR_DS_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsAdd">sqlglot.expressions.TsOrDsAdd</a>'>>, 'TS_OR_DS_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsDiff">sqlglot.expressions.TsOrDsDiff</a>'>>, 'TS_OR_DS_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsToDate">sqlglot.expressions.TsOrDsToDate</a>'>>, 'TS_OR_DS_TO_DATE_STR': <function Parser.<lambda>>, 'TS_OR_DS_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsToTime">sqlglot.expressions.TsOrDsToTime</a>'>>, 'TS_OR_DS_TO_TIMESTAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsToTimestamp">sqlglot.expressions.TsOrDsToTimestamp</a>'>>, 'UNHEX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Unhex">sqlglot.expressions.Unhex</a>'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixDate">sqlglot.expressions.UnixDate</a>'>>, 'UNIX_TO_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixToStr">sqlglot.expressions.UnixToStr</a>'>>, 'UNIX_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixToTime">sqlglot.expressions.UnixToTime</a>'>>, 'UNIX_TO_TIME_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixToTimeStr">sqlglot.expressions.UnixToTimeStr</a>'>>, 'UPPER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Upper">sqlglot.expressions.Upper</a>'>>, 'UCASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Upper">sqlglot.expressions.Upper</a>'>>, 'VAR_MAP': <function build_var_map>, 'VARIANCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>>, 'VARIANCE_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>>, 'VAR_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>>, 'VARIANCE_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#VariancePop">sqlglot.expressions.VariancePop</a>'>>, 'VAR_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#VariancePop">sqlglot.expressions.VariancePop</a>'>>, 'WEEK': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Week">sqlglot.expressions.Week</a>'>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#WeekOfYear">sqlglot.expressions.WeekOfYear</a>'>>, 'WEEKOFYEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#WeekOfYear">sqlglot.expressions.WeekOfYear</a>'>>, 'WHEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#When">sqlglot.expressions.When</a>'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#XMLTable">sqlglot.expressions.XMLTable</a>'>>, 'XOR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Xor">sqlglot.expressions.Xor</a>'>>, 'YEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Year">sqlglot.expressions.Year</a>'>>, 'GLOB': <function Parser.<lambda>>, 'JSON_EXTRACT_PATH_TEXT': <function build_json_extract_path.<locals>._builder>, 'LIKE': <function build_like>, 'LOG2': <function Parser.<lambda>>, 'LOG10': <function Parser.<lambda>>, 'MOD': <function Parser.<lambda>>, 'JSON_EXTRACT_PATH': <function build_json_extract_path.<locals>._builder>, 'MAKE_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeFromParts">sqlglot.expressions.TimeFromParts</a>'>>, 'MAKE_TIMESTAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampFromParts">sqlglot.expressions.TimestampFromParts</a>'>>, 'NOW': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>>, 'TO_TIMESTAMP': <function _build_to_timestamp>, 'UNNEST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Explode">sqlglot.expressions.Explode</a>'>>, 'DATEADD': <function _build_date_delta.<locals>._builder>, 'GETDATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>>, 'LISTAGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GroupConcat">sqlglot.expressions.GroupConcat</a>'>>, 'STRTOL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#FromBase">sqlglot.expressions.FromBase</a>'>>}</span> + <label class="view-value-button pdoc-button" for="Redshift.Parser.FUNCTIONS-view-value"></label><span class="default_value">{'ABS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Abs">sqlglot.expressions.Abs</a>'>>, 'ADD_MONTHS': <function <a href="#Redshift.Parser">Redshift.Parser</a>.<lambda>>, 'ANONYMOUS_AGG_FUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#AnonymousAggFunc">sqlglot.expressions.AnonymousAggFunc</a>'>>, 'ANY_VALUE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#AnyValue">sqlglot.expressions.AnyValue</a>'>>, 'APPROX_DISTINCT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a>'>>, 'APPROX_COUNT_DISTINCT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a>'>>, 'APPROX_QUANTILE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxQuantile">sqlglot.expressions.ApproxQuantile</a>'>>, 'APPROX_TOP_K': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ApproxTopK">sqlglot.expressions.ApproxTopK</a>'>>, 'ARG_MAX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>>, 'ARGMAX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>>, 'MAX_BY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMax">sqlglot.expressions.ArgMax</a>'>>, 'ARG_MIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>>, 'ARGMIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>>, 'MIN_BY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArgMin">sqlglot.expressions.ArgMin</a>'>>, 'ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Array">sqlglot.expressions.Array</a>'>>, 'ARRAY_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayAgg">sqlglot.expressions.ArrayAgg</a>'>>, 'ARRAY_ALL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayAll">sqlglot.expressions.ArrayAll</a>'>>, 'ARRAY_ANY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayAny">sqlglot.expressions.ArrayAny</a>'>>, 'ARRAY_CONCAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayConcat">sqlglot.expressions.ArrayConcat</a>'>>, 'ARRAY_CAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayConcat">sqlglot.expressions.ArrayConcat</a>'>>, 'ARRAY_CONSTRUCT_COMPACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayConstructCompact">sqlglot.expressions.ArrayConstructCompact</a>'>>, 'ARRAY_CONTAINS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayContains">sqlglot.expressions.ArrayContains</a>'>>, 'FILTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayFilter">sqlglot.expressions.ArrayFilter</a>'>>, 'ARRAY_FILTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayFilter">sqlglot.expressions.ArrayFilter</a>'>>, 'ARRAY_OVERLAPS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayOverlaps">sqlglot.expressions.ArrayOverlaps</a>'>>, 'ARRAY_SIZE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySize">sqlglot.expressions.ArraySize</a>'>>, 'ARRAY_LENGTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySize">sqlglot.expressions.ArraySize</a>'>>, 'ARRAY_SORT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySort">sqlglot.expressions.ArraySort</a>'>>, 'ARRAY_SUM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArraySum">sqlglot.expressions.ArraySum</a>'>>, 'ARRAY_TO_STRING': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayToString">sqlglot.expressions.ArrayToString</a>'>>, 'ARRAY_JOIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayToString">sqlglot.expressions.ArrayToString</a>'>>, 'ARRAY_UNION_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayUnionAgg">sqlglot.expressions.ArrayUnionAgg</a>'>>, 'ARRAY_UNIQUE_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ArrayUniqueAgg">sqlglot.expressions.ArrayUniqueAgg</a>'>>, 'AVG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Avg">sqlglot.expressions.Avg</a>'>>, 'CASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Case">sqlglot.expressions.Case</a>'>>, 'CAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Cast">sqlglot.expressions.Cast</a>'>>, 'CAST_TO_STR_TYPE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CastToStrType">sqlglot.expressions.CastToStrType</a>'>>, 'CBRT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Cbrt">sqlglot.expressions.Cbrt</a>'>>, 'CEIL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Ceil">sqlglot.expressions.Ceil</a>'>>, 'CEILING': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Ceil">sqlglot.expressions.Ceil</a>'>>, 'CHR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Chr">sqlglot.expressions.Chr</a>'>>, 'CHAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Chr">sqlglot.expressions.Chr</a>'>>, 'COALESCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a>'>>, 'IFNULL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a>'>>, 'NVL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Coalesce">sqlglot.expressions.Coalesce</a>'>>, 'COLLATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Collate">sqlglot.expressions.Collate</a>'>>, 'COMBINED_AGG_FUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CombinedAggFunc">sqlglot.expressions.CombinedAggFunc</a>'>>, 'COMBINED_PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CombinedParameterizedAgg">sqlglot.expressions.CombinedParameterizedAgg</a>'>>, 'CONCAT': <function Parser.<lambda>>, 'CONCAT_WS': <function Parser.<lambda>>, 'CONNECT_BY_ROOT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ConnectByRoot">sqlglot.expressions.ConnectByRoot</a>'>>, 'CONVERT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Convert">sqlglot.expressions.Convert</a>'>>, 'CORR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Corr">sqlglot.expressions.Corr</a>'>>, 'COUNT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Count">sqlglot.expressions.Count</a>'>>, 'COUNT_IF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CountIf">sqlglot.expressions.CountIf</a>'>>, 'COUNTIF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CountIf">sqlglot.expressions.CountIf</a>'>>, 'COVAR_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CovarPop">sqlglot.expressions.CovarPop</a>'>>, 'COVAR_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CovarSamp">sqlglot.expressions.CovarSamp</a>'>>, 'CURRENT_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentDate">sqlglot.expressions.CurrentDate</a>'>>, 'CURRENT_DATETIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentDatetime">sqlglot.expressions.CurrentDatetime</a>'>>, 'CURRENT_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTime">sqlglot.expressions.CurrentTime</a>'>>, 'CURRENT_TIMESTAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>>, 'CURRENT_USER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentUser">sqlglot.expressions.CurrentUser</a>'>>, 'DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Date">sqlglot.expressions.Date</a>'>>, 'DATE_ADD': <function _build_date_delta.<locals>._builder>, 'DATEDIFF': <function _build_date_delta.<locals>._builder>, 'DATE_DIFF': <function _build_date_delta.<locals>._builder>, 'DATE_FROM_PARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateFromParts">sqlglot.expressions.DateFromParts</a>'>>, 'DATEFROMPARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateFromParts">sqlglot.expressions.DateFromParts</a>'>>, 'DATE_STR_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateStrToDate">sqlglot.expressions.DateStrToDate</a>'>>, 'DATE_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateSub">sqlglot.expressions.DateSub</a>'>>, 'DATE_TO_DATE_STR': <function Parser.<lambda>>, 'DATE_TO_DI': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DateToDi">sqlglot.expressions.DateToDi</a>'>>, 'DATE_TRUNC': <function build_timestamp_trunc>, 'DATETIME_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeAdd">sqlglot.expressions.DatetimeAdd</a>'>>, 'DATETIME_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeDiff">sqlglot.expressions.DatetimeDiff</a>'>>, 'DATETIME_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeSub">sqlglot.expressions.DatetimeSub</a>'>>, 'DATETIME_TRUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DatetimeTrunc">sqlglot.expressions.DatetimeTrunc</a>'>>, 'DAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Day">sqlglot.expressions.Day</a>'>>, 'DAY_OF_MONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfMonth">sqlglot.expressions.DayOfMonth</a>'>>, 'DAYOFMONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfMonth">sqlglot.expressions.DayOfMonth</a>'>>, 'DAY_OF_WEEK': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfWeek">sqlglot.expressions.DayOfWeek</a>'>>, 'DAYOFWEEK': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfWeek">sqlglot.expressions.DayOfWeek</a>'>>, 'DAY_OF_YEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfYear">sqlglot.expressions.DayOfYear</a>'>>, 'DAYOFYEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DayOfYear">sqlglot.expressions.DayOfYear</a>'>>, 'DECODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Decode">sqlglot.expressions.Decode</a>'>>, 'DI_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#DiToDate">sqlglot.expressions.DiToDate</a>'>>, 'ENCODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Encode">sqlglot.expressions.Encode</a>'>>, 'EXP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Exp">sqlglot.expressions.Exp</a>'>>, 'EXPLODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Explode">sqlglot.expressions.Explode</a>'>>, 'EXPLODE_OUTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ExplodeOuter">sqlglot.expressions.ExplodeOuter</a>'>>, 'EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Extract">sqlglot.expressions.Extract</a>'>>, 'FIRST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#First">sqlglot.expressions.First</a>'>>, 'FIRST_VALUE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#FirstValue">sqlglot.expressions.FirstValue</a>'>>, 'FLATTEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Flatten">sqlglot.expressions.Flatten</a>'>>, 'FLOOR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Floor">sqlglot.expressions.Floor</a>'>>, 'FROM_BASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#FromBase">sqlglot.expressions.FromBase</a>'>>, 'FROM_BASE64': <bound method Func.from_arg_list of <class '<a href="../expressions.html#FromBase64">sqlglot.expressions.FromBase64</a>'>>, 'GENERATE_DATE_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GenerateDateArray">sqlglot.expressions.GenerateDateArray</a>'>>, 'GENERATE_SERIES': <function _build_generate_series>, 'GREATEST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Greatest">sqlglot.expressions.Greatest</a>'>>, 'GROUP_CONCAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GroupConcat">sqlglot.expressions.GroupConcat</a>'>>, 'HEX': <function build_hex>, 'HLL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Hll">sqlglot.expressions.Hll</a>'>>, 'IF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#If">sqlglot.expressions.If</a>'>>, 'IIF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#If">sqlglot.expressions.If</a>'>>, 'INITCAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Initcap">sqlglot.expressions.Initcap</a>'>>, 'IS_INF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsInf">sqlglot.expressions.IsInf</a>'>>, 'ISINF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsInf">sqlglot.expressions.IsInf</a>'>>, 'IS_NAN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsNan">sqlglot.expressions.IsNan</a>'>>, 'ISNAN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#IsNan">sqlglot.expressions.IsNan</a>'>>, 'J_S_O_N_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONArray">sqlglot.expressions.JSONArray</a>'>>, 'J_S_O_N_ARRAY_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONArrayAgg">sqlglot.expressions.JSONArrayAgg</a>'>>, 'JSON_ARRAY_CONTAINS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONArrayContains">sqlglot.expressions.JSONArrayContains</a>'>>, 'JSONB_EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONBExtract">sqlglot.expressions.JSONBExtract</a>'>>, 'JSONB_EXTRACT_SCALAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONBExtractScalar">sqlglot.expressions.JSONBExtractScalar</a>'>>, 'JSON_EXTRACT': <function build_extract_json_with_path.<locals>._builder>, 'JSON_EXTRACT_SCALAR': <function build_extract_json_with_path.<locals>._builder>, 'JSON_FORMAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONFormat">sqlglot.expressions.JSONFormat</a>'>>, 'J_S_O_N_OBJECT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONObject">sqlglot.expressions.JSONObject</a>'>>, 'J_S_O_N_OBJECT_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONObjectAgg">sqlglot.expressions.JSONObjectAgg</a>'>>, 'J_S_O_N_TABLE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#JSONTable">sqlglot.expressions.JSONTable</a>'>>, 'LAG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Lag">sqlglot.expressions.Lag</a>'>>, 'LAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Last">sqlglot.expressions.Last</a>'>>, 'LAST_DAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LastDay">sqlglot.expressions.LastDay</a>'>>, 'LAST_DAY_OF_MONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LastDay">sqlglot.expressions.LastDay</a>'>>, 'LAST_VALUE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LastValue">sqlglot.expressions.LastValue</a>'>>, 'LEAD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Lead">sqlglot.expressions.Lead</a>'>>, 'LEAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Least">sqlglot.expressions.Least</a>'>>, 'LEFT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Left">sqlglot.expressions.Left</a>'>>, 'LENGTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Length">sqlglot.expressions.Length</a>'>>, 'LEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Length">sqlglot.expressions.Length</a>'>>, 'LEVENSHTEIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Levenshtein">sqlglot.expressions.Levenshtein</a>'>>, 'LN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Ln">sqlglot.expressions.Ln</a>'>>, 'LOG': <function build_logarithm>, 'LOGICAL_AND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>>, 'BOOL_AND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>>, 'BOOLAND_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>>, 'LOGICAL_OR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>>, 'BOOL_OR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>>, 'BOOLOR_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>>, 'LOWER': <function build_lower>, 'LCASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Lower">sqlglot.expressions.Lower</a>'>>, 'LOWER_HEX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#LowerHex">sqlglot.expressions.LowerHex</a>'>>, 'MD5': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MD5">sqlglot.expressions.MD5</a>'>>, 'MD5_DIGEST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MD5Digest">sqlglot.expressions.MD5Digest</a>'>>, 'MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Map">sqlglot.expressions.Map</a>'>>, 'MAP_FROM_ENTRIES': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MapFromEntries">sqlglot.expressions.MapFromEntries</a>'>>, 'MATCH_AGAINST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MatchAgainst">sqlglot.expressions.MatchAgainst</a>'>>, 'MAX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Max">sqlglot.expressions.Max</a>'>>, 'MIN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Min">sqlglot.expressions.Min</a>'>>, 'MONTH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Month">sqlglot.expressions.Month</a>'>>, 'MONTHS_BETWEEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#MonthsBetween">sqlglot.expressions.MonthsBetween</a>'>>, 'NEXT_VALUE_FOR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#NextValueFor">sqlglot.expressions.NextValueFor</a>'>>, 'NTH_VALUE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#NthValue">sqlglot.expressions.NthValue</a>'>>, 'NULLIF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Nullif">sqlglot.expressions.Nullif</a>'>>, 'NUMBER_TO_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#NumberToStr">sqlglot.expressions.NumberToStr</a>'>>, 'NVL2': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Nvl2">sqlglot.expressions.Nvl2</a>'>>, 'OPEN_J_S_O_N': <bound method Func.from_arg_list of <class '<a href="../expressions.html#OpenJSON">sqlglot.expressions.OpenJSON</a>'>>, 'PARAMETERIZED_AGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ParameterizedAgg">sqlglot.expressions.ParameterizedAgg</a>'>>, 'PARSE_JSON': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ParseJSON">sqlglot.expressions.ParseJSON</a>'>>, 'JSON_PARSE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ParseJSON">sqlglot.expressions.ParseJSON</a>'>>, 'PERCENTILE_CONT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#PercentileCont">sqlglot.expressions.PercentileCont</a>'>>, 'PERCENTILE_DISC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#PercentileDisc">sqlglot.expressions.PercentileDisc</a>'>>, 'POSEXPLODE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Posexplode">sqlglot.expressions.Posexplode</a>'>>, 'POSEXPLODE_OUTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#PosexplodeOuter">sqlglot.expressions.PosexplodeOuter</a>'>>, 'POWER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Pow">sqlglot.expressions.Pow</a>'>>, 'POW': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Pow">sqlglot.expressions.Pow</a>'>>, 'PREDICT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Predict">sqlglot.expressions.Predict</a>'>>, 'QUANTILE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Quantile">sqlglot.expressions.Quantile</a>'>>, 'QUARTER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Quarter">sqlglot.expressions.Quarter</a>'>>, 'RAND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Rand">sqlglot.expressions.Rand</a>'>>, 'RANDOM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Rand">sqlglot.expressions.Rand</a>'>>, 'RANDN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Randn">sqlglot.expressions.Randn</a>'>>, 'RANGE_N': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RangeN">sqlglot.expressions.RangeN</a>'>>, 'READ_CSV': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ReadCSV">sqlglot.expressions.ReadCSV</a>'>>, 'REDUCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Reduce">sqlglot.expressions.Reduce</a>'>>, 'REGEXP_EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpExtract">sqlglot.expressions.RegexpExtract</a>'>>, 'REGEXP_I_LIKE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpILike">sqlglot.expressions.RegexpILike</a>'>>, 'REGEXP_LIKE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpLike">sqlglot.expressions.RegexpLike</a>'>>, 'REGEXP_REPLACE': <function _build_regexp_replace>, 'REGEXP_SPLIT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RegexpSplit">sqlglot.expressions.RegexpSplit</a>'>>, 'REPEAT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Repeat">sqlglot.expressions.Repeat</a>'>>, 'RIGHT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Right">sqlglot.expressions.Right</a>'>>, 'ROUND': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Round">sqlglot.expressions.Round</a>'>>, 'ROW_NUMBER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#RowNumber">sqlglot.expressions.RowNumber</a>'>>, 'SHA': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SHA">sqlglot.expressions.SHA</a>'>>, 'SHA1': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SHA">sqlglot.expressions.SHA</a>'>>, 'SHA2': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SHA2">sqlglot.expressions.SHA2</a>'>>, 'SAFE_DIVIDE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SafeDivide">sqlglot.expressions.SafeDivide</a>'>>, 'SIGN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Sign">sqlglot.expressions.Sign</a>'>>, 'SIGNUM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Sign">sqlglot.expressions.Sign</a>'>>, 'SORT_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#SortArray">sqlglot.expressions.SortArray</a>'>>, 'SPLIT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Split">sqlglot.expressions.Split</a>'>>, 'SQRT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Sqrt">sqlglot.expressions.Sqrt</a>'>>, 'STANDARD_HASH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StandardHash">sqlglot.expressions.StandardHash</a>'>>, 'STAR_MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StarMap">sqlglot.expressions.StarMap</a>'>>, 'STARTS_WITH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StartsWith">sqlglot.expressions.StartsWith</a>'>>, 'STARTSWITH': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StartsWith">sqlglot.expressions.StartsWith</a>'>>, 'STDDEV': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Stddev">sqlglot.expressions.Stddev</a>'>>, 'STDDEV_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StddevPop">sqlglot.expressions.StddevPop</a>'>>, 'STDDEV_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StddevSamp">sqlglot.expressions.StddevSamp</a>'>>, 'STR_POSITION': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrPosition">sqlglot.expressions.StrPosition</a>'>>, 'STR_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToDate">sqlglot.expressions.StrToDate</a>'>>, 'STR_TO_MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToMap">sqlglot.expressions.StrToMap</a>'>>, 'STR_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToTime">sqlglot.expressions.StrToTime</a>'>>, 'STR_TO_UNIX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StrToUnix">sqlglot.expressions.StrToUnix</a>'>>, 'STRUCT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Struct">sqlglot.expressions.Struct</a>'>>, 'STRUCT_EXTRACT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#StructExtract">sqlglot.expressions.StructExtract</a>'>>, 'STUFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Stuff">sqlglot.expressions.Stuff</a>'>>, 'INSERT': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Stuff">sqlglot.expressions.Stuff</a>'>>, 'SUBSTRING': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Substring">sqlglot.expressions.Substring</a>'>>, 'SUM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Sum">sqlglot.expressions.Sum</a>'>>, 'TIME_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeAdd">sqlglot.expressions.TimeAdd</a>'>>, 'TIME_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeDiff">sqlglot.expressions.TimeDiff</a>'>>, 'TIME_FROM_PARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeFromParts">sqlglot.expressions.TimeFromParts</a>'>>, 'TIMEFROMPARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeFromParts">sqlglot.expressions.TimeFromParts</a>'>>, 'TIME_STR_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeStrToDate">sqlglot.expressions.TimeStrToDate</a>'>>, 'TIME_STR_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeStrToTime">sqlglot.expressions.TimeStrToTime</a>'>>, 'TIME_STR_TO_UNIX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeStrToUnix">sqlglot.expressions.TimeStrToUnix</a>'>>, 'TIME_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeSub">sqlglot.expressions.TimeSub</a>'>>, 'TIME_TO_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeToStr">sqlglot.expressions.TimeToStr</a>'>>, 'TIME_TO_TIME_STR': <function Parser.<lambda>>, 'TIME_TO_UNIX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeToUnix">sqlglot.expressions.TimeToUnix</a>'>>, 'TIME_TRUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeTrunc">sqlglot.expressions.TimeTrunc</a>'>>, 'TIMESTAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Timestamp">sqlglot.expressions.Timestamp</a>'>>, 'TIMESTAMP_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampAdd">sqlglot.expressions.TimestampAdd</a>'>>, 'TIMESTAMPDIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampDiff">sqlglot.expressions.TimestampDiff</a>'>>, 'TIMESTAMP_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampDiff">sqlglot.expressions.TimestampDiff</a>'>>, 'TIMESTAMP_FROM_PARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampFromParts">sqlglot.expressions.TimestampFromParts</a>'>>, 'TIMESTAMPFROMPARTS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampFromParts">sqlglot.expressions.TimestampFromParts</a>'>>, 'TIMESTAMP_SUB': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampSub">sqlglot.expressions.TimestampSub</a>'>>, 'TIMESTAMP_TRUNC': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampTrunc">sqlglot.expressions.TimestampTrunc</a>'>>, 'TO_ARRAY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToArray">sqlglot.expressions.ToArray</a>'>>, 'TO_BASE64': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToBase64">sqlglot.expressions.ToBase64</a>'>>, 'TO_CHAR': <function build_formatted_time.<locals>._builder>, 'TO_DAYS': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToDays">sqlglot.expressions.ToDays</a>'>>, 'TO_MAP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToMap">sqlglot.expressions.ToMap</a>'>>, 'TO_NUMBER': <bound method Func.from_arg_list of <class '<a href="../expressions.html#ToNumber">sqlglot.expressions.ToNumber</a>'>>, 'TRANSFORM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Transform">sqlglot.expressions.Transform</a>'>>, 'TRIM': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Trim">sqlglot.expressions.Trim</a>'>>, 'TRY': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Try">sqlglot.expressions.Try</a>'>>, 'TRY_CAST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TryCast">sqlglot.expressions.TryCast</a>'>>, 'TS_OR_DI_TO_DI': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDiToDi">sqlglot.expressions.TsOrDiToDi</a>'>>, 'TS_OR_DS_ADD': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsAdd">sqlglot.expressions.TsOrDsAdd</a>'>>, 'TS_OR_DS_DIFF': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsDiff">sqlglot.expressions.TsOrDsDiff</a>'>>, 'TS_OR_DS_TO_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsToDate">sqlglot.expressions.TsOrDsToDate</a>'>>, 'TS_OR_DS_TO_DATE_STR': <function Parser.<lambda>>, 'TS_OR_DS_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsToTime">sqlglot.expressions.TsOrDsToTime</a>'>>, 'TS_OR_DS_TO_TIMESTAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TsOrDsToTimestamp">sqlglot.expressions.TsOrDsToTimestamp</a>'>>, 'UNHEX': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Unhex">sqlglot.expressions.Unhex</a>'>>, 'UNIX_DATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixDate">sqlglot.expressions.UnixDate</a>'>>, 'UNIX_TO_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixToStr">sqlglot.expressions.UnixToStr</a>'>>, 'UNIX_TO_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixToTime">sqlglot.expressions.UnixToTime</a>'>>, 'UNIX_TO_TIME_STR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#UnixToTimeStr">sqlglot.expressions.UnixToTimeStr</a>'>>, 'UPPER': <function build_upper>, 'UCASE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Upper">sqlglot.expressions.Upper</a>'>>, 'VAR_MAP': <function build_var_map>, 'VARIANCE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>>, 'VARIANCE_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>>, 'VAR_SAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>>, 'VARIANCE_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#VariancePop">sqlglot.expressions.VariancePop</a>'>>, 'VAR_POP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#VariancePop">sqlglot.expressions.VariancePop</a>'>>, 'WEEK': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Week">sqlglot.expressions.Week</a>'>>, 'WEEK_OF_YEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#WeekOfYear">sqlglot.expressions.WeekOfYear</a>'>>, 'WEEKOFYEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#WeekOfYear">sqlglot.expressions.WeekOfYear</a>'>>, 'WHEN': <bound method Func.from_arg_list of <class '<a href="../expressions.html#When">sqlglot.expressions.When</a>'>>, 'X_M_L_TABLE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#XMLTable">sqlglot.expressions.XMLTable</a>'>>, 'XOR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Xor">sqlglot.expressions.Xor</a>'>>, 'YEAR': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Year">sqlglot.expressions.Year</a>'>>, 'GLOB': <function Parser.<lambda>>, 'JSON_EXTRACT_PATH_TEXT': <function build_json_extract_path.<locals>._builder>, 'LIKE': <function build_like>, 'LOG2': <function Parser.<lambda>>, 'LOG10': <function Parser.<lambda>>, 'MOD': <function build_mod>, 'TO_HEX': <function build_hex>, 'JSON_EXTRACT_PATH': <function build_json_extract_path.<locals>._builder>, 'MAKE_TIME': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimeFromParts">sqlglot.expressions.TimeFromParts</a>'>>, 'MAKE_TIMESTAMP': <bound method Func.from_arg_list of <class '<a href="../expressions.html#TimestampFromParts">sqlglot.expressions.TimestampFromParts</a>'>>, 'NOW': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>>, 'TO_TIMESTAMP': <function _build_to_timestamp>, 'UNNEST': <bound method Func.from_arg_list of <class '<a href="../expressions.html#Explode">sqlglot.expressions.Explode</a>'>>, 'DATEADD': <function _build_date_delta.<locals>._builder>, 'GETDATE': <bound method Func.from_arg_list of <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>>, 'LISTAGG': <bound method Func.from_arg_list of <class '<a href="../expressions.html#GroupConcat">sqlglot.expressions.GroupConcat</a>'>>, 'STRTOL': <bound method Func.from_arg_list of <class '<a href="../expressions.html#FromBase">sqlglot.expressions.FromBase</a>'>>}</span> </div> @@ -1621,6 +1647,7 @@ Default: 3</li> <dd id="Redshift.Parser.PLACEHOLDER_PARSERS" class="variable"><a href="../parser.html#Parser.PLACEHOLDER_PARSERS">PLACEHOLDER_PARSERS</a></dd> <dd id="Redshift.Parser.CONSTRAINT_PARSERS" class="variable"><a href="../parser.html#Parser.CONSTRAINT_PARSERS">CONSTRAINT_PARSERS</a></dd> <dd id="Redshift.Parser.ALTER_PARSERS" class="variable"><a href="../parser.html#Parser.ALTER_PARSERS">ALTER_PARSERS</a></dd> + <dd id="Redshift.Parser.ALTER_ALTER_PARSERS" class="variable"><a href="../parser.html#Parser.ALTER_ALTER_PARSERS">ALTER_ALTER_PARSERS</a></dd> <dd id="Redshift.Parser.SCHEMA_UNNAMED_CONSTRAINTS" class="variable"><a href="../parser.html#Parser.SCHEMA_UNNAMED_CONSTRAINTS">SCHEMA_UNNAMED_CONSTRAINTS</a></dd> <dd id="Redshift.Parser.INVALID_FUNC_NAME_TOKENS" class="variable"><a href="../parser.html#Parser.INVALID_FUNC_NAME_TOKENS">INVALID_FUNC_NAME_TOKENS</a></dd> <dd id="Redshift.Parser.FUNCTIONS_WITH_ALIASED_ARGS" class="variable"><a href="../parser.html#Parser.FUNCTIONS_WITH_ALIASED_ARGS">FUNCTIONS_WITH_ALIASED_ARGS</a></dd> @@ -1629,6 +1656,7 @@ Default: 3</li> <dd id="Redshift.Parser.SET_PARSERS" class="variable"><a href="../parser.html#Parser.SET_PARSERS">SET_PARSERS</a></dd> <dd id="Redshift.Parser.SHOW_PARSERS" class="variable"><a href="../parser.html#Parser.SHOW_PARSERS">SHOW_PARSERS</a></dd> <dd id="Redshift.Parser.TYPE_LITERAL_PARSERS" class="variable"><a href="../parser.html#Parser.TYPE_LITERAL_PARSERS">TYPE_LITERAL_PARSERS</a></dd> + <dd id="Redshift.Parser.TYPE_CONVERTER" class="variable"><a href="../parser.html#Parser.TYPE_CONVERTER">TYPE_CONVERTER</a></dd> <dd id="Redshift.Parser.DDL_SELECT_TOKENS" class="variable"><a href="../parser.html#Parser.DDL_SELECT_TOKENS">DDL_SELECT_TOKENS</a></dd> <dd id="Redshift.Parser.PRE_VOLATILE_TOKENS" class="variable"><a href="../parser.html#Parser.PRE_VOLATILE_TOKENS">PRE_VOLATILE_TOKENS</a></dd> <dd id="Redshift.Parser.TRANSACTION_KIND" class="variable"><a href="../parser.html#Parser.TRANSACTION_KIND">TRANSACTION_KIND</a></dd> @@ -1661,6 +1689,7 @@ Default: 3</li> <dd id="Redshift.Parser.LOG_DEFAULTS_TO_LN" class="variable"><a href="../parser.html#Parser.LOG_DEFAULTS_TO_LN">LOG_DEFAULTS_TO_LN</a></dd> <dd id="Redshift.Parser.ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN" class="variable"><a href="../parser.html#Parser.ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN">ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN</a></dd> <dd id="Redshift.Parser.TABLESAMPLE_CSV" class="variable"><a href="../parser.html#Parser.TABLESAMPLE_CSV">TABLESAMPLE_CSV</a></dd> + <dd id="Redshift.Parser.DEFAULT_SAMPLING_METHOD" class="variable"><a href="../parser.html#Parser.DEFAULT_SAMPLING_METHOD">DEFAULT_SAMPLING_METHOD</a></dd> <dd id="Redshift.Parser.SET_REQUIRES_ASSIGNMENT_DELIMITER" class="variable"><a href="../parser.html#Parser.SET_REQUIRES_ASSIGNMENT_DELIMITER">SET_REQUIRES_ASSIGNMENT_DELIMITER</a></dd> <dd id="Redshift.Parser.TRIM_PATTERN_FIRST" class="variable"><a href="../parser.html#Parser.TRIM_PATTERN_FIRST">TRIM_PATTERN_FIRST</a></dd> <dd id="Redshift.Parser.STRING_ALIASES" class="variable"><a href="../parser.html#Parser.STRING_ALIASES">STRING_ALIASES</a></dd> @@ -1710,24 +1739,24 @@ Default: 3</li> </div> <a class="headerlink" href="#Redshift.Tokenizer"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Tokenizer-115"><a href="#Redshift.Tokenizer-115"><span class="linenos">115</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> -</span><span id="Redshift.Tokenizer-116"><a href="#Redshift.Tokenizer-116"><span class="linenos">116</span></a> <span class="n">BIT_STRINGS</span> <span class="o">=</span> <span class="p">[]</span> -</span><span id="Redshift.Tokenizer-117"><a href="#Redshift.Tokenizer-117"><span class="linenos">117</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[]</span> -</span><span id="Redshift.Tokenizer-118"><a href="#Redshift.Tokenizer-118"><span class="linenos">118</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">]</span> -</span><span id="Redshift.Tokenizer-119"><a href="#Redshift.Tokenizer-119"><span class="linenos">119</span></a> -</span><span id="Redshift.Tokenizer-120"><a href="#Redshift.Tokenizer-120"><span class="linenos">120</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift.Tokenizer-121"><a href="#Redshift.Tokenizer-121"><span class="linenos">121</span></a> <span class="o">**</span><span class="n">Postgres</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="Redshift.Tokenizer-122"><a href="#Redshift.Tokenizer-122"><span class="linenos">122</span></a> <span class="s2">"HLLSKETCH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HLLSKETCH</span><span class="p">,</span> -</span><span id="Redshift.Tokenizer-123"><a href="#Redshift.Tokenizer-123"><span class="linenos">123</span></a> <span class="s2">"SUPER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SUPER</span><span class="p">,</span> -</span><span id="Redshift.Tokenizer-124"><a href="#Redshift.Tokenizer-124"><span class="linenos">124</span></a> <span class="s2">"TOP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> -</span><span id="Redshift.Tokenizer-125"><a href="#Redshift.Tokenizer-125"><span class="linenos">125</span></a> <span class="s2">"UNLOAD"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> -</span><span id="Redshift.Tokenizer-126"><a href="#Redshift.Tokenizer-126"><span class="linenos">126</span></a> <span class="s2">"VARBYTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> -</span><span id="Redshift.Tokenizer-127"><a href="#Redshift.Tokenizer-127"><span class="linenos">127</span></a> <span class="p">}</span> -</span><span id="Redshift.Tokenizer-128"><a href="#Redshift.Tokenizer-128"><span class="linenos">128</span></a> <span class="n">KEYWORDS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"VALUES"</span><span class="p">)</span> -</span><span id="Redshift.Tokenizer-129"><a href="#Redshift.Tokenizer-129"><span class="linenos">129</span></a> -</span><span id="Redshift.Tokenizer-130"><a href="#Redshift.Tokenizer-130"><span class="linenos">130</span></a> <span class="c1"># Redshift allows # to appear as a table identifier prefix</span> -</span><span id="Redshift.Tokenizer-131"><a href="#Redshift.Tokenizer-131"><span class="linenos">131</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> -</span><span id="Redshift.Tokenizer-132"><a href="#Redshift.Tokenizer-132"><span class="linenos">132</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"#"</span><span class="p">)</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Tokenizer-116"><a href="#Redshift.Tokenizer-116"><span class="linenos">116</span></a> <span class="k">class</span> <span class="nc">Tokenizer</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="p">):</span> +</span><span id="Redshift.Tokenizer-117"><a href="#Redshift.Tokenizer-117"><span class="linenos">117</span></a> <span class="n">BIT_STRINGS</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Redshift.Tokenizer-118"><a href="#Redshift.Tokenizer-118"><span class="linenos">118</span></a> <span class="n">HEX_STRINGS</span> <span class="o">=</span> <span class="p">[]</span> +</span><span id="Redshift.Tokenizer-119"><a href="#Redshift.Tokenizer-119"><span class="linenos">119</span></a> <span class="n">STRING_ESCAPES</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"</span><span class="se">\\</span><span class="s2">"</span><span class="p">,</span> <span class="s2">"'"</span><span class="p">]</span> +</span><span id="Redshift.Tokenizer-120"><a href="#Redshift.Tokenizer-120"><span class="linenos">120</span></a> +</span><span id="Redshift.Tokenizer-121"><a href="#Redshift.Tokenizer-121"><span class="linenos">121</span></a> <span class="n">KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift.Tokenizer-122"><a href="#Redshift.Tokenizer-122"><span class="linenos">122</span></a> <span class="o">**</span><span class="n">Postgres</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="Redshift.Tokenizer-123"><a href="#Redshift.Tokenizer-123"><span class="linenos">123</span></a> <span class="s2">"HLLSKETCH"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">HLLSKETCH</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-124"><a href="#Redshift.Tokenizer-124"><span class="linenos">124</span></a> <span class="s2">"SUPER"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">SUPER</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-125"><a href="#Redshift.Tokenizer-125"><span class="linenos">125</span></a> <span class="s2">"TOP"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">TOP</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-126"><a href="#Redshift.Tokenizer-126"><span class="linenos">126</span></a> <span class="s2">"UNLOAD"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">COMMAND</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-127"><a href="#Redshift.Tokenizer-127"><span class="linenos">127</span></a> <span class="s2">"VARBYTE"</span><span class="p">:</span> <span class="n">TokenType</span><span class="o">.</span><span class="n">VARBINARY</span><span class="p">,</span> +</span><span id="Redshift.Tokenizer-128"><a href="#Redshift.Tokenizer-128"><span class="linenos">128</span></a> <span class="p">}</span> +</span><span id="Redshift.Tokenizer-129"><a href="#Redshift.Tokenizer-129"><span class="linenos">129</span></a> <span class="n">KEYWORDS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"VALUES"</span><span class="p">)</span> +</span><span id="Redshift.Tokenizer-130"><a href="#Redshift.Tokenizer-130"><span class="linenos">130</span></a> +</span><span id="Redshift.Tokenizer-131"><a href="#Redshift.Tokenizer-131"><span class="linenos">131</span></a> <span class="c1"># Redshift allows # to appear as a table identifier prefix</span> +</span><span id="Redshift.Tokenizer-132"><a href="#Redshift.Tokenizer-132"><span class="linenos">132</span></a> <span class="n">SINGLE_TOKENS</span> <span class="o">=</span> <span class="n">Postgres</span><span class="o">.</span><span class="n">Tokenizer</span><span class="o">.</span><span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span> +</span><span id="Redshift.Tokenizer-133"><a href="#Redshift.Tokenizer-133"><span class="linenos">133</span></a> <span class="n">SINGLE_TOKENS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">"#"</span><span class="p">)</span> </span></pre></div> @@ -1841,274 +1870,276 @@ Default: 3</li> </div> <a class="headerlink" href="#Redshift.Generator"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator-134"><a href="#Redshift.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">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> -</span><span id="Redshift.Generator-135"><a href="#Redshift.Generator-135"><span class="linenos">135</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift.Generator-136"><a href="#Redshift.Generator-136"><span class="linenos">136</span></a> <span class="n">QUERY_HINTS</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift.Generator-137"><a href="#Redshift.Generator-137"><span class="linenos">137</span></a> <span class="n">VALUES_AS_TABLE</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift.Generator-138"><a href="#Redshift.Generator-138"><span class="linenos">138</span></a> <span class="n">TZ_TO_WITH_TIME_ZONE</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Redshift.Generator-139"><a href="#Redshift.Generator-139"><span class="linenos">139</span></a> <span class="n">NVL2_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Redshift.Generator-140"><a href="#Redshift.Generator-140"><span class="linenos">140</span></a> <span class="n">LAST_DAY_SUPPORTS_DATE_PART</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift.Generator-141"><a href="#Redshift.Generator-141"><span class="linenos">141</span></a> <span class="n">CAN_IMPLEMENT_ARRAY_ANY</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift.Generator-142"><a href="#Redshift.Generator-142"><span class="linenos">142</span></a> <span class="n">MULTI_ARG_DISTINCT</span> <span class="o">=</span> <span class="kc">True</span> -</span><span id="Redshift.Generator-143"><a href="#Redshift.Generator-143"><span class="linenos">143</span></a> <span class="n">COPY_PARAMS_ARE_WRAPPED</span> <span class="o">=</span> <span class="kc">False</span> -</span><span id="Redshift.Generator-144"><a href="#Redshift.Generator-144"><span class="linenos">144</span></a> -</span><span id="Redshift.Generator-145"><a href="#Redshift.Generator-145"><span class="linenos">145</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift.Generator-146"><a href="#Redshift.Generator-146"><span class="linenos">146</span></a> <span class="o">**</span><span class="n">Postgres</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="Redshift.Generator-147"><a href="#Redshift.Generator-147"><span class="linenos">147</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">BINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> -</span><span id="Redshift.Generator-148"><a href="#Redshift.Generator-148"><span class="linenos">148</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">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> -</span><span id="Redshift.Generator-149"><a href="#Redshift.Generator-149"><span class="linenos">149</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">TIMETZ</span><span class="p">:</span> <span class="s2">"TIME"</span><span class="p">,</span> -</span><span id="Redshift.Generator-150"><a href="#Redshift.Generator-150"><span class="linenos">150</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">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> -</span><span id="Redshift.Generator-151"><a href="#Redshift.Generator-151"><span class="linenos">151</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">VARBINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> -</span><span id="Redshift.Generator-152"><a href="#Redshift.Generator-152"><span class="linenos">152</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">ROWVERSION</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> -</span><span id="Redshift.Generator-153"><a href="#Redshift.Generator-153"><span class="linenos">153</span></a> <span class="p">}</span> -</span><span id="Redshift.Generator-154"><a href="#Redshift.Generator-154"><span class="linenos">154</span></a> -</span><span id="Redshift.Generator-155"><a href="#Redshift.Generator-155"><span class="linenos">155</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift.Generator-156"><a href="#Redshift.Generator-156"><span class="linenos">156</span></a> <span class="o">**</span><span class="n">Postgres</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="Redshift.Generator-157"><a href="#Redshift.Generator-157"><span class="linenos">157</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">:</span> <span class="n">concat_to_dpipe_sql</span><span class="p">,</span> -</span><span id="Redshift.Generator-158"><a href="#Redshift.Generator-158"><span class="linenos">158</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ConcatWs</span><span class="p">:</span> <span class="n">concat_ws_to_dpipe_sql</span><span class="p">,</span> -</span><span id="Redshift.Generator-159"><a href="#Redshift.Generator-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> -</span><span id="Redshift.Generator-160"><a href="#Redshift.Generator-160"><span class="linenos">160</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"APPROXIMATE COUNT(DISTINCT </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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Redshift.Generator-161"><a href="#Redshift.Generator-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</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="p">(</span> -</span><span id="Redshift.Generator-162"><a href="#Redshift.Generator-162"><span class="linenos">162</span></a> <span class="s2">"SYSDATE"</span> <span class="k">if</span> <span class="n">e</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">"transaction"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"GETDATE()"</span> -</span><span id="Redshift.Generator-163"><a href="#Redshift.Generator-163"><span class="linenos">163</span></a> <span class="p">),</span> -</span><span id="Redshift.Generator-164"><a href="#Redshift.Generator-164"><span class="linenos">164</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> -</span><span id="Redshift.Generator-165"><a href="#Redshift.Generator-165"><span class="linenos">165</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> -</span><span id="Redshift.Generator-166"><a href="#Redshift.Generator-166"><span class="linenos">166</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</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">func</span><span class="p">(</span><span class="s2">"DISTKEY"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> -</span><span id="Redshift.Generator-167"><a href="#Redshift.Generator-167"><span class="linenos">167</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</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">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> -</span><span id="Redshift.Generator-168"><a href="#Redshift.Generator-168"><span class="linenos">168</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FromBase</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRTOL"</span><span class="p">),</span> -</span><span id="Redshift.Generator-169"><a href="#Redshift.Generator-169"><span class="linenos">169</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">:</span> <span class="n">generatedasidentitycolumnconstraint_sql</span><span class="p">,</span> -</span><span id="Redshift.Generator-170"><a href="#Redshift.Generator-170"><span class="linenos">170</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">json_extract_segments</span><span class="p">(</span><span class="s2">"JSON_EXTRACT_PATH_TEXT"</span><span class="p">),</span> -</span><span id="Redshift.Generator-171"><a href="#Redshift.Generator-171"><span class="linenos">171</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">json_extract_segments</span><span class="p">(</span><span class="s2">"JSON_EXTRACT_PATH_TEXT"</span><span class="p">),</span> -</span><span id="Redshift.Generator-172"><a href="#Redshift.Generator-172"><span class="linenos">172</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LISTAGG"</span><span class="p">),</span> -</span><span id="Redshift.Generator-173"><a href="#Redshift.Generator-173"><span class="linenos">173</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ParseJSON</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"JSON_PARSE"</span><span class="p">),</span> -</span><span id="Redshift.Generator-174"><a href="#Redshift.Generator-174"><span class="linenos">174</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><span id="Redshift.Generator-175"><a href="#Redshift.Generator-175"><span class="linenos">175</span></a> <span class="p">[</span> -</span><span id="Redshift.Generator-176"><a href="#Redshift.Generator-176"><span class="linenos">176</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">,</span> -</span><span id="Redshift.Generator-177"><a href="#Redshift.Generator-177"><span class="linenos">177</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_semi_and_anti_joins</span><span class="p">,</span> -</span><span id="Redshift.Generator-178"><a href="#Redshift.Generator-178"><span class="linenos">178</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">unqualify_unnest</span><span class="p">,</span> -</span><span id="Redshift.Generator-179"><a href="#Redshift.Generator-179"><span class="linenos">179</span></a> <span class="p">]</span> -</span><span id="Redshift.Generator-180"><a href="#Redshift.Generator-180"><span class="linenos">180</span></a> <span class="p">),</span> -</span><span id="Redshift.Generator-181"><a href="#Redshift.Generator-181"><span class="linenos">181</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> -</span><span id="Redshift.Generator-182"><a href="#Redshift.Generator-182"><span class="linenos">182</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'COMPOUND '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'compound'</span><span class="p">]</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">SORTKEY(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> -</span><span id="Redshift.Generator-183"><a href="#Redshift.Generator-183"><span class="linenos">183</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StartsWith</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> -</span><span id="Redshift.Generator-184"><a href="#Redshift.Generator-184"><span class="linenos">184</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</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="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2"> LIKE </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="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> || '%'"</span><span class="p">,</span> -</span><span id="Redshift.Generator-185"><a href="#Redshift.Generator-185"><span class="linenos">185</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> -</span><span id="Redshift.Generator-186"><a href="#Redshift.Generator-186"><span class="linenos">186</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> -</span><span id="Redshift.Generator-187"><a href="#Redshift.Generator-187"><span class="linenos">187</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> -</span><span id="Redshift.Generator-188"><a href="#Redshift.Generator-188"><span class="linenos">188</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> -</span><span id="Redshift.Generator-189"><a href="#Redshift.Generator-189"><span class="linenos">189</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"(TIMESTAMP 'epoch' + </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="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2"> * INTERVAL '1 SECOND')"</span><span class="p">,</span> -</span><span id="Redshift.Generator-190"><a href="#Redshift.Generator-190"><span class="linenos">190</span></a> <span class="p">}</span> -</span><span id="Redshift.Generator-191"><a href="#Redshift.Generator-191"><span class="linenos">191</span></a> -</span><span id="Redshift.Generator-192"><a href="#Redshift.Generator-192"><span class="linenos">192</span></a> <span class="c1"># Postgres maps exp.Pivot to no_pivot_sql, but Redshift support pivots</span> -</span><span id="Redshift.Generator-193"><a href="#Redshift.Generator-193"><span class="linenos">193</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">)</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator-135"><a href="#Redshift.Generator-135"><span class="linenos">135</span></a> <span class="k">class</span> <span class="nc">Generator</span><span class="p">(</span><span class="n">Postgres</span><span class="o">.</span><span class="n">Generator</span><span class="p">):</span> +</span><span id="Redshift.Generator-136"><a href="#Redshift.Generator-136"><span class="linenos">136</span></a> <span class="n">LOCKING_READS_SUPPORTED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Redshift.Generator-137"><a href="#Redshift.Generator-137"><span class="linenos">137</span></a> <span class="n">QUERY_HINTS</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Redshift.Generator-138"><a href="#Redshift.Generator-138"><span class="linenos">138</span></a> <span class="n">VALUES_AS_TABLE</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Redshift.Generator-139"><a href="#Redshift.Generator-139"><span class="linenos">139</span></a> <span class="n">TZ_TO_WITH_TIME_ZONE</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Redshift.Generator-140"><a href="#Redshift.Generator-140"><span class="linenos">140</span></a> <span class="n">NVL2_SUPPORTED</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Redshift.Generator-141"><a href="#Redshift.Generator-141"><span class="linenos">141</span></a> <span class="n">LAST_DAY_SUPPORTS_DATE_PART</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Redshift.Generator-142"><a href="#Redshift.Generator-142"><span class="linenos">142</span></a> <span class="n">CAN_IMPLEMENT_ARRAY_ANY</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Redshift.Generator-143"><a href="#Redshift.Generator-143"><span class="linenos">143</span></a> <span class="n">MULTI_ARG_DISTINCT</span> <span class="o">=</span> <span class="kc">True</span> +</span><span id="Redshift.Generator-144"><a href="#Redshift.Generator-144"><span class="linenos">144</span></a> <span class="n">COPY_PARAMS_ARE_WRAPPED</span> <span class="o">=</span> <span class="kc">False</span> +</span><span id="Redshift.Generator-145"><a href="#Redshift.Generator-145"><span class="linenos">145</span></a> <span class="n">HEX_FUNC</span> <span class="o">=</span> <span class="s2">"TO_HEX"</span> +</span><span id="Redshift.Generator-146"><a href="#Redshift.Generator-146"><span class="linenos">146</span></a> +</span><span id="Redshift.Generator-147"><a href="#Redshift.Generator-147"><span class="linenos">147</span></a> <span class="n">TYPE_MAPPING</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift.Generator-148"><a href="#Redshift.Generator-148"><span class="linenos">148</span></a> <span class="o">**</span><span class="n">Postgres</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="Redshift.Generator-149"><a href="#Redshift.Generator-149"><span class="linenos">149</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">BINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="Redshift.Generator-150"><a href="#Redshift.Generator-150"><span class="linenos">150</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">INT</span><span class="p">:</span> <span class="s2">"INTEGER"</span><span class="p">,</span> +</span><span id="Redshift.Generator-151"><a href="#Redshift.Generator-151"><span class="linenos">151</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">TIMETZ</span><span class="p">:</span> <span class="s2">"TIME"</span><span class="p">,</span> +</span><span id="Redshift.Generator-152"><a href="#Redshift.Generator-152"><span class="linenos">152</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">TIMESTAMPTZ</span><span class="p">:</span> <span class="s2">"TIMESTAMP"</span><span class="p">,</span> +</span><span id="Redshift.Generator-153"><a href="#Redshift.Generator-153"><span class="linenos">153</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">VARBINARY</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="Redshift.Generator-154"><a href="#Redshift.Generator-154"><span class="linenos">154</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">ROWVERSION</span><span class="p">:</span> <span class="s2">"VARBYTE"</span><span class="p">,</span> +</span><span id="Redshift.Generator-155"><a href="#Redshift.Generator-155"><span class="linenos">155</span></a> <span class="p">}</span> +</span><span id="Redshift.Generator-156"><a href="#Redshift.Generator-156"><span class="linenos">156</span></a> +</span><span id="Redshift.Generator-157"><a href="#Redshift.Generator-157"><span class="linenos">157</span></a> <span class="n">TRANSFORMS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift.Generator-158"><a href="#Redshift.Generator-158"><span class="linenos">158</span></a> <span class="o">**</span><span class="n">Postgres</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="Redshift.Generator-159"><a href="#Redshift.Generator-159"><span class="linenos">159</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Concat</span><span class="p">:</span> <span class="n">concat_to_dpipe_sql</span><span class="p">,</span> +</span><span id="Redshift.Generator-160"><a href="#Redshift.Generator-160"><span class="linenos">160</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ConcatWs</span><span class="p">:</span> <span class="n">concat_ws_to_dpipe_sql</span><span class="p">,</span> +</span><span id="Redshift.Generator-161"><a href="#Redshift.Generator-161"><span class="linenos">161</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ApproxDistinct</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> +</span><span id="Redshift.Generator-162"><a href="#Redshift.Generator-162"><span class="linenos">162</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"APPROXIMATE COUNT(DISTINCT </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">'this'</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Redshift.Generator-163"><a href="#Redshift.Generator-163"><span class="linenos">163</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">CurrentTimestamp</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="p">(</span> +</span><span id="Redshift.Generator-164"><a href="#Redshift.Generator-164"><span class="linenos">164</span></a> <span class="s2">"SYSDATE"</span> <span class="k">if</span> <span class="n">e</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">"transaction"</span><span class="p">)</span> <span class="k">else</span> <span class="s2">"GETDATE()"</span> +</span><span id="Redshift.Generator-165"><a href="#Redshift.Generator-165"><span class="linenos">165</span></a> <span class="p">),</span> +</span><span id="Redshift.Generator-166"><a href="#Redshift.Generator-166"><span class="linenos">166</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateAdd</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> +</span><span id="Redshift.Generator-167"><a href="#Redshift.Generator-167"><span class="linenos">167</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DateDiff</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> +</span><span id="Redshift.Generator-168"><a href="#Redshift.Generator-168"><span class="linenos">168</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistKeyProperty</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">func</span><span class="p">(</span><span class="s2">"DISTKEY"</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">),</span> +</span><span id="Redshift.Generator-169"><a href="#Redshift.Generator-169"><span class="linenos">169</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">DistStyleProperty</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">naked_property</span><span class="p">(</span><span class="n">e</span><span class="p">),</span> +</span><span id="Redshift.Generator-170"><a href="#Redshift.Generator-170"><span class="linenos">170</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">FromBase</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"STRTOL"</span><span class="p">),</span> +</span><span id="Redshift.Generator-171"><a href="#Redshift.Generator-171"><span class="linenos">171</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GeneratedAsIdentityColumnConstraint</span><span class="p">:</span> <span class="n">generatedasidentitycolumnconstraint_sql</span><span class="p">,</span> +</span><span id="Redshift.Generator-172"><a href="#Redshift.Generator-172"><span class="linenos">172</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtract</span><span class="p">:</span> <span class="n">json_extract_segments</span><span class="p">(</span><span class="s2">"JSON_EXTRACT_PATH_TEXT"</span><span class="p">),</span> +</span><span id="Redshift.Generator-173"><a href="#Redshift.Generator-173"><span class="linenos">173</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">JSONExtractScalar</span><span class="p">:</span> <span class="n">json_extract_segments</span><span class="p">(</span><span class="s2">"JSON_EXTRACT_PATH_TEXT"</span><span class="p">),</span> +</span><span id="Redshift.Generator-174"><a href="#Redshift.Generator-174"><span class="linenos">174</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">GroupConcat</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"LISTAGG"</span><span class="p">),</span> +</span><span id="Redshift.Generator-175"><a href="#Redshift.Generator-175"><span class="linenos">175</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">Hex</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">func</span><span class="p">(</span><span class="s2">"UPPER"</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">func</span><span class="p">(</span><span class="s2">"TO_HEX"</span><span class="p">,</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="s2">"this"</span><span class="p">))),</span> +</span><span id="Redshift.Generator-176"><a href="#Redshift.Generator-176"><span class="linenos">176</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">ParseJSON</span><span class="p">:</span> <span class="n">rename_func</span><span class="p">(</span><span class="s2">"JSON_PARSE"</span><span class="p">),</span> +</span><span id="Redshift.Generator-177"><a href="#Redshift.Generator-177"><span class="linenos">177</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><span id="Redshift.Generator-178"><a href="#Redshift.Generator-178"><span class="linenos">178</span></a> <span class="p">[</span> +</span><span id="Redshift.Generator-179"><a href="#Redshift.Generator-179"><span class="linenos">179</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_distinct_on</span><span class="p">,</span> +</span><span id="Redshift.Generator-180"><a href="#Redshift.Generator-180"><span class="linenos">180</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">eliminate_semi_and_anti_joins</span><span class="p">,</span> +</span><span id="Redshift.Generator-181"><a href="#Redshift.Generator-181"><span class="linenos">181</span></a> <span class="n">transforms</span><span class="o">.</span><span class="n">unqualify_unnest</span><span class="p">,</span> +</span><span id="Redshift.Generator-182"><a href="#Redshift.Generator-182"><span class="linenos">182</span></a> <span class="p">]</span> +</span><span id="Redshift.Generator-183"><a href="#Redshift.Generator-183"><span class="linenos">183</span></a> <span class="p">),</span> +</span><span id="Redshift.Generator-184"><a href="#Redshift.Generator-184"><span class="linenos">184</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">SortKeyProperty</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> +</span><span id="Redshift.Generator-185"><a href="#Redshift.Generator-185"><span class="linenos">185</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="s1">'COMPOUND '</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">e</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="s1">'compound'</span><span class="p">]</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="s1">''</span><span class="si">}</span><span class="s2">SORTKEY(</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">format_args</span><span class="p">(</span><span class="o">*</span><span class="n">e</span><span class="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2">)"</span><span class="p">,</span> +</span><span id="Redshift.Generator-186"><a href="#Redshift.Generator-186"><span class="linenos">186</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">StartsWith</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> +</span><span id="Redshift.Generator-187"><a href="#Redshift.Generator-187"><span class="linenos">187</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"</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="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2"> LIKE </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="o">.</span><span class="n">expression</span><span class="p">)</span><span class="si">}</span><span class="s2"> || '%'"</span><span class="p">,</span> +</span><span id="Redshift.Generator-188"><a href="#Redshift.Generator-188"><span class="linenos">188</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TableSample</span><span class="p">:</span> <span class="n">no_tablesample_sql</span><span class="p">,</span> +</span><span id="Redshift.Generator-189"><a href="#Redshift.Generator-189"><span class="linenos">189</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsAdd</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEADD"</span><span class="p">),</span> +</span><span id="Redshift.Generator-190"><a href="#Redshift.Generator-190"><span class="linenos">190</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">TsOrDsDiff</span><span class="p">:</span> <span class="n">date_delta_sql</span><span class="p">(</span><span class="s2">"DATEDIFF"</span><span class="p">),</span> +</span><span id="Redshift.Generator-191"><a href="#Redshift.Generator-191"><span class="linenos">191</span></a> <span class="n">exp</span><span class="o">.</span><span class="n">UnixToTime</span><span class="p">:</span> <span class="k">lambda</span> <span class="bp">self</span><span class="p">,</span> +</span><span id="Redshift.Generator-192"><a href="#Redshift.Generator-192"><span class="linenos">192</span></a> <span class="n">e</span><span class="p">:</span> <span class="sa">f</span><span class="s2">"(TIMESTAMP 'epoch' + </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="o">.</span><span class="n">this</span><span class="p">)</span><span class="si">}</span><span class="s2"> * INTERVAL '1 SECOND')"</span><span class="p">,</span> +</span><span id="Redshift.Generator-193"><a href="#Redshift.Generator-193"><span class="linenos">193</span></a> <span class="p">}</span> </span><span id="Redshift.Generator-194"><a href="#Redshift.Generator-194"><span class="linenos">194</span></a> -</span><span id="Redshift.Generator-195"><a href="#Redshift.Generator-195"><span class="linenos">195</span></a> <span class="c1"># Redshift uses the POW | POWER (expr1, expr2) syntax instead of expr1 ^ expr2 (postgres)</span> -</span><span id="Redshift.Generator-196"><a href="#Redshift.Generator-196"><span class="linenos">196</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">)</span> +</span><span id="Redshift.Generator-195"><a href="#Redshift.Generator-195"><span class="linenos">195</span></a> <span class="c1"># Postgres maps exp.Pivot to no_pivot_sql, but Redshift support pivots</span> +</span><span id="Redshift.Generator-196"><a href="#Redshift.Generator-196"><span class="linenos">196</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pivot</span><span class="p">)</span> </span><span id="Redshift.Generator-197"><a href="#Redshift.Generator-197"><span class="linenos">197</span></a> -</span><span id="Redshift.Generator-198"><a href="#Redshift.Generator-198"><span class="linenos">198</span></a> <span class="c1"># Redshift supports ANY_VALUE(..)</span> -</span><span id="Redshift.Generator-199"><a href="#Redshift.Generator-199"><span class="linenos">199</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="p">)</span> +</span><span id="Redshift.Generator-198"><a href="#Redshift.Generator-198"><span class="linenos">198</span></a> <span class="c1"># Redshift uses the POW | POWER (expr1, expr2) syntax instead of expr1 ^ expr2 (postgres)</span> +</span><span id="Redshift.Generator-199"><a href="#Redshift.Generator-199"><span class="linenos">199</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">Pow</span><span class="p">)</span> </span><span id="Redshift.Generator-200"><a href="#Redshift.Generator-200"><span class="linenos">200</span></a> -</span><span id="Redshift.Generator-201"><a href="#Redshift.Generator-201"><span class="linenos">201</span></a> <span class="c1"># Redshift supports LAST_DAY(..)</span> -</span><span id="Redshift.Generator-202"><a href="#Redshift.Generator-202"><span class="linenos">202</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LastDay</span><span class="p">)</span> +</span><span id="Redshift.Generator-201"><a href="#Redshift.Generator-201"><span class="linenos">201</span></a> <span class="c1"># Redshift supports ANY_VALUE(..)</span> +</span><span id="Redshift.Generator-202"><a href="#Redshift.Generator-202"><span class="linenos">202</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">AnyValue</span><span class="p">)</span> </span><span id="Redshift.Generator-203"><a href="#Redshift.Generator-203"><span class="linenos">203</span></a> -</span><span id="Redshift.Generator-204"><a href="#Redshift.Generator-204"><span class="linenos">204</span></a> <span class="n">RESERVED_KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> -</span><span id="Redshift.Generator-205"><a href="#Redshift.Generator-205"><span class="linenos">205</span></a> <span class="s2">"aes128"</span><span class="p">,</span> -</span><span id="Redshift.Generator-206"><a href="#Redshift.Generator-206"><span class="linenos">206</span></a> <span class="s2">"aes256"</span><span class="p">,</span> -</span><span id="Redshift.Generator-207"><a href="#Redshift.Generator-207"><span class="linenos">207</span></a> <span class="s2">"all"</span><span class="p">,</span> -</span><span id="Redshift.Generator-208"><a href="#Redshift.Generator-208"><span class="linenos">208</span></a> <span class="s2">"allowoverwrite"</span><span class="p">,</span> -</span><span id="Redshift.Generator-209"><a href="#Redshift.Generator-209"><span class="linenos">209</span></a> <span class="s2">"analyse"</span><span class="p">,</span> -</span><span id="Redshift.Generator-210"><a href="#Redshift.Generator-210"><span class="linenos">210</span></a> <span class="s2">"analyze"</span><span class="p">,</span> -</span><span id="Redshift.Generator-211"><a href="#Redshift.Generator-211"><span class="linenos">211</span></a> <span class="s2">"and"</span><span class="p">,</span> -</span><span id="Redshift.Generator-212"><a href="#Redshift.Generator-212"><span class="linenos">212</span></a> <span class="s2">"any"</span><span class="p">,</span> -</span><span id="Redshift.Generator-213"><a href="#Redshift.Generator-213"><span class="linenos">213</span></a> <span class="s2">"array"</span><span class="p">,</span> -</span><span id="Redshift.Generator-214"><a href="#Redshift.Generator-214"><span class="linenos">214</span></a> <span class="s2">"as"</span><span class="p">,</span> -</span><span id="Redshift.Generator-215"><a href="#Redshift.Generator-215"><span class="linenos">215</span></a> <span class="s2">"asc"</span><span class="p">,</span> -</span><span id="Redshift.Generator-216"><a href="#Redshift.Generator-216"><span class="linenos">216</span></a> <span class="s2">"authorization"</span><span class="p">,</span> -</span><span id="Redshift.Generator-217"><a href="#Redshift.Generator-217"><span class="linenos">217</span></a> <span class="s2">"az64"</span><span class="p">,</span> -</span><span id="Redshift.Generator-218"><a href="#Redshift.Generator-218"><span class="linenos">218</span></a> <span class="s2">"backup"</span><span class="p">,</span> -</span><span id="Redshift.Generator-219"><a href="#Redshift.Generator-219"><span class="linenos">219</span></a> <span class="s2">"between"</span><span class="p">,</span> -</span><span id="Redshift.Generator-220"><a href="#Redshift.Generator-220"><span class="linenos">220</span></a> <span class="s2">"binary"</span><span class="p">,</span> -</span><span id="Redshift.Generator-221"><a href="#Redshift.Generator-221"><span class="linenos">221</span></a> <span class="s2">"blanksasnull"</span><span class="p">,</span> -</span><span id="Redshift.Generator-222"><a href="#Redshift.Generator-222"><span class="linenos">222</span></a> <span class="s2">"both"</span><span class="p">,</span> -</span><span id="Redshift.Generator-223"><a href="#Redshift.Generator-223"><span class="linenos">223</span></a> <span class="s2">"bytedict"</span><span class="p">,</span> -</span><span id="Redshift.Generator-224"><a href="#Redshift.Generator-224"><span class="linenos">224</span></a> <span class="s2">"bzip2"</span><span class="p">,</span> -</span><span id="Redshift.Generator-225"><a href="#Redshift.Generator-225"><span class="linenos">225</span></a> <span class="s2">"case"</span><span class="p">,</span> -</span><span id="Redshift.Generator-226"><a href="#Redshift.Generator-226"><span class="linenos">226</span></a> <span class="s2">"cast"</span><span class="p">,</span> -</span><span id="Redshift.Generator-227"><a href="#Redshift.Generator-227"><span class="linenos">227</span></a> <span class="s2">"check"</span><span class="p">,</span> -</span><span id="Redshift.Generator-228"><a href="#Redshift.Generator-228"><span class="linenos">228</span></a> <span class="s2">"collate"</span><span class="p">,</span> -</span><span id="Redshift.Generator-229"><a href="#Redshift.Generator-229"><span class="linenos">229</span></a> <span class="s2">"column"</span><span class="p">,</span> -</span><span id="Redshift.Generator-230"><a href="#Redshift.Generator-230"><span class="linenos">230</span></a> <span class="s2">"constraint"</span><span class="p">,</span> -</span><span id="Redshift.Generator-231"><a href="#Redshift.Generator-231"><span class="linenos">231</span></a> <span class="s2">"create"</span><span class="p">,</span> -</span><span id="Redshift.Generator-232"><a href="#Redshift.Generator-232"><span class="linenos">232</span></a> <span class="s2">"credentials"</span><span class="p">,</span> -</span><span id="Redshift.Generator-233"><a href="#Redshift.Generator-233"><span class="linenos">233</span></a> <span class="s2">"cross"</span><span class="p">,</span> -</span><span id="Redshift.Generator-234"><a href="#Redshift.Generator-234"><span class="linenos">234</span></a> <span class="s2">"current_date"</span><span class="p">,</span> -</span><span id="Redshift.Generator-235"><a href="#Redshift.Generator-235"><span class="linenos">235</span></a> <span class="s2">"current_time"</span><span class="p">,</span> -</span><span id="Redshift.Generator-236"><a href="#Redshift.Generator-236"><span class="linenos">236</span></a> <span class="s2">"current_timestamp"</span><span class="p">,</span> -</span><span id="Redshift.Generator-237"><a href="#Redshift.Generator-237"><span class="linenos">237</span></a> <span class="s2">"current_user"</span><span class="p">,</span> -</span><span id="Redshift.Generator-238"><a href="#Redshift.Generator-238"><span class="linenos">238</span></a> <span class="s2">"current_user_id"</span><span class="p">,</span> -</span><span id="Redshift.Generator-239"><a href="#Redshift.Generator-239"><span class="linenos">239</span></a> <span class="s2">"default"</span><span class="p">,</span> -</span><span id="Redshift.Generator-240"><a href="#Redshift.Generator-240"><span class="linenos">240</span></a> <span class="s2">"deferrable"</span><span class="p">,</span> -</span><span id="Redshift.Generator-241"><a href="#Redshift.Generator-241"><span class="linenos">241</span></a> <span class="s2">"deflate"</span><span class="p">,</span> -</span><span id="Redshift.Generator-242"><a href="#Redshift.Generator-242"><span class="linenos">242</span></a> <span class="s2">"defrag"</span><span class="p">,</span> -</span><span id="Redshift.Generator-243"><a href="#Redshift.Generator-243"><span class="linenos">243</span></a> <span class="s2">"delta"</span><span class="p">,</span> -</span><span id="Redshift.Generator-244"><a href="#Redshift.Generator-244"><span class="linenos">244</span></a> <span class="s2">"delta32k"</span><span class="p">,</span> -</span><span id="Redshift.Generator-245"><a href="#Redshift.Generator-245"><span class="linenos">245</span></a> <span class="s2">"desc"</span><span class="p">,</span> -</span><span id="Redshift.Generator-246"><a href="#Redshift.Generator-246"><span class="linenos">246</span></a> <span class="s2">"disable"</span><span class="p">,</span> -</span><span id="Redshift.Generator-247"><a href="#Redshift.Generator-247"><span class="linenos">247</span></a> <span class="s2">"distinct"</span><span class="p">,</span> -</span><span id="Redshift.Generator-248"><a href="#Redshift.Generator-248"><span class="linenos">248</span></a> <span class="s2">"do"</span><span class="p">,</span> -</span><span id="Redshift.Generator-249"><a href="#Redshift.Generator-249"><span class="linenos">249</span></a> <span class="s2">"else"</span><span class="p">,</span> -</span><span id="Redshift.Generator-250"><a href="#Redshift.Generator-250"><span class="linenos">250</span></a> <span class="s2">"emptyasnull"</span><span class="p">,</span> -</span><span id="Redshift.Generator-251"><a href="#Redshift.Generator-251"><span class="linenos">251</span></a> <span class="s2">"enable"</span><span class="p">,</span> -</span><span id="Redshift.Generator-252"><a href="#Redshift.Generator-252"><span class="linenos">252</span></a> <span class="s2">"encode"</span><span class="p">,</span> -</span><span id="Redshift.Generator-253"><a href="#Redshift.Generator-253"><span class="linenos">253</span></a> <span class="s2">"encrypt "</span><span class="p">,</span> -</span><span id="Redshift.Generator-254"><a href="#Redshift.Generator-254"><span class="linenos">254</span></a> <span class="s2">"encryption"</span><span class="p">,</span> -</span><span id="Redshift.Generator-255"><a href="#Redshift.Generator-255"><span class="linenos">255</span></a> <span class="s2">"end"</span><span class="p">,</span> -</span><span id="Redshift.Generator-256"><a href="#Redshift.Generator-256"><span class="linenos">256</span></a> <span class="s2">"except"</span><span class="p">,</span> -</span><span id="Redshift.Generator-257"><a href="#Redshift.Generator-257"><span class="linenos">257</span></a> <span class="s2">"explicit"</span><span class="p">,</span> -</span><span id="Redshift.Generator-258"><a href="#Redshift.Generator-258"><span class="linenos">258</span></a> <span class="s2">"false"</span><span class="p">,</span> -</span><span id="Redshift.Generator-259"><a href="#Redshift.Generator-259"><span class="linenos">259</span></a> <span class="s2">"for"</span><span class="p">,</span> -</span><span id="Redshift.Generator-260"><a href="#Redshift.Generator-260"><span class="linenos">260</span></a> <span class="s2">"foreign"</span><span class="p">,</span> -</span><span id="Redshift.Generator-261"><a href="#Redshift.Generator-261"><span class="linenos">261</span></a> <span class="s2">"freeze"</span><span class="p">,</span> -</span><span id="Redshift.Generator-262"><a href="#Redshift.Generator-262"><span class="linenos">262</span></a> <span class="s2">"from"</span><span class="p">,</span> -</span><span id="Redshift.Generator-263"><a href="#Redshift.Generator-263"><span class="linenos">263</span></a> <span class="s2">"full"</span><span class="p">,</span> -</span><span id="Redshift.Generator-264"><a href="#Redshift.Generator-264"><span class="linenos">264</span></a> <span class="s2">"globaldict256"</span><span class="p">,</span> -</span><span id="Redshift.Generator-265"><a href="#Redshift.Generator-265"><span class="linenos">265</span></a> <span class="s2">"globaldict64k"</span><span class="p">,</span> -</span><span id="Redshift.Generator-266"><a href="#Redshift.Generator-266"><span class="linenos">266</span></a> <span class="s2">"grant"</span><span class="p">,</span> -</span><span id="Redshift.Generator-267"><a href="#Redshift.Generator-267"><span class="linenos">267</span></a> <span class="s2">"group"</span><span class="p">,</span> -</span><span id="Redshift.Generator-268"><a href="#Redshift.Generator-268"><span class="linenos">268</span></a> <span class="s2">"gzip"</span><span class="p">,</span> -</span><span id="Redshift.Generator-269"><a href="#Redshift.Generator-269"><span class="linenos">269</span></a> <span class="s2">"having"</span><span class="p">,</span> -</span><span id="Redshift.Generator-270"><a href="#Redshift.Generator-270"><span class="linenos">270</span></a> <span class="s2">"identity"</span><span class="p">,</span> -</span><span id="Redshift.Generator-271"><a href="#Redshift.Generator-271"><span class="linenos">271</span></a> <span class="s2">"ignore"</span><span class="p">,</span> -</span><span id="Redshift.Generator-272"><a href="#Redshift.Generator-272"><span class="linenos">272</span></a> <span class="s2">"ilike"</span><span class="p">,</span> -</span><span id="Redshift.Generator-273"><a href="#Redshift.Generator-273"><span class="linenos">273</span></a> <span class="s2">"in"</span><span class="p">,</span> -</span><span id="Redshift.Generator-274"><a href="#Redshift.Generator-274"><span class="linenos">274</span></a> <span class="s2">"initially"</span><span class="p">,</span> -</span><span id="Redshift.Generator-275"><a href="#Redshift.Generator-275"><span class="linenos">275</span></a> <span class="s2">"inner"</span><span class="p">,</span> -</span><span id="Redshift.Generator-276"><a href="#Redshift.Generator-276"><span class="linenos">276</span></a> <span class="s2">"intersect"</span><span class="p">,</span> -</span><span id="Redshift.Generator-277"><a href="#Redshift.Generator-277"><span class="linenos">277</span></a> <span class="s2">"interval"</span><span class="p">,</span> -</span><span id="Redshift.Generator-278"><a href="#Redshift.Generator-278"><span class="linenos">278</span></a> <span class="s2">"into"</span><span class="p">,</span> -</span><span id="Redshift.Generator-279"><a href="#Redshift.Generator-279"><span class="linenos">279</span></a> <span class="s2">"is"</span><span class="p">,</span> -</span><span id="Redshift.Generator-280"><a href="#Redshift.Generator-280"><span class="linenos">280</span></a> <span class="s2">"isnull"</span><span class="p">,</span> -</span><span id="Redshift.Generator-281"><a href="#Redshift.Generator-281"><span class="linenos">281</span></a> <span class="s2">"join"</span><span class="p">,</span> -</span><span id="Redshift.Generator-282"><a href="#Redshift.Generator-282"><span class="linenos">282</span></a> <span class="s2">"leading"</span><span class="p">,</span> -</span><span id="Redshift.Generator-283"><a href="#Redshift.Generator-283"><span class="linenos">283</span></a> <span class="s2">"left"</span><span class="p">,</span> -</span><span id="Redshift.Generator-284"><a href="#Redshift.Generator-284"><span class="linenos">284</span></a> <span class="s2">"like"</span><span class="p">,</span> -</span><span id="Redshift.Generator-285"><a href="#Redshift.Generator-285"><span class="linenos">285</span></a> <span class="s2">"limit"</span><span class="p">,</span> -</span><span id="Redshift.Generator-286"><a href="#Redshift.Generator-286"><span class="linenos">286</span></a> <span class="s2">"localtime"</span><span class="p">,</span> -</span><span id="Redshift.Generator-287"><a href="#Redshift.Generator-287"><span class="linenos">287</span></a> <span class="s2">"localtimestamp"</span><span class="p">,</span> -</span><span id="Redshift.Generator-288"><a href="#Redshift.Generator-288"><span class="linenos">288</span></a> <span class="s2">"lun"</span><span class="p">,</span> -</span><span id="Redshift.Generator-289"><a href="#Redshift.Generator-289"><span class="linenos">289</span></a> <span class="s2">"luns"</span><span class="p">,</span> -</span><span id="Redshift.Generator-290"><a href="#Redshift.Generator-290"><span class="linenos">290</span></a> <span class="s2">"lzo"</span><span class="p">,</span> -</span><span id="Redshift.Generator-291"><a href="#Redshift.Generator-291"><span class="linenos">291</span></a> <span class="s2">"lzop"</span><span class="p">,</span> -</span><span id="Redshift.Generator-292"><a href="#Redshift.Generator-292"><span class="linenos">292</span></a> <span class="s2">"minus"</span><span class="p">,</span> -</span><span id="Redshift.Generator-293"><a href="#Redshift.Generator-293"><span class="linenos">293</span></a> <span class="s2">"mostly16"</span><span class="p">,</span> -</span><span id="Redshift.Generator-294"><a href="#Redshift.Generator-294"><span class="linenos">294</span></a> <span class="s2">"mostly32"</span><span class="p">,</span> -</span><span id="Redshift.Generator-295"><a href="#Redshift.Generator-295"><span class="linenos">295</span></a> <span class="s2">"mostly8"</span><span class="p">,</span> -</span><span id="Redshift.Generator-296"><a href="#Redshift.Generator-296"><span class="linenos">296</span></a> <span class="s2">"natural"</span><span class="p">,</span> -</span><span id="Redshift.Generator-297"><a href="#Redshift.Generator-297"><span class="linenos">297</span></a> <span class="s2">"new"</span><span class="p">,</span> -</span><span id="Redshift.Generator-298"><a href="#Redshift.Generator-298"><span class="linenos">298</span></a> <span class="s2">"not"</span><span class="p">,</span> -</span><span id="Redshift.Generator-299"><a href="#Redshift.Generator-299"><span class="linenos">299</span></a> <span class="s2">"notnull"</span><span class="p">,</span> -</span><span id="Redshift.Generator-300"><a href="#Redshift.Generator-300"><span class="linenos">300</span></a> <span class="s2">"null"</span><span class="p">,</span> -</span><span id="Redshift.Generator-301"><a href="#Redshift.Generator-301"><span class="linenos">301</span></a> <span class="s2">"nulls"</span><span class="p">,</span> -</span><span id="Redshift.Generator-302"><a href="#Redshift.Generator-302"><span class="linenos">302</span></a> <span class="s2">"off"</span><span class="p">,</span> -</span><span id="Redshift.Generator-303"><a href="#Redshift.Generator-303"><span class="linenos">303</span></a> <span class="s2">"offline"</span><span class="p">,</span> -</span><span id="Redshift.Generator-304"><a href="#Redshift.Generator-304"><span class="linenos">304</span></a> <span class="s2">"offset"</span><span class="p">,</span> -</span><span id="Redshift.Generator-305"><a href="#Redshift.Generator-305"><span class="linenos">305</span></a> <span class="s2">"oid"</span><span class="p">,</span> -</span><span id="Redshift.Generator-306"><a href="#Redshift.Generator-306"><span class="linenos">306</span></a> <span class="s2">"old"</span><span class="p">,</span> -</span><span id="Redshift.Generator-307"><a href="#Redshift.Generator-307"><span class="linenos">307</span></a> <span class="s2">"on"</span><span class="p">,</span> -</span><span id="Redshift.Generator-308"><a href="#Redshift.Generator-308"><span class="linenos">308</span></a> <span class="s2">"only"</span><span class="p">,</span> -</span><span id="Redshift.Generator-309"><a href="#Redshift.Generator-309"><span class="linenos">309</span></a> <span class="s2">"open"</span><span class="p">,</span> -</span><span id="Redshift.Generator-310"><a href="#Redshift.Generator-310"><span class="linenos">310</span></a> <span class="s2">"or"</span><span class="p">,</span> -</span><span id="Redshift.Generator-311"><a href="#Redshift.Generator-311"><span class="linenos">311</span></a> <span class="s2">"order"</span><span class="p">,</span> -</span><span id="Redshift.Generator-312"><a href="#Redshift.Generator-312"><span class="linenos">312</span></a> <span class="s2">"outer"</span><span class="p">,</span> -</span><span id="Redshift.Generator-313"><a href="#Redshift.Generator-313"><span class="linenos">313</span></a> <span class="s2">"overlaps"</span><span class="p">,</span> -</span><span id="Redshift.Generator-314"><a href="#Redshift.Generator-314"><span class="linenos">314</span></a> <span class="s2">"parallel"</span><span class="p">,</span> -</span><span id="Redshift.Generator-315"><a href="#Redshift.Generator-315"><span class="linenos">315</span></a> <span class="s2">"partition"</span><span class="p">,</span> -</span><span id="Redshift.Generator-316"><a href="#Redshift.Generator-316"><span class="linenos">316</span></a> <span class="s2">"percent"</span><span class="p">,</span> -</span><span id="Redshift.Generator-317"><a href="#Redshift.Generator-317"><span class="linenos">317</span></a> <span class="s2">"permissions"</span><span class="p">,</span> -</span><span id="Redshift.Generator-318"><a href="#Redshift.Generator-318"><span class="linenos">318</span></a> <span class="s2">"pivot"</span><span class="p">,</span> -</span><span id="Redshift.Generator-319"><a href="#Redshift.Generator-319"><span class="linenos">319</span></a> <span class="s2">"placing"</span><span class="p">,</span> -</span><span id="Redshift.Generator-320"><a href="#Redshift.Generator-320"><span class="linenos">320</span></a> <span class="s2">"primary"</span><span class="p">,</span> -</span><span id="Redshift.Generator-321"><a href="#Redshift.Generator-321"><span class="linenos">321</span></a> <span class="s2">"raw"</span><span class="p">,</span> -</span><span id="Redshift.Generator-322"><a href="#Redshift.Generator-322"><span class="linenos">322</span></a> <span class="s2">"readratio"</span><span class="p">,</span> -</span><span id="Redshift.Generator-323"><a href="#Redshift.Generator-323"><span class="linenos">323</span></a> <span class="s2">"recover"</span><span class="p">,</span> -</span><span id="Redshift.Generator-324"><a href="#Redshift.Generator-324"><span class="linenos">324</span></a> <span class="s2">"references"</span><span class="p">,</span> -</span><span id="Redshift.Generator-325"><a href="#Redshift.Generator-325"><span class="linenos">325</span></a> <span class="s2">"rejectlog"</span><span class="p">,</span> -</span><span id="Redshift.Generator-326"><a href="#Redshift.Generator-326"><span class="linenos">326</span></a> <span class="s2">"resort"</span><span class="p">,</span> -</span><span id="Redshift.Generator-327"><a href="#Redshift.Generator-327"><span class="linenos">327</span></a> <span class="s2">"respect"</span><span class="p">,</span> -</span><span id="Redshift.Generator-328"><a href="#Redshift.Generator-328"><span class="linenos">328</span></a> <span class="s2">"restore"</span><span class="p">,</span> -</span><span id="Redshift.Generator-329"><a href="#Redshift.Generator-329"><span class="linenos">329</span></a> <span class="s2">"right"</span><span class="p">,</span> -</span><span id="Redshift.Generator-330"><a href="#Redshift.Generator-330"><span class="linenos">330</span></a> <span class="s2">"select"</span><span class="p">,</span> -</span><span id="Redshift.Generator-331"><a href="#Redshift.Generator-331"><span class="linenos">331</span></a> <span class="s2">"session_user"</span><span class="p">,</span> -</span><span id="Redshift.Generator-332"><a href="#Redshift.Generator-332"><span class="linenos">332</span></a> <span class="s2">"similar"</span><span class="p">,</span> -</span><span id="Redshift.Generator-333"><a href="#Redshift.Generator-333"><span class="linenos">333</span></a> <span class="s2">"snapshot"</span><span class="p">,</span> -</span><span id="Redshift.Generator-334"><a href="#Redshift.Generator-334"><span class="linenos">334</span></a> <span class="s2">"some"</span><span class="p">,</span> -</span><span id="Redshift.Generator-335"><a href="#Redshift.Generator-335"><span class="linenos">335</span></a> <span class="s2">"sysdate"</span><span class="p">,</span> -</span><span id="Redshift.Generator-336"><a href="#Redshift.Generator-336"><span class="linenos">336</span></a> <span class="s2">"system"</span><span class="p">,</span> -</span><span id="Redshift.Generator-337"><a href="#Redshift.Generator-337"><span class="linenos">337</span></a> <span class="s2">"table"</span><span class="p">,</span> -</span><span id="Redshift.Generator-338"><a href="#Redshift.Generator-338"><span class="linenos">338</span></a> <span class="s2">"tag"</span><span class="p">,</span> -</span><span id="Redshift.Generator-339"><a href="#Redshift.Generator-339"><span class="linenos">339</span></a> <span class="s2">"tdes"</span><span class="p">,</span> -</span><span id="Redshift.Generator-340"><a href="#Redshift.Generator-340"><span class="linenos">340</span></a> <span class="s2">"text255"</span><span class="p">,</span> -</span><span id="Redshift.Generator-341"><a href="#Redshift.Generator-341"><span class="linenos">341</span></a> <span class="s2">"text32k"</span><span class="p">,</span> -</span><span id="Redshift.Generator-342"><a href="#Redshift.Generator-342"><span class="linenos">342</span></a> <span class="s2">"then"</span><span class="p">,</span> -</span><span id="Redshift.Generator-343"><a href="#Redshift.Generator-343"><span class="linenos">343</span></a> <span class="s2">"timestamp"</span><span class="p">,</span> -</span><span id="Redshift.Generator-344"><a href="#Redshift.Generator-344"><span class="linenos">344</span></a> <span class="s2">"to"</span><span class="p">,</span> -</span><span id="Redshift.Generator-345"><a href="#Redshift.Generator-345"><span class="linenos">345</span></a> <span class="s2">"top"</span><span class="p">,</span> -</span><span id="Redshift.Generator-346"><a href="#Redshift.Generator-346"><span class="linenos">346</span></a> <span class="s2">"trailing"</span><span class="p">,</span> -</span><span id="Redshift.Generator-347"><a href="#Redshift.Generator-347"><span class="linenos">347</span></a> <span class="s2">"true"</span><span class="p">,</span> -</span><span id="Redshift.Generator-348"><a href="#Redshift.Generator-348"><span class="linenos">348</span></a> <span class="s2">"truncatecolumns"</span><span class="p">,</span> -</span><span id="Redshift.Generator-349"><a href="#Redshift.Generator-349"><span class="linenos">349</span></a> <span class="s2">"type"</span><span class="p">,</span> -</span><span id="Redshift.Generator-350"><a href="#Redshift.Generator-350"><span class="linenos">350</span></a> <span class="s2">"union"</span><span class="p">,</span> -</span><span id="Redshift.Generator-351"><a href="#Redshift.Generator-351"><span class="linenos">351</span></a> <span class="s2">"unique"</span><span class="p">,</span> -</span><span id="Redshift.Generator-352"><a href="#Redshift.Generator-352"><span class="linenos">352</span></a> <span class="s2">"unnest"</span><span class="p">,</span> -</span><span id="Redshift.Generator-353"><a href="#Redshift.Generator-353"><span class="linenos">353</span></a> <span class="s2">"unpivot"</span><span class="p">,</span> -</span><span id="Redshift.Generator-354"><a href="#Redshift.Generator-354"><span class="linenos">354</span></a> <span class="s2">"user"</span><span class="p">,</span> -</span><span id="Redshift.Generator-355"><a href="#Redshift.Generator-355"><span class="linenos">355</span></a> <span class="s2">"using"</span><span class="p">,</span> -</span><span id="Redshift.Generator-356"><a href="#Redshift.Generator-356"><span class="linenos">356</span></a> <span class="s2">"verbose"</span><span class="p">,</span> -</span><span id="Redshift.Generator-357"><a href="#Redshift.Generator-357"><span class="linenos">357</span></a> <span class="s2">"wallet"</span><span class="p">,</span> -</span><span id="Redshift.Generator-358"><a href="#Redshift.Generator-358"><span class="linenos">358</span></a> <span class="s2">"when"</span><span class="p">,</span> -</span><span id="Redshift.Generator-359"><a href="#Redshift.Generator-359"><span class="linenos">359</span></a> <span class="s2">"where"</span><span class="p">,</span> -</span><span id="Redshift.Generator-360"><a href="#Redshift.Generator-360"><span class="linenos">360</span></a> <span class="s2">"with"</span><span class="p">,</span> -</span><span id="Redshift.Generator-361"><a href="#Redshift.Generator-361"><span class="linenos">361</span></a> <span class="s2">"without"</span><span class="p">,</span> -</span><span id="Redshift.Generator-362"><a href="#Redshift.Generator-362"><span class="linenos">362</span></a> <span class="p">}</span> -</span><span id="Redshift.Generator-363"><a href="#Redshift.Generator-363"><span class="linenos">363</span></a> -</span><span id="Redshift.Generator-364"><a href="#Redshift.Generator-364"><span class="linenos">364</span></a> <span class="k">def</span> <span class="nf">unnest_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">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Redshift.Generator-365"><a href="#Redshift.Generator-365"><span class="linenos">365</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> -</span><span id="Redshift.Generator-366"><a href="#Redshift.Generator-366"><span class="linenos">366</span></a> <span class="n">num_args</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> -</span><span id="Redshift.Generator-367"><a href="#Redshift.Generator-367"><span class="linenos">367</span></a> -</span><span id="Redshift.Generator-368"><a href="#Redshift.Generator-368"><span class="linenos">368</span></a> <span class="k">if</span> <span class="n">num_args</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> -</span><span id="Redshift.Generator-369"><a href="#Redshift.Generator-369"><span class="linenos">369</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported number of arguments in UNNEST: </span><span class="si">{</span><span class="n">num_args</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> -</span><span id="Redshift.Generator-370"><a href="#Redshift.Generator-370"><span class="linenos">370</span></a> <span class="k">return</span> <span class="s2">""</span> -</span><span id="Redshift.Generator-371"><a href="#Redshift.Generator-371"><span class="linenos">371</span></a> -</span><span id="Redshift.Generator-372"><a href="#Redshift.Generator-372"><span class="linenos">372</span></a> <span class="n">arg</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">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> -</span><span id="Redshift.Generator-373"><a href="#Redshift.Generator-373"><span class="linenos">373</span></a> <span class="n">alias</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="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</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="Redshift.Generator-374"><a href="#Redshift.Generator-374"><span class="linenos">374</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">arg</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">arg</span> -</span><span id="Redshift.Generator-375"><a href="#Redshift.Generator-375"><span class="linenos">375</span></a> -</span><span id="Redshift.Generator-376"><a href="#Redshift.Generator-376"><span class="linenos">376</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Redshift.Generator-377"><a href="#Redshift.Generator-377"><span class="linenos">377</span></a><span class="w"> </span><span class="sd">"""Redshift doesn't have `WITH` as part of their with_properties so we remove it"""</span> -</span><span id="Redshift.Generator-378"><a href="#Redshift.Generator-378"><span class="linenos">378</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> -</span><span id="Redshift.Generator-379"><a href="#Redshift.Generator-379"><span class="linenos">379</span></a> -</span><span id="Redshift.Generator-380"><a href="#Redshift.Generator-380"><span class="linenos">380</span></a> <span class="k">def</span> <span class="nf">cast_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">Cast</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Redshift.Generator-381"><a href="#Redshift.Generator-381"><span class="linenos">381</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</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">JSON</span><span class="p">):</span> -</span><span id="Redshift.Generator-382"><a href="#Redshift.Generator-382"><span class="linenos">382</span></a> <span class="c1"># Redshift doesn't support a JSON type, so casting to it is treated as a noop</span> -</span><span id="Redshift.Generator-383"><a href="#Redshift.Generator-383"><span class="linenos">383</span></a> <span class="k">return</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="Redshift.Generator-384"><a href="#Redshift.Generator-384"><span class="linenos">384</span></a> -</span><span id="Redshift.Generator-385"><a href="#Redshift.Generator-385"><span class="linenos">385</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="o">=</span><span class="n">safe_prefix</span><span class="p">)</span> -</span><span id="Redshift.Generator-386"><a href="#Redshift.Generator-386"><span class="linenos">386</span></a> -</span><span id="Redshift.Generator-387"><a href="#Redshift.Generator-387"><span class="linenos">387</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="Redshift.Generator-388"><a href="#Redshift.Generator-388"><span class="linenos">388</span></a><span class="w"> </span><span class="sd">"""</span> -</span><span id="Redshift.Generator-389"><a href="#Redshift.Generator-389"><span class="linenos">389</span></a><span class="sd"> Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean</span> -</span><span id="Redshift.Generator-390"><a href="#Redshift.Generator-390"><span class="linenos">390</span></a><span class="sd"> VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type</span> -</span><span id="Redshift.Generator-391"><a href="#Redshift.Generator-391"><span class="linenos">391</span></a><span class="sd"> without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert</span> -</span><span id="Redshift.Generator-392"><a href="#Redshift.Generator-392"><span class="linenos">392</span></a><span class="sd"> `TEXT` to `VARCHAR`.</span> -</span><span id="Redshift.Generator-393"><a href="#Redshift.Generator-393"><span class="linenos">393</span></a><span class="sd"> """</span> -</span><span id="Redshift.Generator-394"><a href="#Redshift.Generator-394"><span class="linenos">394</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">"text"</span><span class="p">):</span> -</span><span id="Redshift.Generator-395"><a href="#Redshift.Generator-395"><span class="linenos">395</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</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">VARCHAR</span><span class="p">)</span> -</span><span id="Redshift.Generator-396"><a href="#Redshift.Generator-396"><span class="linenos">396</span></a> <span class="n">precision</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">"expressions"</span><span class="p">)</span> -</span><span id="Redshift.Generator-397"><a href="#Redshift.Generator-397"><span class="linenos">397</span></a> -</span><span id="Redshift.Generator-398"><a href="#Redshift.Generator-398"><span class="linenos">398</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">precision</span><span class="p">:</span> -</span><span id="Redshift.Generator-399"><a href="#Redshift.Generator-399"><span class="linenos">399</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"MAX"</span><span class="p">))</span> +</span><span id="Redshift.Generator-204"><a href="#Redshift.Generator-204"><span class="linenos">204</span></a> <span class="c1"># Redshift supports LAST_DAY(..)</span> +</span><span id="Redshift.Generator-205"><a href="#Redshift.Generator-205"><span class="linenos">205</span></a> <span class="n">TRANSFORMS</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">exp</span><span class="o">.</span><span class="n">LastDay</span><span class="p">)</span> +</span><span id="Redshift.Generator-206"><a href="#Redshift.Generator-206"><span class="linenos">206</span></a> +</span><span id="Redshift.Generator-207"><a href="#Redshift.Generator-207"><span class="linenos">207</span></a> <span class="n">RESERVED_KEYWORDS</span> <span class="o">=</span> <span class="p">{</span> +</span><span id="Redshift.Generator-208"><a href="#Redshift.Generator-208"><span class="linenos">208</span></a> <span class="s2">"aes128"</span><span class="p">,</span> +</span><span id="Redshift.Generator-209"><a href="#Redshift.Generator-209"><span class="linenos">209</span></a> <span class="s2">"aes256"</span><span class="p">,</span> +</span><span id="Redshift.Generator-210"><a href="#Redshift.Generator-210"><span class="linenos">210</span></a> <span class="s2">"all"</span><span class="p">,</span> +</span><span id="Redshift.Generator-211"><a href="#Redshift.Generator-211"><span class="linenos">211</span></a> <span class="s2">"allowoverwrite"</span><span class="p">,</span> +</span><span id="Redshift.Generator-212"><a href="#Redshift.Generator-212"><span class="linenos">212</span></a> <span class="s2">"analyse"</span><span class="p">,</span> +</span><span id="Redshift.Generator-213"><a href="#Redshift.Generator-213"><span class="linenos">213</span></a> <span class="s2">"analyze"</span><span class="p">,</span> +</span><span id="Redshift.Generator-214"><a href="#Redshift.Generator-214"><span class="linenos">214</span></a> <span class="s2">"and"</span><span class="p">,</span> +</span><span id="Redshift.Generator-215"><a href="#Redshift.Generator-215"><span class="linenos">215</span></a> <span class="s2">"any"</span><span class="p">,</span> +</span><span id="Redshift.Generator-216"><a href="#Redshift.Generator-216"><span class="linenos">216</span></a> <span class="s2">"array"</span><span class="p">,</span> +</span><span id="Redshift.Generator-217"><a href="#Redshift.Generator-217"><span class="linenos">217</span></a> <span class="s2">"as"</span><span class="p">,</span> +</span><span id="Redshift.Generator-218"><a href="#Redshift.Generator-218"><span class="linenos">218</span></a> <span class="s2">"asc"</span><span class="p">,</span> +</span><span id="Redshift.Generator-219"><a href="#Redshift.Generator-219"><span class="linenos">219</span></a> <span class="s2">"authorization"</span><span class="p">,</span> +</span><span id="Redshift.Generator-220"><a href="#Redshift.Generator-220"><span class="linenos">220</span></a> <span class="s2">"az64"</span><span class="p">,</span> +</span><span id="Redshift.Generator-221"><a href="#Redshift.Generator-221"><span class="linenos">221</span></a> <span class="s2">"backup"</span><span class="p">,</span> +</span><span id="Redshift.Generator-222"><a href="#Redshift.Generator-222"><span class="linenos">222</span></a> <span class="s2">"between"</span><span class="p">,</span> +</span><span id="Redshift.Generator-223"><a href="#Redshift.Generator-223"><span class="linenos">223</span></a> <span class="s2">"binary"</span><span class="p">,</span> +</span><span id="Redshift.Generator-224"><a href="#Redshift.Generator-224"><span class="linenos">224</span></a> <span class="s2">"blanksasnull"</span><span class="p">,</span> +</span><span id="Redshift.Generator-225"><a href="#Redshift.Generator-225"><span class="linenos">225</span></a> <span class="s2">"both"</span><span class="p">,</span> +</span><span id="Redshift.Generator-226"><a href="#Redshift.Generator-226"><span class="linenos">226</span></a> <span class="s2">"bytedict"</span><span class="p">,</span> +</span><span id="Redshift.Generator-227"><a href="#Redshift.Generator-227"><span class="linenos">227</span></a> <span class="s2">"bzip2"</span><span class="p">,</span> +</span><span id="Redshift.Generator-228"><a href="#Redshift.Generator-228"><span class="linenos">228</span></a> <span class="s2">"case"</span><span class="p">,</span> +</span><span id="Redshift.Generator-229"><a href="#Redshift.Generator-229"><span class="linenos">229</span></a> <span class="s2">"cast"</span><span class="p">,</span> +</span><span id="Redshift.Generator-230"><a href="#Redshift.Generator-230"><span class="linenos">230</span></a> <span class="s2">"check"</span><span class="p">,</span> +</span><span id="Redshift.Generator-231"><a href="#Redshift.Generator-231"><span class="linenos">231</span></a> <span class="s2">"collate"</span><span class="p">,</span> +</span><span id="Redshift.Generator-232"><a href="#Redshift.Generator-232"><span class="linenos">232</span></a> <span class="s2">"column"</span><span class="p">,</span> +</span><span id="Redshift.Generator-233"><a href="#Redshift.Generator-233"><span class="linenos">233</span></a> <span class="s2">"constraint"</span><span class="p">,</span> +</span><span id="Redshift.Generator-234"><a href="#Redshift.Generator-234"><span class="linenos">234</span></a> <span class="s2">"create"</span><span class="p">,</span> +</span><span id="Redshift.Generator-235"><a href="#Redshift.Generator-235"><span class="linenos">235</span></a> <span class="s2">"credentials"</span><span class="p">,</span> +</span><span id="Redshift.Generator-236"><a href="#Redshift.Generator-236"><span class="linenos">236</span></a> <span class="s2">"cross"</span><span class="p">,</span> +</span><span id="Redshift.Generator-237"><a href="#Redshift.Generator-237"><span class="linenos">237</span></a> <span class="s2">"current_date"</span><span class="p">,</span> +</span><span id="Redshift.Generator-238"><a href="#Redshift.Generator-238"><span class="linenos">238</span></a> <span class="s2">"current_time"</span><span class="p">,</span> +</span><span id="Redshift.Generator-239"><a href="#Redshift.Generator-239"><span class="linenos">239</span></a> <span class="s2">"current_timestamp"</span><span class="p">,</span> +</span><span id="Redshift.Generator-240"><a href="#Redshift.Generator-240"><span class="linenos">240</span></a> <span class="s2">"current_user"</span><span class="p">,</span> +</span><span id="Redshift.Generator-241"><a href="#Redshift.Generator-241"><span class="linenos">241</span></a> <span class="s2">"current_user_id"</span><span class="p">,</span> +</span><span id="Redshift.Generator-242"><a href="#Redshift.Generator-242"><span class="linenos">242</span></a> <span class="s2">"default"</span><span class="p">,</span> +</span><span id="Redshift.Generator-243"><a href="#Redshift.Generator-243"><span class="linenos">243</span></a> <span class="s2">"deferrable"</span><span class="p">,</span> +</span><span id="Redshift.Generator-244"><a href="#Redshift.Generator-244"><span class="linenos">244</span></a> <span class="s2">"deflate"</span><span class="p">,</span> +</span><span id="Redshift.Generator-245"><a href="#Redshift.Generator-245"><span class="linenos">245</span></a> <span class="s2">"defrag"</span><span class="p">,</span> +</span><span id="Redshift.Generator-246"><a href="#Redshift.Generator-246"><span class="linenos">246</span></a> <span class="s2">"delta"</span><span class="p">,</span> +</span><span id="Redshift.Generator-247"><a href="#Redshift.Generator-247"><span class="linenos">247</span></a> <span class="s2">"delta32k"</span><span class="p">,</span> +</span><span id="Redshift.Generator-248"><a href="#Redshift.Generator-248"><span class="linenos">248</span></a> <span class="s2">"desc"</span><span class="p">,</span> +</span><span id="Redshift.Generator-249"><a href="#Redshift.Generator-249"><span class="linenos">249</span></a> <span class="s2">"disable"</span><span class="p">,</span> +</span><span id="Redshift.Generator-250"><a href="#Redshift.Generator-250"><span class="linenos">250</span></a> <span class="s2">"distinct"</span><span class="p">,</span> +</span><span id="Redshift.Generator-251"><a href="#Redshift.Generator-251"><span class="linenos">251</span></a> <span class="s2">"do"</span><span class="p">,</span> +</span><span id="Redshift.Generator-252"><a href="#Redshift.Generator-252"><span class="linenos">252</span></a> <span class="s2">"else"</span><span class="p">,</span> +</span><span id="Redshift.Generator-253"><a href="#Redshift.Generator-253"><span class="linenos">253</span></a> <span class="s2">"emptyasnull"</span><span class="p">,</span> +</span><span id="Redshift.Generator-254"><a href="#Redshift.Generator-254"><span class="linenos">254</span></a> <span class="s2">"enable"</span><span class="p">,</span> +</span><span id="Redshift.Generator-255"><a href="#Redshift.Generator-255"><span class="linenos">255</span></a> <span class="s2">"encode"</span><span class="p">,</span> +</span><span id="Redshift.Generator-256"><a href="#Redshift.Generator-256"><span class="linenos">256</span></a> <span class="s2">"encrypt "</span><span class="p">,</span> +</span><span id="Redshift.Generator-257"><a href="#Redshift.Generator-257"><span class="linenos">257</span></a> <span class="s2">"encryption"</span><span class="p">,</span> +</span><span id="Redshift.Generator-258"><a href="#Redshift.Generator-258"><span class="linenos">258</span></a> <span class="s2">"end"</span><span class="p">,</span> +</span><span id="Redshift.Generator-259"><a href="#Redshift.Generator-259"><span class="linenos">259</span></a> <span class="s2">"except"</span><span class="p">,</span> +</span><span id="Redshift.Generator-260"><a href="#Redshift.Generator-260"><span class="linenos">260</span></a> <span class="s2">"explicit"</span><span class="p">,</span> +</span><span id="Redshift.Generator-261"><a href="#Redshift.Generator-261"><span class="linenos">261</span></a> <span class="s2">"false"</span><span class="p">,</span> +</span><span id="Redshift.Generator-262"><a href="#Redshift.Generator-262"><span class="linenos">262</span></a> <span class="s2">"for"</span><span class="p">,</span> +</span><span id="Redshift.Generator-263"><a href="#Redshift.Generator-263"><span class="linenos">263</span></a> <span class="s2">"foreign"</span><span class="p">,</span> +</span><span id="Redshift.Generator-264"><a href="#Redshift.Generator-264"><span class="linenos">264</span></a> <span class="s2">"freeze"</span><span class="p">,</span> +</span><span id="Redshift.Generator-265"><a href="#Redshift.Generator-265"><span class="linenos">265</span></a> <span class="s2">"from"</span><span class="p">,</span> +</span><span id="Redshift.Generator-266"><a href="#Redshift.Generator-266"><span class="linenos">266</span></a> <span class="s2">"full"</span><span class="p">,</span> +</span><span id="Redshift.Generator-267"><a href="#Redshift.Generator-267"><span class="linenos">267</span></a> <span class="s2">"globaldict256"</span><span class="p">,</span> +</span><span id="Redshift.Generator-268"><a href="#Redshift.Generator-268"><span class="linenos">268</span></a> <span class="s2">"globaldict64k"</span><span class="p">,</span> +</span><span id="Redshift.Generator-269"><a href="#Redshift.Generator-269"><span class="linenos">269</span></a> <span class="s2">"grant"</span><span class="p">,</span> +</span><span id="Redshift.Generator-270"><a href="#Redshift.Generator-270"><span class="linenos">270</span></a> <span class="s2">"group"</span><span class="p">,</span> +</span><span id="Redshift.Generator-271"><a href="#Redshift.Generator-271"><span class="linenos">271</span></a> <span class="s2">"gzip"</span><span class="p">,</span> +</span><span id="Redshift.Generator-272"><a href="#Redshift.Generator-272"><span class="linenos">272</span></a> <span class="s2">"having"</span><span class="p">,</span> +</span><span id="Redshift.Generator-273"><a href="#Redshift.Generator-273"><span class="linenos">273</span></a> <span class="s2">"identity"</span><span class="p">,</span> +</span><span id="Redshift.Generator-274"><a href="#Redshift.Generator-274"><span class="linenos">274</span></a> <span class="s2">"ignore"</span><span class="p">,</span> +</span><span id="Redshift.Generator-275"><a href="#Redshift.Generator-275"><span class="linenos">275</span></a> <span class="s2">"ilike"</span><span class="p">,</span> +</span><span id="Redshift.Generator-276"><a href="#Redshift.Generator-276"><span class="linenos">276</span></a> <span class="s2">"in"</span><span class="p">,</span> +</span><span id="Redshift.Generator-277"><a href="#Redshift.Generator-277"><span class="linenos">277</span></a> <span class="s2">"initially"</span><span class="p">,</span> +</span><span id="Redshift.Generator-278"><a href="#Redshift.Generator-278"><span class="linenos">278</span></a> <span class="s2">"inner"</span><span class="p">,</span> +</span><span id="Redshift.Generator-279"><a href="#Redshift.Generator-279"><span class="linenos">279</span></a> <span class="s2">"intersect"</span><span class="p">,</span> +</span><span id="Redshift.Generator-280"><a href="#Redshift.Generator-280"><span class="linenos">280</span></a> <span class="s2">"interval"</span><span class="p">,</span> +</span><span id="Redshift.Generator-281"><a href="#Redshift.Generator-281"><span class="linenos">281</span></a> <span class="s2">"into"</span><span class="p">,</span> +</span><span id="Redshift.Generator-282"><a href="#Redshift.Generator-282"><span class="linenos">282</span></a> <span class="s2">"is"</span><span class="p">,</span> +</span><span id="Redshift.Generator-283"><a href="#Redshift.Generator-283"><span class="linenos">283</span></a> <span class="s2">"isnull"</span><span class="p">,</span> +</span><span id="Redshift.Generator-284"><a href="#Redshift.Generator-284"><span class="linenos">284</span></a> <span class="s2">"join"</span><span class="p">,</span> +</span><span id="Redshift.Generator-285"><a href="#Redshift.Generator-285"><span class="linenos">285</span></a> <span class="s2">"leading"</span><span class="p">,</span> +</span><span id="Redshift.Generator-286"><a href="#Redshift.Generator-286"><span class="linenos">286</span></a> <span class="s2">"left"</span><span class="p">,</span> +</span><span id="Redshift.Generator-287"><a href="#Redshift.Generator-287"><span class="linenos">287</span></a> <span class="s2">"like"</span><span class="p">,</span> +</span><span id="Redshift.Generator-288"><a href="#Redshift.Generator-288"><span class="linenos">288</span></a> <span class="s2">"limit"</span><span class="p">,</span> +</span><span id="Redshift.Generator-289"><a href="#Redshift.Generator-289"><span class="linenos">289</span></a> <span class="s2">"localtime"</span><span class="p">,</span> +</span><span id="Redshift.Generator-290"><a href="#Redshift.Generator-290"><span class="linenos">290</span></a> <span class="s2">"localtimestamp"</span><span class="p">,</span> +</span><span id="Redshift.Generator-291"><a href="#Redshift.Generator-291"><span class="linenos">291</span></a> <span class="s2">"lun"</span><span class="p">,</span> +</span><span id="Redshift.Generator-292"><a href="#Redshift.Generator-292"><span class="linenos">292</span></a> <span class="s2">"luns"</span><span class="p">,</span> +</span><span id="Redshift.Generator-293"><a href="#Redshift.Generator-293"><span class="linenos">293</span></a> <span class="s2">"lzo"</span><span class="p">,</span> +</span><span id="Redshift.Generator-294"><a href="#Redshift.Generator-294"><span class="linenos">294</span></a> <span class="s2">"lzop"</span><span class="p">,</span> +</span><span id="Redshift.Generator-295"><a href="#Redshift.Generator-295"><span class="linenos">295</span></a> <span class="s2">"minus"</span><span class="p">,</span> +</span><span id="Redshift.Generator-296"><a href="#Redshift.Generator-296"><span class="linenos">296</span></a> <span class="s2">"mostly16"</span><span class="p">,</span> +</span><span id="Redshift.Generator-297"><a href="#Redshift.Generator-297"><span class="linenos">297</span></a> <span class="s2">"mostly32"</span><span class="p">,</span> +</span><span id="Redshift.Generator-298"><a href="#Redshift.Generator-298"><span class="linenos">298</span></a> <span class="s2">"mostly8"</span><span class="p">,</span> +</span><span id="Redshift.Generator-299"><a href="#Redshift.Generator-299"><span class="linenos">299</span></a> <span class="s2">"natural"</span><span class="p">,</span> +</span><span id="Redshift.Generator-300"><a href="#Redshift.Generator-300"><span class="linenos">300</span></a> <span class="s2">"new"</span><span class="p">,</span> +</span><span id="Redshift.Generator-301"><a href="#Redshift.Generator-301"><span class="linenos">301</span></a> <span class="s2">"not"</span><span class="p">,</span> +</span><span id="Redshift.Generator-302"><a href="#Redshift.Generator-302"><span class="linenos">302</span></a> <span class="s2">"notnull"</span><span class="p">,</span> +</span><span id="Redshift.Generator-303"><a href="#Redshift.Generator-303"><span class="linenos">303</span></a> <span class="s2">"null"</span><span class="p">,</span> +</span><span id="Redshift.Generator-304"><a href="#Redshift.Generator-304"><span class="linenos">304</span></a> <span class="s2">"nulls"</span><span class="p">,</span> +</span><span id="Redshift.Generator-305"><a href="#Redshift.Generator-305"><span class="linenos">305</span></a> <span class="s2">"off"</span><span class="p">,</span> +</span><span id="Redshift.Generator-306"><a href="#Redshift.Generator-306"><span class="linenos">306</span></a> <span class="s2">"offline"</span><span class="p">,</span> +</span><span id="Redshift.Generator-307"><a href="#Redshift.Generator-307"><span class="linenos">307</span></a> <span class="s2">"offset"</span><span class="p">,</span> +</span><span id="Redshift.Generator-308"><a href="#Redshift.Generator-308"><span class="linenos">308</span></a> <span class="s2">"oid"</span><span class="p">,</span> +</span><span id="Redshift.Generator-309"><a href="#Redshift.Generator-309"><span class="linenos">309</span></a> <span class="s2">"old"</span><span class="p">,</span> +</span><span id="Redshift.Generator-310"><a href="#Redshift.Generator-310"><span class="linenos">310</span></a> <span class="s2">"on"</span><span class="p">,</span> +</span><span id="Redshift.Generator-311"><a href="#Redshift.Generator-311"><span class="linenos">311</span></a> <span class="s2">"only"</span><span class="p">,</span> +</span><span id="Redshift.Generator-312"><a href="#Redshift.Generator-312"><span class="linenos">312</span></a> <span class="s2">"open"</span><span class="p">,</span> +</span><span id="Redshift.Generator-313"><a href="#Redshift.Generator-313"><span class="linenos">313</span></a> <span class="s2">"or"</span><span class="p">,</span> +</span><span id="Redshift.Generator-314"><a href="#Redshift.Generator-314"><span class="linenos">314</span></a> <span class="s2">"order"</span><span class="p">,</span> +</span><span id="Redshift.Generator-315"><a href="#Redshift.Generator-315"><span class="linenos">315</span></a> <span class="s2">"outer"</span><span class="p">,</span> +</span><span id="Redshift.Generator-316"><a href="#Redshift.Generator-316"><span class="linenos">316</span></a> <span class="s2">"overlaps"</span><span class="p">,</span> +</span><span id="Redshift.Generator-317"><a href="#Redshift.Generator-317"><span class="linenos">317</span></a> <span class="s2">"parallel"</span><span class="p">,</span> +</span><span id="Redshift.Generator-318"><a href="#Redshift.Generator-318"><span class="linenos">318</span></a> <span class="s2">"partition"</span><span class="p">,</span> +</span><span id="Redshift.Generator-319"><a href="#Redshift.Generator-319"><span class="linenos">319</span></a> <span class="s2">"percent"</span><span class="p">,</span> +</span><span id="Redshift.Generator-320"><a href="#Redshift.Generator-320"><span class="linenos">320</span></a> <span class="s2">"permissions"</span><span class="p">,</span> +</span><span id="Redshift.Generator-321"><a href="#Redshift.Generator-321"><span class="linenos">321</span></a> <span class="s2">"pivot"</span><span class="p">,</span> +</span><span id="Redshift.Generator-322"><a href="#Redshift.Generator-322"><span class="linenos">322</span></a> <span class="s2">"placing"</span><span class="p">,</span> +</span><span id="Redshift.Generator-323"><a href="#Redshift.Generator-323"><span class="linenos">323</span></a> <span class="s2">"primary"</span><span class="p">,</span> +</span><span id="Redshift.Generator-324"><a href="#Redshift.Generator-324"><span class="linenos">324</span></a> <span class="s2">"raw"</span><span class="p">,</span> +</span><span id="Redshift.Generator-325"><a href="#Redshift.Generator-325"><span class="linenos">325</span></a> <span class="s2">"readratio"</span><span class="p">,</span> +</span><span id="Redshift.Generator-326"><a href="#Redshift.Generator-326"><span class="linenos">326</span></a> <span class="s2">"recover"</span><span class="p">,</span> +</span><span id="Redshift.Generator-327"><a href="#Redshift.Generator-327"><span class="linenos">327</span></a> <span class="s2">"references"</span><span class="p">,</span> +</span><span id="Redshift.Generator-328"><a href="#Redshift.Generator-328"><span class="linenos">328</span></a> <span class="s2">"rejectlog"</span><span class="p">,</span> +</span><span id="Redshift.Generator-329"><a href="#Redshift.Generator-329"><span class="linenos">329</span></a> <span class="s2">"resort"</span><span class="p">,</span> +</span><span id="Redshift.Generator-330"><a href="#Redshift.Generator-330"><span class="linenos">330</span></a> <span class="s2">"respect"</span><span class="p">,</span> +</span><span id="Redshift.Generator-331"><a href="#Redshift.Generator-331"><span class="linenos">331</span></a> <span class="s2">"restore"</span><span class="p">,</span> +</span><span id="Redshift.Generator-332"><a href="#Redshift.Generator-332"><span class="linenos">332</span></a> <span class="s2">"right"</span><span class="p">,</span> +</span><span id="Redshift.Generator-333"><a href="#Redshift.Generator-333"><span class="linenos">333</span></a> <span class="s2">"select"</span><span class="p">,</span> +</span><span id="Redshift.Generator-334"><a href="#Redshift.Generator-334"><span class="linenos">334</span></a> <span class="s2">"session_user"</span><span class="p">,</span> +</span><span id="Redshift.Generator-335"><a href="#Redshift.Generator-335"><span class="linenos">335</span></a> <span class="s2">"similar"</span><span class="p">,</span> +</span><span id="Redshift.Generator-336"><a href="#Redshift.Generator-336"><span class="linenos">336</span></a> <span class="s2">"snapshot"</span><span class="p">,</span> +</span><span id="Redshift.Generator-337"><a href="#Redshift.Generator-337"><span class="linenos">337</span></a> <span class="s2">"some"</span><span class="p">,</span> +</span><span id="Redshift.Generator-338"><a href="#Redshift.Generator-338"><span class="linenos">338</span></a> <span class="s2">"sysdate"</span><span class="p">,</span> +</span><span id="Redshift.Generator-339"><a href="#Redshift.Generator-339"><span class="linenos">339</span></a> <span class="s2">"system"</span><span class="p">,</span> +</span><span id="Redshift.Generator-340"><a href="#Redshift.Generator-340"><span class="linenos">340</span></a> <span class="s2">"table"</span><span class="p">,</span> +</span><span id="Redshift.Generator-341"><a href="#Redshift.Generator-341"><span class="linenos">341</span></a> <span class="s2">"tag"</span><span class="p">,</span> +</span><span id="Redshift.Generator-342"><a href="#Redshift.Generator-342"><span class="linenos">342</span></a> <span class="s2">"tdes"</span><span class="p">,</span> +</span><span id="Redshift.Generator-343"><a href="#Redshift.Generator-343"><span class="linenos">343</span></a> <span class="s2">"text255"</span><span class="p">,</span> +</span><span id="Redshift.Generator-344"><a href="#Redshift.Generator-344"><span class="linenos">344</span></a> <span class="s2">"text32k"</span><span class="p">,</span> +</span><span id="Redshift.Generator-345"><a href="#Redshift.Generator-345"><span class="linenos">345</span></a> <span class="s2">"then"</span><span class="p">,</span> +</span><span id="Redshift.Generator-346"><a href="#Redshift.Generator-346"><span class="linenos">346</span></a> <span class="s2">"timestamp"</span><span class="p">,</span> +</span><span id="Redshift.Generator-347"><a href="#Redshift.Generator-347"><span class="linenos">347</span></a> <span class="s2">"to"</span><span class="p">,</span> +</span><span id="Redshift.Generator-348"><a href="#Redshift.Generator-348"><span class="linenos">348</span></a> <span class="s2">"top"</span><span class="p">,</span> +</span><span id="Redshift.Generator-349"><a href="#Redshift.Generator-349"><span class="linenos">349</span></a> <span class="s2">"trailing"</span><span class="p">,</span> +</span><span id="Redshift.Generator-350"><a href="#Redshift.Generator-350"><span class="linenos">350</span></a> <span class="s2">"true"</span><span class="p">,</span> +</span><span id="Redshift.Generator-351"><a href="#Redshift.Generator-351"><span class="linenos">351</span></a> <span class="s2">"truncatecolumns"</span><span class="p">,</span> +</span><span id="Redshift.Generator-352"><a href="#Redshift.Generator-352"><span class="linenos">352</span></a> <span class="s2">"type"</span><span class="p">,</span> +</span><span id="Redshift.Generator-353"><a href="#Redshift.Generator-353"><span class="linenos">353</span></a> <span class="s2">"union"</span><span class="p">,</span> +</span><span id="Redshift.Generator-354"><a href="#Redshift.Generator-354"><span class="linenos">354</span></a> <span class="s2">"unique"</span><span class="p">,</span> +</span><span id="Redshift.Generator-355"><a href="#Redshift.Generator-355"><span class="linenos">355</span></a> <span class="s2">"unnest"</span><span class="p">,</span> +</span><span id="Redshift.Generator-356"><a href="#Redshift.Generator-356"><span class="linenos">356</span></a> <span class="s2">"unpivot"</span><span class="p">,</span> +</span><span id="Redshift.Generator-357"><a href="#Redshift.Generator-357"><span class="linenos">357</span></a> <span class="s2">"user"</span><span class="p">,</span> +</span><span id="Redshift.Generator-358"><a href="#Redshift.Generator-358"><span class="linenos">358</span></a> <span class="s2">"using"</span><span class="p">,</span> +</span><span id="Redshift.Generator-359"><a href="#Redshift.Generator-359"><span class="linenos">359</span></a> <span class="s2">"verbose"</span><span class="p">,</span> +</span><span id="Redshift.Generator-360"><a href="#Redshift.Generator-360"><span class="linenos">360</span></a> <span class="s2">"wallet"</span><span class="p">,</span> +</span><span id="Redshift.Generator-361"><a href="#Redshift.Generator-361"><span class="linenos">361</span></a> <span class="s2">"when"</span><span class="p">,</span> +</span><span id="Redshift.Generator-362"><a href="#Redshift.Generator-362"><span class="linenos">362</span></a> <span class="s2">"where"</span><span class="p">,</span> +</span><span id="Redshift.Generator-363"><a href="#Redshift.Generator-363"><span class="linenos">363</span></a> <span class="s2">"with"</span><span class="p">,</span> +</span><span id="Redshift.Generator-364"><a href="#Redshift.Generator-364"><span class="linenos">364</span></a> <span class="s2">"without"</span><span class="p">,</span> +</span><span id="Redshift.Generator-365"><a href="#Redshift.Generator-365"><span class="linenos">365</span></a> <span class="p">}</span> +</span><span id="Redshift.Generator-366"><a href="#Redshift.Generator-366"><span class="linenos">366</span></a> +</span><span id="Redshift.Generator-367"><a href="#Redshift.Generator-367"><span class="linenos">367</span></a> <span class="k">def</span> <span class="nf">unnest_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">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator-368"><a href="#Redshift.Generator-368"><span class="linenos">368</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Redshift.Generator-369"><a href="#Redshift.Generator-369"><span class="linenos">369</span></a> <span class="n">num_args</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="Redshift.Generator-370"><a href="#Redshift.Generator-370"><span class="linenos">370</span></a> +</span><span id="Redshift.Generator-371"><a href="#Redshift.Generator-371"><span class="linenos">371</span></a> <span class="k">if</span> <span class="n">num_args</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Redshift.Generator-372"><a href="#Redshift.Generator-372"><span class="linenos">372</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported number of arguments in UNNEST: </span><span class="si">{</span><span class="n">num_args</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Redshift.Generator-373"><a href="#Redshift.Generator-373"><span class="linenos">373</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Redshift.Generator-374"><a href="#Redshift.Generator-374"><span class="linenos">374</span></a> +</span><span id="Redshift.Generator-375"><a href="#Redshift.Generator-375"><span class="linenos">375</span></a> <span class="n">arg</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">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> +</span><span id="Redshift.Generator-376"><a href="#Redshift.Generator-376"><span class="linenos">376</span></a> <span class="n">alias</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="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</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="Redshift.Generator-377"><a href="#Redshift.Generator-377"><span class="linenos">377</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">arg</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">arg</span> +</span><span id="Redshift.Generator-378"><a href="#Redshift.Generator-378"><span class="linenos">378</span></a> +</span><span id="Redshift.Generator-379"><a href="#Redshift.Generator-379"><span class="linenos">379</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator-380"><a href="#Redshift.Generator-380"><span class="linenos">380</span></a><span class="w"> </span><span class="sd">"""Redshift doesn't have `WITH` as part of their with_properties so we remove it"""</span> +</span><span id="Redshift.Generator-381"><a href="#Redshift.Generator-381"><span class="linenos">381</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> +</span><span id="Redshift.Generator-382"><a href="#Redshift.Generator-382"><span class="linenos">382</span></a> +</span><span id="Redshift.Generator-383"><a href="#Redshift.Generator-383"><span class="linenos">383</span></a> <span class="k">def</span> <span class="nf">cast_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">Cast</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator-384"><a href="#Redshift.Generator-384"><span class="linenos">384</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</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">JSON</span><span class="p">):</span> +</span><span id="Redshift.Generator-385"><a href="#Redshift.Generator-385"><span class="linenos">385</span></a> <span class="c1"># Redshift doesn't support a JSON type, so casting to it is treated as a noop</span> +</span><span id="Redshift.Generator-386"><a href="#Redshift.Generator-386"><span class="linenos">386</span></a> <span class="k">return</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="Redshift.Generator-387"><a href="#Redshift.Generator-387"><span class="linenos">387</span></a> +</span><span id="Redshift.Generator-388"><a href="#Redshift.Generator-388"><span class="linenos">388</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="o">=</span><span class="n">safe_prefix</span><span class="p">)</span> +</span><span id="Redshift.Generator-389"><a href="#Redshift.Generator-389"><span class="linenos">389</span></a> +</span><span id="Redshift.Generator-390"><a href="#Redshift.Generator-390"><span class="linenos">390</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="Redshift.Generator-391"><a href="#Redshift.Generator-391"><span class="linenos">391</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Redshift.Generator-392"><a href="#Redshift.Generator-392"><span class="linenos">392</span></a><span class="sd"> Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean</span> +</span><span id="Redshift.Generator-393"><a href="#Redshift.Generator-393"><span class="linenos">393</span></a><span class="sd"> VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type</span> +</span><span id="Redshift.Generator-394"><a href="#Redshift.Generator-394"><span class="linenos">394</span></a><span class="sd"> without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert</span> +</span><span id="Redshift.Generator-395"><a href="#Redshift.Generator-395"><span class="linenos">395</span></a><span class="sd"> `TEXT` to `VARCHAR`.</span> +</span><span id="Redshift.Generator-396"><a href="#Redshift.Generator-396"><span class="linenos">396</span></a><span class="sd"> """</span> +</span><span id="Redshift.Generator-397"><a href="#Redshift.Generator-397"><span class="linenos">397</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">"text"</span><span class="p">):</span> +</span><span id="Redshift.Generator-398"><a href="#Redshift.Generator-398"><span class="linenos">398</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</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">VARCHAR</span><span class="p">)</span> +</span><span id="Redshift.Generator-399"><a href="#Redshift.Generator-399"><span class="linenos">399</span></a> <span class="n">precision</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">"expressions"</span><span class="p">)</span> </span><span id="Redshift.Generator-400"><a href="#Redshift.Generator-400"><span class="linenos">400</span></a> -</span><span id="Redshift.Generator-401"><a href="#Redshift.Generator-401"><span class="linenos">401</span></a> <span class="k">return</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="Redshift.Generator-401"><a href="#Redshift.Generator-401"><span class="linenos">401</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">precision</span><span class="p">:</span> +</span><span id="Redshift.Generator-402"><a href="#Redshift.Generator-402"><span class="linenos">402</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"MAX"</span><span class="p">))</span> +</span><span id="Redshift.Generator-403"><a href="#Redshift.Generator-403"><span class="linenos">403</span></a> +</span><span id="Redshift.Generator-404"><a href="#Redshift.Generator-404"><span class="linenos">404</span></a> <span class="k">return</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></pre></div> @@ -2261,6 +2292,18 @@ Default: True</li> </div> + <div id="Redshift.Generator.HEX_FUNC" class="classattr"> + <div class="attr variable"> + <span class="name">HEX_FUNC</span> = +<span class="default_value">'TO_HEX'</span> + + + </div> + <a class="headerlink" href="#Redshift.Generator.HEX_FUNC"></a> + + + + </div> <div id="Redshift.Generator.TYPE_MAPPING" class="classattr"> <div class="attr variable"> <span class="name">TYPE_MAPPING</span> = @@ -2278,7 +2321,7 @@ Default: True</li> <div class="attr variable"> <span class="name">TRANSFORMS</span> = <input id="Redshift.Generator.TRANSFORMS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> - <label class="view-value-button pdoc-button" for="Redshift.Generator.TRANSFORMS-view-value"></label><span class="default_value">{<class '<a href="../expressions.html#JSONPathKey">sqlglot.expressions.JSONPathKey</a>'>: <function json_path_key_only_name>, <class '<a href="../expressions.html#JSONPathRoot">sqlglot.expressions.JSONPathRoot</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#JSONPathSubscript">sqlglot.expressions.JSONPathSubscript</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#AutoRefreshProperty">sqlglot.expressions.AutoRefreshProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#BackupProperty">sqlglot.expressions.BackupProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CaseSpecificColumnConstraint">sqlglot.expressions.CaseSpecificColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CharacterSetColumnConstraint">sqlglot.expressions.CharacterSetColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CharacterSetProperty">sqlglot.expressions.CharacterSetProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ClusteredColumnConstraint">sqlglot.expressions.ClusteredColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CollateColumnConstraint">sqlglot.expressions.CollateColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CopyGrantsProperty">sqlglot.expressions.CopyGrantsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#DateFormatColumnConstraint">sqlglot.expressions.DateFormatColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#DefaultColumnConstraint">sqlglot.expressions.DefaultColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#EncodeColumnConstraint">sqlglot.expressions.EncodeColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#EphemeralColumnConstraint">sqlglot.expressions.EphemeralColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ExcludeColumnConstraint">sqlglot.expressions.ExcludeColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ExecuteAsProperty">sqlglot.expressions.ExecuteAsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ExternalProperty">sqlglot.expressions.ExternalProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#GlobalProperty">sqlglot.expressions.GlobalProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#HeapProperty">sqlglot.expressions.HeapProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#IcebergProperty">sqlglot.expressions.IcebergProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#InheritsProperty">sqlglot.expressions.InheritsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#InlineLengthColumnConstraint">sqlglot.expressions.InlineLengthColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#InputModelProperty">sqlglot.expressions.InputModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#IntervalSpan">sqlglot.expressions.IntervalSpan</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#JSONExtract">sqlglot.expressions.JSONExtract</a>'>: <function json_extract_segments.<locals>._json_extract_segments>, <class '<a href="../expressions.html#JSONExtractScalar">sqlglot.expressions.JSONExtractScalar</a>'>: <function json_extract_segments.<locals>._json_extract_segments>, <class '<a href="../expressions.html#LanguageProperty">sqlglot.expressions.LanguageProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#LocationProperty">sqlglot.expressions.LocationProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#LogProperty">sqlglot.expressions.LogProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#MaterializedProperty">sqlglot.expressions.MaterializedProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#NonClusteredColumnConstraint">sqlglot.expressions.NonClusteredColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#NoPrimaryIndexProperty">sqlglot.expressions.NoPrimaryIndexProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#NotForReplicationColumnConstraint">sqlglot.expressions.NotForReplicationColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OnCommitProperty">sqlglot.expressions.OnCommitProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OnProperty">sqlglot.expressions.OnProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OnUpdateColumnConstraint">sqlglot.expressions.OnUpdateColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OutputModelProperty">sqlglot.expressions.OutputModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#PathColumnConstraint">sqlglot.expressions.PathColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#RemoteWithConnectionModelProperty">sqlglot.expressions.RemoteWithConnectionModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ReturnsProperty">sqlglot.expressions.ReturnsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SampleProperty">sqlglot.expressions.SampleProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SetConfigProperty">sqlglot.expressions.SetConfigProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SetProperty">sqlglot.expressions.SetProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SettingsProperty">sqlglot.expressions.SettingsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SharingProperty">sqlglot.expressions.SharingProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SqlReadWriteProperty">sqlglot.expressions.SqlReadWriteProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SqlSecurityProperty">sqlglot.expressions.SqlSecurityProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#StabilityProperty">sqlglot.expressions.StabilityProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TemporaryProperty">sqlglot.expressions.TemporaryProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TitleColumnConstraint">sqlglot.expressions.TitleColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#Timestamp">sqlglot.expressions.Timestamp</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ToMap">sqlglot.expressions.ToMap</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ToTableProperty">sqlglot.expressions.ToTableProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TransformModelProperty">sqlglot.expressions.TransformModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TransientProperty">sqlglot.expressions.TransientProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#UppercaseColumnConstraint">sqlglot.expressions.UppercaseColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#UnloggedProperty">sqlglot.expressions.UnloggedProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#VarMap">sqlglot.expressions.VarMap</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ViewAttributeProperty">sqlglot.expressions.ViewAttributeProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#VolatileProperty">sqlglot.expressions.VolatileProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#WithJournalTableProperty">sqlglot.expressions.WithJournalTableProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#WithOperator">sqlglot.expressions.WithOperator</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#Array">sqlglot.expressions.Array</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ArrayConcat">sqlglot.expressions.ArrayConcat</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ArrayContained">sqlglot.expressions.ArrayContained</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ArrayContains">sqlglot.expressions.ArrayContains</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ArrayOverlaps">sqlglot.expressions.ArrayOverlaps</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ArrayFilter">sqlglot.expressions.ArrayFilter</a>'>: <function filter_array_using_unnest>, <class '<a href="../expressions.html#ArraySize">sqlglot.expressions.ArraySize</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#BitwiseXor">sqlglot.expressions.BitwiseXor</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ColumnDef">sqlglot.expressions.ColumnDef</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#CurrentDate">sqlglot.expressions.CurrentDate</a>'>: <function no_paren_current_date_sql>, <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#CurrentUser">sqlglot.expressions.CurrentUser</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#DateAdd">sqlglot.expressions.DateAdd</a>'>: <function date_delta_sql.<locals>._delta_sql>, <class '<a href="../expressions.html#DateDiff">sqlglot.expressions.DateDiff</a>'>: <function date_delta_sql.<locals>._delta_sql>, <class '<a href="../expressions.html#DateStrToDate">sqlglot.expressions.DateStrToDate</a>'>: <function datestrtodate_sql>, <class '<a href="../expressions.html#DataType">sqlglot.expressions.DataType</a>'>: <function _datatype_sql>, <class '<a href="../expressions.html#DateSub">sqlglot.expressions.DateSub</a>'>: <function _date_add_sql.<locals>.func>, <class '<a href="../expressions.html#Explode">sqlglot.expressions.Explode</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#GroupConcat">sqlglot.expressions.GroupConcat</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#JSONBExtract">sqlglot.expressions.JSONBExtract</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#JSONBExtractScalar">sqlglot.expressions.JSONBExtractScalar</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#JSONBContains">sqlglot.expressions.JSONBContains</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ParseJSON">sqlglot.expressions.ParseJSON</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#Max">sqlglot.expressions.Max</a>'>: <function max_or_greatest>, <class '<a href="../expressions.html#MapFromEntries">sqlglot.expressions.MapFromEntries</a>'>: <function no_map_from_entries_sql>, <class '<a href="../expressions.html#Min">sqlglot.expressions.Min</a>'>: <function min_or_least>, <class '<a href="../expressions.html#Merge">sqlglot.expressions.Merge</a>'>: <function merge_without_target_sql>, <class '<a href="../expressions.html#PartitionedByProperty">sqlglot.expressions.PartitionedByProperty</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#PercentileCont">sqlglot.expressions.PercentileCont</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#PercentileDisc">sqlglot.expressions.PercentileDisc</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#Rand">sqlglot.expressions.Rand</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#RegexpLike">sqlglot.expressions.RegexpLike</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#RegexpILike">sqlglot.expressions.RegexpILike</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#Select">sqlglot.expressions.Select</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#StrPosition">sqlglot.expressions.StrPosition</a>'>: <function str_position_sql>, <class '<a href="../expressions.html#StrToDate">sqlglot.expressions.StrToDate</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#StrToTime">sqlglot.expressions.StrToTime</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#StructExtract">sqlglot.expressions.StructExtract</a>'>: <function struct_extract_sql>, <class '<a href="../expressions.html#Substring">sqlglot.expressions.Substring</a>'>: <function _substring_sql>, <class '<a href="../expressions.html#TimeFromParts">sqlglot.expressions.TimeFromParts</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#TimestampFromParts">sqlglot.expressions.TimestampFromParts</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#TimestampTrunc">sqlglot.expressions.TimestampTrunc</a>'>: <function timestamptrunc_sql>, <class '<a href="../expressions.html#TimeStrToTime">sqlglot.expressions.TimeStrToTime</a>'>: <function timestrtotime_sql>, <class '<a href="../expressions.html#TimeToStr">sqlglot.expressions.TimeToStr</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ToChar">sqlglot.expressions.ToChar</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#Trim">sqlglot.expressions.Trim</a>'>: <function trim_sql>, <class '<a href="../expressions.html#TryCast">sqlglot.expressions.TryCast</a>'>: <function no_trycast_sql>, <class '<a href="../expressions.html#TsOrDsAdd">sqlglot.expressions.TsOrDsAdd</a>'>: <function date_delta_sql.<locals>._delta_sql>, <class '<a href="../expressions.html#TsOrDsDiff">sqlglot.expressions.TsOrDsDiff</a>'>: <function date_delta_sql.<locals>._delta_sql>, <class '<a href="../expressions.html#UnixToTime">sqlglot.expressions.UnixToTime</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#TimeToUnix">sqlglot.expressions.TimeToUnix</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#VariancePop">sqlglot.expressions.VariancePop</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#Xor">sqlglot.expressions.Xor</a>'>: <function bool_xor_sql>, <class '<a href="../expressions.html#Concat">sqlglot.expressions.Concat</a>'>: <function concat_to_dpipe_sql>, <class '<a href="../expressions.html#ConcatWs">sqlglot.expressions.ConcatWs</a>'>: <function concat_ws_to_dpipe_sql>, <class '<a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#DistKeyProperty">sqlglot.expressions.DistKeyProperty</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#DistStyleProperty">sqlglot.expressions.DistStyleProperty</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#FromBase">sqlglot.expressions.FromBase</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#GeneratedAsIdentityColumnConstraint">sqlglot.expressions.GeneratedAsIdentityColumnConstraint</a>'>: <function generatedasidentitycolumnconstraint_sql>, <class '<a href="../expressions.html#SortKeyProperty">sqlglot.expressions.SortKeyProperty</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#StartsWith">sqlglot.expressions.StartsWith</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#TableSample">sqlglot.expressions.TableSample</a>'>: <function no_tablesample_sql>}</span> + <label class="view-value-button pdoc-button" for="Redshift.Generator.TRANSFORMS-view-value"></label><span class="default_value">{<class '<a href="../expressions.html#JSONPathKey">sqlglot.expressions.JSONPathKey</a>'>: <function json_path_key_only_name>, <class '<a href="../expressions.html#JSONPathRoot">sqlglot.expressions.JSONPathRoot</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#JSONPathSubscript">sqlglot.expressions.JSONPathSubscript</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#AllowedValuesProperty">sqlglot.expressions.AllowedValuesProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#AutoRefreshProperty">sqlglot.expressions.AutoRefreshProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#BackupProperty">sqlglot.expressions.BackupProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CaseSpecificColumnConstraint">sqlglot.expressions.CaseSpecificColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CharacterSetColumnConstraint">sqlglot.expressions.CharacterSetColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CharacterSetProperty">sqlglot.expressions.CharacterSetProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ClusteredColumnConstraint">sqlglot.expressions.ClusteredColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CollateColumnConstraint">sqlglot.expressions.CollateColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#CopyGrantsProperty">sqlglot.expressions.CopyGrantsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#DateFormatColumnConstraint">sqlglot.expressions.DateFormatColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#DefaultColumnConstraint">sqlglot.expressions.DefaultColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#EncodeColumnConstraint">sqlglot.expressions.EncodeColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#EphemeralColumnConstraint">sqlglot.expressions.EphemeralColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ExcludeColumnConstraint">sqlglot.expressions.ExcludeColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ExecuteAsProperty">sqlglot.expressions.ExecuteAsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ExternalProperty">sqlglot.expressions.ExternalProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#GlobalProperty">sqlglot.expressions.GlobalProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#HeapProperty">sqlglot.expressions.HeapProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#IcebergProperty">sqlglot.expressions.IcebergProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#InheritsProperty">sqlglot.expressions.InheritsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#InlineLengthColumnConstraint">sqlglot.expressions.InlineLengthColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#InputModelProperty">sqlglot.expressions.InputModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#IntervalSpan">sqlglot.expressions.IntervalSpan</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#JSONExtract">sqlglot.expressions.JSONExtract</a>'>: <function json_extract_segments.<locals>._json_extract_segments>, <class '<a href="../expressions.html#JSONExtractScalar">sqlglot.expressions.JSONExtractScalar</a>'>: <function json_extract_segments.<locals>._json_extract_segments>, <class '<a href="../expressions.html#LanguageProperty">sqlglot.expressions.LanguageProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#LocationProperty">sqlglot.expressions.LocationProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#LogProperty">sqlglot.expressions.LogProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#MaterializedProperty">sqlglot.expressions.MaterializedProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#NonClusteredColumnConstraint">sqlglot.expressions.NonClusteredColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#NoPrimaryIndexProperty">sqlglot.expressions.NoPrimaryIndexProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#NotForReplicationColumnConstraint">sqlglot.expressions.NotForReplicationColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OnCommitProperty">sqlglot.expressions.OnCommitProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OnProperty">sqlglot.expressions.OnProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OnUpdateColumnConstraint">sqlglot.expressions.OnUpdateColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#OutputModelProperty">sqlglot.expressions.OutputModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#PathColumnConstraint">sqlglot.expressions.PathColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#RemoteWithConnectionModelProperty">sqlglot.expressions.RemoteWithConnectionModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ReturnsProperty">sqlglot.expressions.ReturnsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SampleProperty">sqlglot.expressions.SampleProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SetConfigProperty">sqlglot.expressions.SetConfigProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SetProperty">sqlglot.expressions.SetProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SettingsProperty">sqlglot.expressions.SettingsProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SharingProperty">sqlglot.expressions.SharingProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SqlReadWriteProperty">sqlglot.expressions.SqlReadWriteProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#SqlSecurityProperty">sqlglot.expressions.SqlSecurityProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#StabilityProperty">sqlglot.expressions.StabilityProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TemporaryProperty">sqlglot.expressions.TemporaryProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TitleColumnConstraint">sqlglot.expressions.TitleColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#Timestamp">sqlglot.expressions.Timestamp</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ToMap">sqlglot.expressions.ToMap</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ToTableProperty">sqlglot.expressions.ToTableProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TransformModelProperty">sqlglot.expressions.TransformModelProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#TransientProperty">sqlglot.expressions.TransientProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#UppercaseColumnConstraint">sqlglot.expressions.UppercaseColumnConstraint</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#UnloggedProperty">sqlglot.expressions.UnloggedProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#VarMap">sqlglot.expressions.VarMap</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#ViewAttributeProperty">sqlglot.expressions.ViewAttributeProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#VolatileProperty">sqlglot.expressions.VolatileProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#WithJournalTableProperty">sqlglot.expressions.WithJournalTableProperty</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#WithOperator">sqlglot.expressions.WithOperator</a>'>: <function Generator.<lambda>>, <class '<a href="../expressions.html#Array">sqlglot.expressions.Array</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ArrayConcat">sqlglot.expressions.ArrayConcat</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#ArrayContained">sqlglot.expressions.ArrayContained</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ArrayContains">sqlglot.expressions.ArrayContains</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ArrayOverlaps">sqlglot.expressions.ArrayOverlaps</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ArrayFilter">sqlglot.expressions.ArrayFilter</a>'>: <function filter_array_using_unnest>, <class '<a href="../expressions.html#ArraySize">sqlglot.expressions.ArraySize</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#BitwiseXor">sqlglot.expressions.BitwiseXor</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ColumnDef">sqlglot.expressions.ColumnDef</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#CurrentDate">sqlglot.expressions.CurrentDate</a>'>: <function no_paren_current_date_sql>, <class '<a href="../expressions.html#CurrentTimestamp">sqlglot.expressions.CurrentTimestamp</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#CurrentUser">sqlglot.expressions.CurrentUser</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#DateAdd">sqlglot.expressions.DateAdd</a>'>: <function date_delta_sql.<locals>._delta_sql>, <class '<a href="../expressions.html#DateDiff">sqlglot.expressions.DateDiff</a>'>: <function date_delta_sql.<locals>._delta_sql>, <class '<a href="../expressions.html#DateStrToDate">sqlglot.expressions.DateStrToDate</a>'>: <function datestrtodate_sql>, <class '<a href="../expressions.html#DataType">sqlglot.expressions.DataType</a>'>: <function _datatype_sql>, <class '<a href="../expressions.html#DateSub">sqlglot.expressions.DateSub</a>'>: <function _date_add_sql.<locals>.func>, <class '<a href="../expressions.html#Explode">sqlglot.expressions.Explode</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#GroupConcat">sqlglot.expressions.GroupConcat</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#JSONBExtract">sqlglot.expressions.JSONBExtract</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#JSONBExtractScalar">sqlglot.expressions.JSONBExtractScalar</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#JSONBContains">sqlglot.expressions.JSONBContains</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ParseJSON">sqlglot.expressions.ParseJSON</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#LogicalOr">sqlglot.expressions.LogicalOr</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#LogicalAnd">sqlglot.expressions.LogicalAnd</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#Max">sqlglot.expressions.Max</a>'>: <function max_or_greatest>, <class '<a href="../expressions.html#MapFromEntries">sqlglot.expressions.MapFromEntries</a>'>: <function no_map_from_entries_sql>, <class '<a href="../expressions.html#Min">sqlglot.expressions.Min</a>'>: <function min_or_least>, <class '<a href="../expressions.html#Merge">sqlglot.expressions.Merge</a>'>: <function merge_without_target_sql>, <class '<a href="../expressions.html#PartitionedByProperty">sqlglot.expressions.PartitionedByProperty</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#PercentileCont">sqlglot.expressions.PercentileCont</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#PercentileDisc">sqlglot.expressions.PercentileDisc</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#Rand">sqlglot.expressions.Rand</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#RegexpLike">sqlglot.expressions.RegexpLike</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#RegexpILike">sqlglot.expressions.RegexpILike</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#Select">sqlglot.expressions.Select</a>'>: <function preprocess.<locals>._to_sql>, <class '<a href="../expressions.html#StrPosition">sqlglot.expressions.StrPosition</a>'>: <function str_position_sql>, <class '<a href="../expressions.html#StrToDate">sqlglot.expressions.StrToDate</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#StrToTime">sqlglot.expressions.StrToTime</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#StructExtract">sqlglot.expressions.StructExtract</a>'>: <function struct_extract_sql>, <class '<a href="../expressions.html#Substring">sqlglot.expressions.Substring</a>'>: <function _substring_sql>, <class '<a href="../expressions.html#TimeFromParts">sqlglot.expressions.TimeFromParts</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#TimestampFromParts">sqlglot.expressions.TimestampFromParts</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#TimestampTrunc">sqlglot.expressions.TimestampTrunc</a>'>: <function timestamptrunc_sql.<locals>._timestamptrunc_sql>, <class '<a href="../expressions.html#TimeStrToTime">sqlglot.expressions.TimeStrToTime</a>'>: <function timestrtotime_sql>, <class '<a href="../expressions.html#TimeToStr">sqlglot.expressions.TimeToStr</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#ToChar">sqlglot.expressions.ToChar</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#Trim">sqlglot.expressions.Trim</a>'>: <function trim_sql>, <class '<a href="../expressions.html#TryCast">sqlglot.expressions.TryCast</a>'>: <function no_trycast_sql>, <class '<a href="../expressions.html#TsOrDsAdd">sqlglot.expressions.TsOrDsAdd</a>'>: <function date_delta_sql.<locals>._delta_sql>, <class '<a href="../expressions.html#TsOrDsDiff">sqlglot.expressions.TsOrDsDiff</a>'>: <function date_delta_sql.<locals>._delta_sql>, <class '<a href="../expressions.html#UnixToTime">sqlglot.expressions.UnixToTime</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#TimeToUnix">sqlglot.expressions.TimeToUnix</a>'>: <function Postgres.Generator.<lambda>>, <class '<a href="../expressions.html#VariancePop">sqlglot.expressions.VariancePop</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#Variance">sqlglot.expressions.Variance</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#Xor">sqlglot.expressions.Xor</a>'>: <function bool_xor_sql>, <class '<a href="../expressions.html#Concat">sqlglot.expressions.Concat</a>'>: <function concat_to_dpipe_sql>, <class '<a href="../expressions.html#ConcatWs">sqlglot.expressions.ConcatWs</a>'>: <function concat_ws_to_dpipe_sql>, <class '<a href="../expressions.html#ApproxDistinct">sqlglot.expressions.ApproxDistinct</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#DistKeyProperty">sqlglot.expressions.DistKeyProperty</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#DistStyleProperty">sqlglot.expressions.DistStyleProperty</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#FromBase">sqlglot.expressions.FromBase</a>'>: <function rename_func.<locals>.<lambda>>, <class '<a href="../expressions.html#GeneratedAsIdentityColumnConstraint">sqlglot.expressions.GeneratedAsIdentityColumnConstraint</a>'>: <function generatedasidentitycolumnconstraint_sql>, <class '<a href="../expressions.html#Hex">sqlglot.expressions.Hex</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#SortKeyProperty">sqlglot.expressions.SortKeyProperty</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#StartsWith">sqlglot.expressions.StartsWith</a>'>: <function <a href="#Redshift.Generator">Redshift.Generator</a>.<lambda>>, <class '<a href="../expressions.html#TableSample">sqlglot.expressions.TableSample</a>'>: <function no_tablesample_sql>}</span> </div> @@ -2291,7 +2334,7 @@ Default: True</li> <div class="attr variable"> <span class="name">RESERVED_KEYWORDS</span> = <input id="Redshift.Generator.RESERVED_KEYWORDS-view-value" class="view-value-toggle-state" type="checkbox" aria-hidden="true" tabindex="-1"> - <label class="view-value-button pdoc-button" for="Redshift.Generator.RESERVED_KEYWORDS-view-value"></label><span class="default_value">{'open', 'false', 'explicit', 'between', 'raw', 'all', 'encrypt ', 'collate', 'tdes', 'natural', 'else', 'limit', 'gzip', 'globaldict64k', 'mostly8', 'bzip2', 'emptyasnull', 'when', 'inner', 'intersect', 'partition', 'delta32k', 'current_time', 'ignore', 'backup', 'recover', 'wallet', 'with', 'analyse', 'encryption', 'asc', 'system', 'similar', 'cross', 'minus', 'current_user_id', 'old', 'percent', 'session_user', 'localtime', 'current_user', 'then', 'enable', 'mostly16', 'to', 'true', 'interval', 'freeze', 'deflate', 'foreign', 'bytedict', 'user', 'aes128', 'where', 'permissions', 'case', 'luns', 'text32k', 'leading', 'table', 'truncatecolumns', 'trailing', 'verbose', 'from', 'left', 'only', 'check', 'do', 'desc', 'credentials', 'readratio', 'current_timestamp', 'as', 'unnest', 'primary', 'offset', 'initially', 'authorization', 'text255', 'respect', 'both', 'default', 'constraint', 'right', 'without', 'except', 'az64', 'delta', 'offline', 'allowoverwrite', 'for', 'off', 'in', 'aes256', 'oid', 'column', 'defrag', 'on', 'is', 'placing', 'type', 'top', 'analyze', 'full', 'globaldict256', 'blanksasnull', 'join', 'create', 'timestamp', 'restore', 'unpivot', 'any', 'sysdate', 'into', 'notnull', 'null', 'group', 'encode', 'end', 'references', 'distinct', 'select', 'binary', 'cast', 'localtimestamp', 'unique', 'union', 'array', 'lun', 'or', 'not', 'lzo', 'snapshot', 'having', 'order', 'disable', 'some', 'and', 'grant', 'resort', 'overlaps', 'lzop', 'mostly32', 'deferrable', 'pivot', 'outer', 'rejectlog', 'ilike', 'isnull', 'parallel', 'identity', 'using', 'like', 'current_date', 'new', 'tag', 'nulls'}</span> + <label class="view-value-button pdoc-button" for="Redshift.Generator.RESERVED_KEYWORDS-view-value"></label><span class="default_value">{'localtime', 'else', 'offset', 'without', 'like', 'group', 'type', 'intersect', 'verbose', 'end', 'from', 'isnull', 'case', 'deflate', 'old', 'all', 'cast', 'default', 'defrag', 'emptyasnull', 'overlaps', 'similar', 'union', 'in', 'az64', 'globaldict64k', 'binary', 'mostly32', 'wallet', 'current_date', 'minus', 'natural', 'system', 'top', 'unpivot', 'current_time', 'left', 'between', 'with', 'array', 'order', 'leading', 'and', 'for', 'rejectlog', 'sysdate', 'distinct', 'select', 'current_user', 'when', 'permissions', 'identity', 'except', 'new', 'into', 'any', 'current_timestamp', 'is', 'on', 'analyse', 'inner', 'null', 'join', 'full', 'lun', 'desc', 'do', 'delta', 'bytedict', 'freeze', 'resort', 'constraint', 'interval', 'text32k', 'foreign', 'using', 'table', 'recover', 'both', 'percent', 'tdes', 'collate', 'respect', 'initially', 'encode', 'session_user', 'right', 'some', 'localtimestamp', 'analyze', 'deferrable', 'encrypt ', 'create', 'gzip', 'lzop', 'tag', 'check', 'parallel', 'placing', 'encryption', 'backup', 'then', 'cross', 'credentials', 'primary', 'partition', 'where', 'notnull', 'pivot', 'limit', 'or', 'authorization', 'unique', 'off', 'false', 'enable', 'ignore', 'lzo', 'restore', 'references', 'text255', 'allowoverwrite', 'unnest', 'outer', 'aes256', 'blanksasnull', 'raw', 'trailing', 'only', 'readratio', 'truncatecolumns', 'nulls', 'user', 'snapshot', 'timestamp', 'to', 'grant', 'asc', 'explicit', 'having', 'not', 'ilike', 'column', 'delta32k', 'offline', 'as', 'globaldict256', 'aes128', 'mostly16', 'true', 'oid', 'open', 'mostly8', 'current_user_id', 'disable', 'luns', 'bzip2'}</span> </div> @@ -2311,17 +2354,17 @@ Default: True</li> </div> <a class="headerlink" href="#Redshift.Generator.unnest_sql"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator.unnest_sql-364"><a href="#Redshift.Generator.unnest_sql-364"><span class="linenos">364</span></a> <span class="k">def</span> <span class="nf">unnest_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">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Redshift.Generator.unnest_sql-365"><a href="#Redshift.Generator.unnest_sql-365"><span class="linenos">365</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> -</span><span id="Redshift.Generator.unnest_sql-366"><a href="#Redshift.Generator.unnest_sql-366"><span class="linenos">366</span></a> <span class="n">num_args</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> -</span><span id="Redshift.Generator.unnest_sql-367"><a href="#Redshift.Generator.unnest_sql-367"><span class="linenos">367</span></a> -</span><span id="Redshift.Generator.unnest_sql-368"><a href="#Redshift.Generator.unnest_sql-368"><span class="linenos">368</span></a> <span class="k">if</span> <span class="n">num_args</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> -</span><span id="Redshift.Generator.unnest_sql-369"><a href="#Redshift.Generator.unnest_sql-369"><span class="linenos">369</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported number of arguments in UNNEST: </span><span class="si">{</span><span class="n">num_args</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> -</span><span id="Redshift.Generator.unnest_sql-370"><a href="#Redshift.Generator.unnest_sql-370"><span class="linenos">370</span></a> <span class="k">return</span> <span class="s2">""</span> -</span><span id="Redshift.Generator.unnest_sql-371"><a href="#Redshift.Generator.unnest_sql-371"><span class="linenos">371</span></a> -</span><span id="Redshift.Generator.unnest_sql-372"><a href="#Redshift.Generator.unnest_sql-372"><span class="linenos">372</span></a> <span class="n">arg</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">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> -</span><span id="Redshift.Generator.unnest_sql-373"><a href="#Redshift.Generator.unnest_sql-373"><span class="linenos">373</span></a> <span class="n">alias</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="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</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="Redshift.Generator.unnest_sql-374"><a href="#Redshift.Generator.unnest_sql-374"><span class="linenos">374</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">arg</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">arg</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator.unnest_sql-367"><a href="#Redshift.Generator.unnest_sql-367"><span class="linenos">367</span></a> <span class="k">def</span> <span class="nf">unnest_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">Unnest</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator.unnest_sql-368"><a href="#Redshift.Generator.unnest_sql-368"><span class="linenos">368</span></a> <span class="n">args</span> <span class="o">=</span> <span class="n">expression</span><span class="o">.</span><span class="n">expressions</span> +</span><span id="Redshift.Generator.unnest_sql-369"><a href="#Redshift.Generator.unnest_sql-369"><span class="linenos">369</span></a> <span class="n">num_args</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> +</span><span id="Redshift.Generator.unnest_sql-370"><a href="#Redshift.Generator.unnest_sql-370"><span class="linenos">370</span></a> +</span><span id="Redshift.Generator.unnest_sql-371"><a href="#Redshift.Generator.unnest_sql-371"><span class="linenos">371</span></a> <span class="k">if</span> <span class="n">num_args</span> <span class="o">></span> <span class="mi">1</span><span class="p">:</span> +</span><span id="Redshift.Generator.unnest_sql-372"><a href="#Redshift.Generator.unnest_sql-372"><span class="linenos">372</span></a> <span class="bp">self</span><span class="o">.</span><span class="n">unsupported</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Unsupported number of arguments in UNNEST: </span><span class="si">{</span><span class="n">num_args</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span> +</span><span id="Redshift.Generator.unnest_sql-373"><a href="#Redshift.Generator.unnest_sql-373"><span class="linenos">373</span></a> <span class="k">return</span> <span class="s2">""</span> +</span><span id="Redshift.Generator.unnest_sql-374"><a href="#Redshift.Generator.unnest_sql-374"><span class="linenos">374</span></a> +</span><span id="Redshift.Generator.unnest_sql-375"><a href="#Redshift.Generator.unnest_sql-375"><span class="linenos">375</span></a> <span class="n">arg</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">seq_get</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> +</span><span id="Redshift.Generator.unnest_sql-376"><a href="#Redshift.Generator.unnest_sql-376"><span class="linenos">376</span></a> <span class="n">alias</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="o">.</span><span class="n">args</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"alias"</span><span class="p">),</span> <span class="n">key</span><span class="o">=</span><span class="s2">"columns"</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="Redshift.Generator.unnest_sql-377"><a href="#Redshift.Generator.unnest_sql-377"><span class="linenos">377</span></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">"</span><span class="si">{</span><span class="n">arg</span><span class="si">}</span><span class="s2"> AS </span><span class="si">{</span><span class="n">alias</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="n">alias</span> <span class="k">else</span> <span class="n">arg</span> </span></pre></div> @@ -2339,9 +2382,9 @@ Default: True</li> </div> <a class="headerlink" href="#Redshift.Generator.with_properties"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator.with_properties-376"><a href="#Redshift.Generator.with_properties-376"><span class="linenos">376</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Redshift.Generator.with_properties-377"><a href="#Redshift.Generator.with_properties-377"><span class="linenos">377</span></a><span class="w"> </span><span class="sd">"""Redshift doesn't have `WITH` as part of their with_properties so we remove it"""</span> -</span><span id="Redshift.Generator.with_properties-378"><a href="#Redshift.Generator.with_properties-378"><span class="linenos">378</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator.with_properties-379"><a href="#Redshift.Generator.with_properties-379"><span class="linenos">379</span></a> <span class="k">def</span> <span class="nf">with_properties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">properties</span><span class="p">:</span> <span class="n">exp</span><span class="o">.</span><span class="n">Properties</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator.with_properties-380"><a href="#Redshift.Generator.with_properties-380"><span class="linenos">380</span></a><span class="w"> </span><span class="sd">"""Redshift doesn't have `WITH` as part of their with_properties so we remove it"""</span> +</span><span id="Redshift.Generator.with_properties-381"><a href="#Redshift.Generator.with_properties-381"><span class="linenos">381</span></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">properties</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">" "</span><span class="p">,</span> <span class="n">suffix</span><span class="o">=</span><span class="s2">""</span><span class="p">)</span> </span></pre></div> @@ -2361,12 +2404,12 @@ Default: True</li> </div> <a class="headerlink" href="#Redshift.Generator.cast_sql"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator.cast_sql-380"><a href="#Redshift.Generator.cast_sql-380"><span class="linenos">380</span></a> <span class="k">def</span> <span class="nf">cast_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">Cast</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> -</span><span id="Redshift.Generator.cast_sql-381"><a href="#Redshift.Generator.cast_sql-381"><span class="linenos">381</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</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">JSON</span><span class="p">):</span> -</span><span id="Redshift.Generator.cast_sql-382"><a href="#Redshift.Generator.cast_sql-382"><span class="linenos">382</span></a> <span class="c1"># Redshift doesn't support a JSON type, so casting to it is treated as a noop</span> -</span><span id="Redshift.Generator.cast_sql-383"><a href="#Redshift.Generator.cast_sql-383"><span class="linenos">383</span></a> <span class="k">return</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="Redshift.Generator.cast_sql-384"><a href="#Redshift.Generator.cast_sql-384"><span class="linenos">384</span></a> -</span><span id="Redshift.Generator.cast_sql-385"><a href="#Redshift.Generator.cast_sql-385"><span class="linenos">385</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="o">=</span><span class="n">safe_prefix</span><span class="p">)</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator.cast_sql-383"><a href="#Redshift.Generator.cast_sql-383"><span class="linenos">383</span></a> <span class="k">def</span> <span class="nf">cast_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">Cast</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span> +</span><span id="Redshift.Generator.cast_sql-384"><a href="#Redshift.Generator.cast_sql-384"><span class="linenos">384</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</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">JSON</span><span class="p">):</span> +</span><span id="Redshift.Generator.cast_sql-385"><a href="#Redshift.Generator.cast_sql-385"><span class="linenos">385</span></a> <span class="c1"># Redshift doesn't support a JSON type, so casting to it is treated as a noop</span> +</span><span id="Redshift.Generator.cast_sql-386"><a href="#Redshift.Generator.cast_sql-386"><span class="linenos">386</span></a> <span class="k">return</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="Redshift.Generator.cast_sql-387"><a href="#Redshift.Generator.cast_sql-387"><span class="linenos">387</span></a> +</span><span id="Redshift.Generator.cast_sql-388"><a href="#Redshift.Generator.cast_sql-388"><span class="linenos">388</span></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">cast_sql</span><span class="p">(</span><span class="n">expression</span><span class="p">,</span> <span class="n">safe_prefix</span><span class="o">=</span><span class="n">safe_prefix</span><span class="p">)</span> </span></pre></div> @@ -2384,21 +2427,21 @@ Default: True</li> </div> <a class="headerlink" href="#Redshift.Generator.datatype_sql"></a> - <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator.datatype_sql-387"><a href="#Redshift.Generator.datatype_sql-387"><span class="linenos">387</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="Redshift.Generator.datatype_sql-388"><a href="#Redshift.Generator.datatype_sql-388"><span class="linenos">388</span></a><span class="w"> </span><span class="sd">"""</span> -</span><span id="Redshift.Generator.datatype_sql-389"><a href="#Redshift.Generator.datatype_sql-389"><span class="linenos">389</span></a><span class="sd"> Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean</span> -</span><span id="Redshift.Generator.datatype_sql-390"><a href="#Redshift.Generator.datatype_sql-390"><span class="linenos">390</span></a><span class="sd"> VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type</span> -</span><span id="Redshift.Generator.datatype_sql-391"><a href="#Redshift.Generator.datatype_sql-391"><span class="linenos">391</span></a><span class="sd"> without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert</span> -</span><span id="Redshift.Generator.datatype_sql-392"><a href="#Redshift.Generator.datatype_sql-392"><span class="linenos">392</span></a><span class="sd"> `TEXT` to `VARCHAR`.</span> -</span><span id="Redshift.Generator.datatype_sql-393"><a href="#Redshift.Generator.datatype_sql-393"><span class="linenos">393</span></a><span class="sd"> """</span> -</span><span id="Redshift.Generator.datatype_sql-394"><a href="#Redshift.Generator.datatype_sql-394"><span class="linenos">394</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">"text"</span><span class="p">):</span> -</span><span id="Redshift.Generator.datatype_sql-395"><a href="#Redshift.Generator.datatype_sql-395"><span class="linenos">395</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</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">VARCHAR</span><span class="p">)</span> -</span><span id="Redshift.Generator.datatype_sql-396"><a href="#Redshift.Generator.datatype_sql-396"><span class="linenos">396</span></a> <span class="n">precision</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">"expressions"</span><span class="p">)</span> -</span><span id="Redshift.Generator.datatype_sql-397"><a href="#Redshift.Generator.datatype_sql-397"><span class="linenos">397</span></a> -</span><span id="Redshift.Generator.datatype_sql-398"><a href="#Redshift.Generator.datatype_sql-398"><span class="linenos">398</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">precision</span><span class="p">:</span> -</span><span id="Redshift.Generator.datatype_sql-399"><a href="#Redshift.Generator.datatype_sql-399"><span class="linenos">399</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"MAX"</span><span class="p">))</span> + <div class="pdoc-code codehilite"><pre><span></span><span id="Redshift.Generator.datatype_sql-390"><a href="#Redshift.Generator.datatype_sql-390"><span class="linenos">390</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="Redshift.Generator.datatype_sql-391"><a href="#Redshift.Generator.datatype_sql-391"><span class="linenos">391</span></a><span class="w"> </span><span class="sd">"""</span> +</span><span id="Redshift.Generator.datatype_sql-392"><a href="#Redshift.Generator.datatype_sql-392"><span class="linenos">392</span></a><span class="sd"> Redshift converts the `TEXT` data type to `VARCHAR(255)` by default when people more generally mean</span> +</span><span id="Redshift.Generator.datatype_sql-393"><a href="#Redshift.Generator.datatype_sql-393"><span class="linenos">393</span></a><span class="sd"> VARCHAR of max length which is `VARCHAR(max)` in Redshift. Therefore if we get a `TEXT` data type</span> +</span><span id="Redshift.Generator.datatype_sql-394"><a href="#Redshift.Generator.datatype_sql-394"><span class="linenos">394</span></a><span class="sd"> without precision we convert it to `VARCHAR(max)` and if it does have precision then we just convert</span> +</span><span id="Redshift.Generator.datatype_sql-395"><a href="#Redshift.Generator.datatype_sql-395"><span class="linenos">395</span></a><span class="sd"> `TEXT` to `VARCHAR`.</span> +</span><span id="Redshift.Generator.datatype_sql-396"><a href="#Redshift.Generator.datatype_sql-396"><span class="linenos">396</span></a><span class="sd"> """</span> +</span><span id="Redshift.Generator.datatype_sql-397"><a href="#Redshift.Generator.datatype_sql-397"><span class="linenos">397</span></a> <span class="k">if</span> <span class="n">expression</span><span class="o">.</span><span class="n">is_type</span><span class="p">(</span><span class="s2">"text"</span><span class="p">):</span> +</span><span id="Redshift.Generator.datatype_sql-398"><a href="#Redshift.Generator.datatype_sql-398"><span class="linenos">398</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"this"</span><span class="p">,</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">VARCHAR</span><span class="p">)</span> +</span><span id="Redshift.Generator.datatype_sql-399"><a href="#Redshift.Generator.datatype_sql-399"><span class="linenos">399</span></a> <span class="n">precision</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">"expressions"</span><span class="p">)</span> </span><span id="Redshift.Generator.datatype_sql-400"><a href="#Redshift.Generator.datatype_sql-400"><span class="linenos">400</span></a> -</span><span id="Redshift.Generator.datatype_sql-401"><a href="#Redshift.Generator.datatype_sql-401"><span class="linenos">401</span></a> <span class="k">return</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="Redshift.Generator.datatype_sql-401"><a href="#Redshift.Generator.datatype_sql-401"><span class="linenos">401</span></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">precision</span><span class="p">:</span> +</span><span id="Redshift.Generator.datatype_sql-402"><a href="#Redshift.Generator.datatype_sql-402"><span class="linenos">402</span></a> <span class="n">expression</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">"expressions"</span><span class="p">,</span> <span class="n">exp</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="s2">"MAX"</span><span class="p">))</span> +</span><span id="Redshift.Generator.datatype_sql-403"><a href="#Redshift.Generator.datatype_sql-403"><span class="linenos">403</span></a> +</span><span id="Redshift.Generator.datatype_sql-404"><a href="#Redshift.Generator.datatype_sql-404"><span class="linenos">404</span></a> <span class="k">return</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></pre></div> @@ -2493,7 +2536,7 @@ without precision we convert it to <code>VARCHAR(max)</code> and if it does have <dd id="Redshift.Generator.SUPPORTS_TO_NUMBER" class="variable"><a href="../generator.html#Generator.SUPPORTS_TO_NUMBER">SUPPORTS_TO_NUMBER</a></dd> <dd id="Redshift.Generator.OUTER_UNION_MODIFIERS" class="variable"><a href="../generator.html#Generator.OUTER_UNION_MODIFIERS">OUTER_UNION_MODIFIERS</a></dd> <dd id="Redshift.Generator.COPY_PARAMS_EQ_REQUIRED" class="variable"><a href="../generator.html#Generator.COPY_PARAMS_EQ_REQUIRED">COPY_PARAMS_EQ_REQUIRED</a></dd> - <dd id="Redshift.Generator.STAR_MAPPING" class="variable"><a href="../generator.html#Generator.STAR_MAPPING">STAR_MAPPING</a></dd> + <dd id="Redshift.Generator.STAR_EXCEPT" class="variable"><a href="../generator.html#Generator.STAR_EXCEPT">STAR_EXCEPT</a></dd> <dd id="Redshift.Generator.TIME_PART_SINGULARS" class="variable"><a href="../generator.html#Generator.TIME_PART_SINGULARS">TIME_PART_SINGULARS</a></dd> <dd id="Redshift.Generator.TOKEN_MAPPING" class="variable"><a href="../generator.html#Generator.TOKEN_MAPPING">TOKEN_MAPPING</a></dd> <dd id="Redshift.Generator.STRUCT_DELIMITER" class="variable"><a href="../generator.html#Generator.STRUCT_DELIMITER">STRUCT_DELIMITER</a></dd> @@ -2573,6 +2616,8 @@ without precision we convert it to <code>VARCHAR(max)</code> and if it does have <dd id="Redshift.Generator.indexparameters_sql" class="function"><a href="../generator.html#Generator.indexparameters_sql">indexparameters_sql</a></dd> <dd id="Redshift.Generator.index_sql" class="function"><a href="../generator.html#Generator.index_sql">index_sql</a></dd> <dd id="Redshift.Generator.identifier_sql" class="function"><a href="../generator.html#Generator.identifier_sql">identifier_sql</a></dd> + <dd id="Redshift.Generator.hex_sql" class="function"><a href="../generator.html#Generator.hex_sql">hex_sql</a></dd> + <dd id="Redshift.Generator.lowerhex_sql" class="function"><a href="../generator.html#Generator.lowerhex_sql">lowerhex_sql</a></dd> <dd id="Redshift.Generator.inputoutputformat_sql" class="function"><a href="../generator.html#Generator.inputoutputformat_sql">inputoutputformat_sql</a></dd> <dd id="Redshift.Generator.national_sql" class="function"><a href="../generator.html#Generator.national_sql">national_sql</a></dd> <dd id="Redshift.Generator.partition_sql" class="function"><a href="../generator.html#Generator.partition_sql">partition_sql</a></dd> @@ -2736,6 +2781,8 @@ without precision we convert it to <code>VARCHAR(max)</code> and if it does have <dd id="Redshift.Generator.commit_sql" class="function"><a href="../generator.html#Generator.commit_sql">commit_sql</a></dd> <dd id="Redshift.Generator.rollback_sql" class="function"><a href="../generator.html#Generator.rollback_sql">rollback_sql</a></dd> <dd id="Redshift.Generator.altercolumn_sql" class="function"><a href="../generator.html#Generator.altercolumn_sql">altercolumn_sql</a></dd> + <dd id="Redshift.Generator.alterdiststyle_sql" class="function"><a href="../generator.html#Generator.alterdiststyle_sql">alterdiststyle_sql</a></dd> + <dd id="Redshift.Generator.altersortkey_sql" class="function"><a href="../generator.html#Generator.altersortkey_sql">altersortkey_sql</a></dd> <dd id="Redshift.Generator.renametable_sql" class="function"><a href="../generator.html#Generator.renametable_sql">renametable_sql</a></dd> <dd id="Redshift.Generator.renamecolumn_sql" class="function"><a href="../generator.html#Generator.renamecolumn_sql">renamecolumn_sql</a></dd> <dd id="Redshift.Generator.altertable_sql" class="function"><a href="../generator.html#Generator.altertable_sql">altertable_sql</a></dd> @@ -2829,6 +2876,7 @@ without precision we convert it to <code>VARCHAR(max)</code> and if it does have <dd id="Redshift.Generator.copyparameter_sql" class="function"><a href="../generator.html#Generator.copyparameter_sql">copyparameter_sql</a></dd> <dd id="Redshift.Generator.credentials_sql" class="function"><a href="../generator.html#Generator.credentials_sql">credentials_sql</a></dd> <dd id="Redshift.Generator.copy_sql" class="function"><a href="../generator.html#Generator.copy_sql">copy_sql</a></dd> + <dd id="Redshift.Generator.semicolon_sql" class="function"><a href="../generator.html#Generator.semicolon_sql">semicolon_sql</a></dd> </div> <div><dt><a href="postgres.html#Postgres.Generator">sqlglot.dialects.postgres.Postgres.Generator</a></dt> |