diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-22 18:53:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-22 18:53:31 +0000 |
commit | 20d090151fbc2e75394fc456f49f0078e59752d8 (patch) | |
tree | 084494962f092ff80f5ef8fdba1b917206abbc83 /docs/sqlglot/dataframe.html | |
parent | Adding upstream version 16.2.1. (diff) | |
download | sqlglot-20d090151fbc2e75394fc456f49f0078e59752d8.tar.xz sqlglot-20d090151fbc2e75394fc456f49f0078e59752d8.zip |
Adding upstream version 16.4.0.upstream/16.4.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/sqlglot/dataframe.html')
-rw-r--r-- | docs/sqlglot/dataframe.html | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/docs/sqlglot/dataframe.html b/docs/sqlglot/dataframe.html index d86d6ff..85028ca 100644 --- a/docs/sqlglot/dataframe.html +++ b/docs/sqlglot/dataframe.html @@ -72,7 +72,7 @@ <ul> <li><a href="https://github.com/tobymao/sqlglot/blob/main/README.md#install">Install SQLGlot</a> and that is all that is required to just generate SQL. <a href="#examples">The examples</a> show generating SQL and then executing that SQL on a specific engine and that will require that engine's client library.</li> <li>Find/replace all <code>from pyspark.sql</code> with <code>from <a href="">sqlglot.dataframe</a></code>.</li> -<li>Prior to any <code>spark.read.table</code> or <code>spark.table</code> run <code>sqlglot.schema.add_table('<table_name>', <column_structure>)</code>. +<li>Prior to any <code>spark.read.table</code> or <code>spark.table</code> run <code>sqlglot.schema.add_table('<table_name>', <column_structure>, dialect="spark")</code>. <ul> <li>The column structure can be defined the following ways: <ul> @@ -111,12 +111,16 @@ <span class="kn">from</span> <span class="nn">sqlglot.dataframe.sql.session</span> <span class="kn">import</span> <span class="n">SparkSession</span> <span class="kn">from</span> <span class="nn"><a href="dataframe/sql.html">sqlglot.dataframe.sql</a></span> <span class="kn">import</span> <span class="n">functions</span> <span class="k">as</span> <span class="n">F</span> -<span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">add_table</span><span class="p">(</span><span class="s1">'employee'</span><span class="p">,</span> <span class="p">{</span> - <span class="s1">'employee_id'</span><span class="p">:</span> <span class="s1">'INT'</span><span class="p">,</span> - <span class="s1">'fname'</span><span class="p">:</span> <span class="s1">'STRING'</span><span class="p">,</span> - <span class="s1">'lname'</span><span class="p">:</span> <span class="s1">'STRING'</span><span class="p">,</span> - <span class="s1">'age'</span><span class="p">:</span> <span class="s1">'INT'</span><span class="p">,</span> -<span class="p">})</span> <span class="c1"># Register the table structure prior to reading from the table</span> +<span class="n">sqlglot</span><span class="o">.</span><span class="n">schema</span><span class="o">.</span><span class="n">add_table</span><span class="p">(</span> + <span class="s1">'employee'</span><span class="p">,</span> + <span class="p">{</span> + <span class="s1">'employee_id'</span><span class="p">:</span> <span class="s1">'INT'</span><span class="p">,</span> + <span class="s1">'fname'</span><span class="p">:</span> <span class="s1">'STRING'</span><span class="p">,</span> + <span class="s1">'lname'</span><span class="p">:</span> <span class="s1">'STRING'</span><span class="p">,</span> + <span class="s1">'age'</span><span class="p">:</span> <span class="s1">'INT'</span><span class="p">,</span> + <span class="p">},</span> + <span class="n">dialect</span><span class="o">=</span><span class="s2">"spark"</span><span class="p">,</span> +<span class="p">)</span> <span class="c1"># Register the table structure prior to reading from the table</span> <span class="n">spark</span> <span class="o">=</span> <span class="n">SparkSession</span><span class="p">()</span> |