<h3 dir="auto">Describe the use case</h3>
<p dir="auto">The current relationship dynamic lazy loader returns a query object.</p>
<p dir="auto">This new lazy loader would instead present a 2.0 interface, so it would offer the methods <code class="notranslate">select()</code>, <code class="notranslate">insert()</code>, etc</p>
<p dir="auto">Regarding the name, mike suggested <code class="notranslate">statement_only</code>, but that's still wip</p>
<h3 dir="auto">Databases / Backends / Drivers targeted</h3>
<p dir="auto">All</p>
<h3 dir="auto">Example Use</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="loaded = session.scalars(User.address.select()).all()"><pre class="notranslate"><span class="pl-s1">loaded</span> <span class="pl-c1">=</span> <span class="pl-s1">session</span>.<span class="pl-en">scalars</span>(<span class="pl-v">User</span>.<span class="pl-s1">address</span>.<span class="pl-en">select</span>()).<span class="pl-en">all</span>()</pre></div>
<h3 dir="auto">Additional context</h3>
<p dir="auto"><em>No response</em></p>
<p dir="auto"><strong>Migrated issue, originally created by Andrey Zholos (<a href="https://github.com/zholos">@zholos</a>)</strong></p>
<p dir="auto">When updating a table with a specified schema name, some parts of the generated statement refer to the table with an alias and some parts don't.</p>
<p dir="auto">A subquery uses an alias that was not introduced (it could be introduced in an mssql "from" clause):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="UPDATE [schema].sometable SET val=
(SELECT [#other].newval FROM [#other] WHERE sometable_1.sym = [#other].sym)"><pre class="notranslate"><code class="notranslate">UPDATE [schema].sometable SET val=
(SELECT [#other].newval FROM [#other] WHERE sometable_1.sym = [#other].sym)
</code></pre></div>
<p dir="auto">An alias is introduced but the "where" clause doesn't use it:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="UPDATE [schema].sometable SET val=[#other].newval
FROM [schema].sometable AS sometable_1, [#other]
WHERE [schema].sometable.sym = [#other].sym"><pre class="notranslate"><code class="notranslate">UPDATE [schema].sometable SET val=[#other].newval
FROM [schema].sometable AS sometable_1, [#other]
WHERE [schema].sometable.sym = [#other].sym
</code></pre></div>
<p dir="auto">Both of these statements fail. Complete program attached.</p>
<hr>
<p dir="auto">Attachments: <a href="../wiki/imported_issue_attachments/3424/update.py">update.py</a> | <a href="../wiki/imported_issue_attachments/3424/update_self.py">update_self.py</a></p>