title: Using Azure Apache Spark pool to run sql query on Azure Synapse Analytics SQL Pool
body: <p>I have a Azure Synapse Analytics workspace with:</p>
  <ul>
  <li><code>sqlpool01</code>: 100 DWU SQL Pool</li>
  <li><code>cluster01</code>: Apache Spark Pool</li>
  </ul>
  <p>So I created a new notebook in Azure Synapse Studio and attached the <code>cluter01</code> to that notebook and choose Spark (Scala) language.</p>
  <p>I managed to access <code>sqlpool01</code> data by:</p>
  <pre><code>val df = spark.read.
      option(Constants.SERVER, &quot;&lt;path to the sqlpool01 endpoint workspace&gt;.sql.azuresynapse.net&quot;).
      synapsesql(&quot;sqlpool01.&lt;schema&gt;.&lt;table&gt;&quot;)
  </code></pre>
  <p>or by using <code>sqlanalytics</code> method instead of <code>synapsesql</code>:</p>
  <pre><code>val df = spark.read.
      option(Constants.SERVER, &quot;&lt;path to the sqlpool01 endpoint workspace&gt;.sql.azuresynapse.net&quot;).
      sqlanalytics(&quot;sqlpool01.&lt;schema&gt;.&lt;table&gt;&quot;)
  </code></pre>
  <p>Both commands give me the expected (and correct) output.</p>
  <p>However, instead of using the table name as in <code>sqlpool01.&lt;schema&gt;.&lt;table&gt;</code> I want to be able to write sql queries like <code>SELECT * from sqlpool01.&lt;schema&gt;.&lt;table&gt;</code>, as:</p>
  <pre><code>val df = spark.read.
      option(Constants.SERVER, &quot;&lt;path to the sqlpool01 endpoint workspace&gt;.sql.azuresynapse.net&quot;).
      sqlanalytics(&quot;SELECT * from sqlpool01.&lt;schema&gt;.&lt;table&gt; t1 INNER JOIN ...&quot;) &lt;&lt;-- won't work
  </code></pre>
  <p>Do you know if that is possible? I tried using <code>(SELECT * from sqlpool01.&lt;schema&gt;.&lt;table&gt;) AS temp</code> but with no success.</p>