<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the superset logs for python stacktraces and included it here as text if any</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have reproduced the issue with at least the latest released version of superset</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the issue tracker for the same issue and I haven't found one similar</li>
</ul>
<h3 dir="auto">Superset version</h3>
<p dir="auto">0.26.3</p>
<h3 dir="auto">Expected results</h3>
<p dir="auto">I want to add a table from external Redshift Spectrum schema, in order to create charts based on this table. I expect the flow will be the same as with "local" Redshift schemas:</p>
<ol dir="auto">
<li>Sources -&gt; Databases -&gt; Add (postgresql)</li>
<li>Sources -&gt; Tables -&gt; Add (select redshift DB, put schema name and table name)</li>
<li>Observe a table in a table list</li>
</ol>
<h3 dir="auto">Actual results</h3>
<p dir="auto">Following error is displayed:</p>
<blockquote>
<p dir="auto">Table [spectrum.assoc] could not be found, please double check your database connection, schema, and table name</p>
</blockquote>
<p dir="auto">where <code class="notranslate">spectrum</code> is an external schema name and <code class="notranslate">assoc</code> is a table name.</p>
<h3 dir="auto">Steps to reproduce</h3>
<p dir="auto">Create Redshift cluster; create external spectrum schema; add a table to the metastore</p>
<h3 dir="auto">Notes</h3>
<ul dir="auto">
<li>I think this <em>might</em> be a duplicate of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="250838371" data-permission-text="Title is private" data-url="https://github.com/apache/superset/issues/3316" data-hovercard-type="issue" data-hovercard-url="/apache/superset/issues/3316/hovercard" href="https://github.com/apache/superset/issues/3316">#3316</a></li>
<li>In <code class="notranslate">psql</code> console, you can't get a list of tables in external spectrum schema by using <code class="notranslate">\dS</code>, only by querying SVV_EXTERNAL_TABLES system view.</li>
<li>In Superset's SQL Lab I can query external spectrum tables by using <code class="notranslate">schema.tablename</code> naming</li>
</ul>
<p dir="auto">Scenario:<br>
If I use the SQL Lab with a postgres database, that has multiple schemas, the schema selection on the left side leads to (psycopg2.OperationalError) FATAL: database "schema" does not exist.<br>
Even though the inspection of the schema works and I get all tables under the third dropdown.</p>
<p dir="auto">However if I leave the schema dropdown on the left empty and write a query like this:<br>
SELECT *<br>
FROM schema.test LIMIT 100</p>
<p dir="auto">it works.</p>
<p dir="auto">I guess the schema selection is misinterpreted in some way...</p>
<p dir="auto">Make sure these boxes are checked before submitting your issue - thank you!</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the caravel logs for python stacktraces and included it here as text if any</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have reproduced the issue with at least the latest released version of caravel</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the issue tracker for the same issue and I haven't found one similar</li>
</ul>
<h3 dir="auto">Caravel version</h3>
<p dir="auto">0.12.0</p>
<h3 dir="auto">Expected results</h3>
<p dir="auto">SELECT *<br>
FROM schema.testtable LIMIT 100 succeeds</p>
<p dir="auto">with the selected schema on the left side.</p>
<h3 dir="auto">Actual results</h3>
<p dir="auto">SELECT *<br>
FROM schema1.testtable LIMIT 100</p>
<p dir="auto">leads to</p>
<p dir="auto">(psycopg2.OperationalError) FATAL: database "schema1" does not exist</p>
<h3 dir="auto">Steps to reproduce</h3>
<ul dir="auto">
<li>Create a postgres database with two schemas (schema1, schema2)</li>
<li>select one schema in the SQL Lab</li>
<li>query:<br>
SELECT *<br>
FROM schema1.testtable LIMIT 100</li>
</ul>