<p dir="auto"><a href="https://www.sqlite.org/lang_update.html" rel="nofollow">https://www.sqlite.org/lang_update.html</a></p>
<p dir="auto">see if we can flip this on and not spend too much time on it, lots of tests will light up if we add the method so should be quick</p>
<h3 dir="auto">Describe the use case</h3>
<p dir="auto">Allow the UPDATE-FROM syntax with sqlite instead of raising <code class="notranslate">NotImplementedError</code>.</p>
<h3 dir="auto">Databases / Backends / Drivers targeted</h3>
<p dir="auto">SQLite version &gt;= 3.33.0<br>
This is available in the standard library sqlite3 in Python 3.8.7, 3.9.1, and 3.10, or in the pysqlite3 package.</p>
<h3 dir="auto">Example Use</h3>
<div class="highlight highlight-source-sql notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="UPDATE inventory
   SET quantity = quantity - daily.amt
  FROM (SELECT sum(quantity) AS amt, itemId FROM sales GROUP BY 2) AS daily
 WHERE inventory.itemId = daily.itemId;"><pre class="notranslate"><span class="pl-k">UPDATE</span> inventory
   <span class="pl-k">SET</span> quantity <span class="pl-k">=</span> quantity <span class="pl-k">-</span> <span class="pl-c1">daily</span>.<span class="pl-c1">amt</span>
  <span class="pl-k">FROM</span> (<span class="pl-k">SELECT</span> <span class="pl-c1">sum</span>(quantity) <span class="pl-k">AS</span> amt, itemId <span class="pl-k">FROM</span> sales <span class="pl-k">GROUP BY</span> <span class="pl-c1">2</span>) <span class="pl-k">AS</span> daily
 <span class="pl-k">WHERE</span> <span class="pl-c1">inventory</span>.<span class="pl-c1">itemId</span> <span class="pl-k">=</span> <span class="pl-c1">daily</span>.<span class="pl-c1">itemId</span>;</pre></div>
<h3 dir="auto">Additional context</h3>
<p dir="auto">The SQLite UPDATE-FROM syntax is supposed to be compatible with PostgreSQL.<br>
<a href="https://sqlite.org/lang_update.html" rel="nofollow">https://sqlite.org/lang_update.html</a><br>
I found that copying <code class="notranslate">update_from_clause</code> from <code class="notranslate">sqlalchemy.dialects.postgresql.base</code> to <code class="notranslate">sqlalchemy.dialects.sqlite.base</code> makes this work.</p>