<p dir="auto"><strong>Migrated issue, originally created by Anonymous</strong></p>
<p dir="auto">inserting multiple rows using single list of row values doesn't work, ex.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="conn.execute(&quot;insert into users (user_id, user_name) values (?, ?)&quot;, [(10,&quot;donkey&quot;)]((9,&quot;barney&quot;),))"><pre class="notranslate"><code class="notranslate">conn.execute("insert into users (user_id, user_name) values (?, ?)", [(10,"donkey")]((9,"barney"),))
</code></pre></div>
<p dir="auto">or</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" conn.execute(&quot;insert into users (user_id, user_name) values (%s, %s)&quot;, [[4,&quot;ed&quot;]([4,&quot;ed&quot;), [5,&quot;horse&quot;](5,&quot;horse&quot;)])"><pre class="notranslate"><code class="notranslate"> conn.execute("insert into users (user_id, user_name) values (%s, %s)", [[4,"ed"]([4,"ed"), [5,"horse"](5,"horse")])
</code></pre></div>
<p dir="auto">Attached patch fixes this.</p>
<p dir="auto">I have a specific model configuration where queries using limit() on a relationship are not returning the expected number of rows.</p>
<p dir="auto">In this example, staff is defined as a relationship on the School model as such:<br>
<code class="notranslate">staff = db.relationship( 'User', secondary='grant', primaryjoin='School.id==Grant.school_staff_target_id', secondaryjoin='Grant.user_id==User.id', lazy='dynamic', backref='schools_staff' )</code></p>
<p dir="auto">Getting all rows with this query returns two rows, as expected:<br>
<code class="notranslate">staff = School.query.filter_by(id='5d2ab3bb1f28426f8148e47543b1cbee').one()\ .staff.filter_by(deleted=False).all()</code></p>
<p dir="auto">This query, using <code class="notranslate">limit(2)</code>, only returns one row:<br>
<code class="notranslate">staff = School.query.filter_by(id='5d2ab3bb1f28426f8148e47543b1cbee').one()\ .staff.filter_by(deleted=False).limit(2).all()</code></p>
<p dir="auto">Whereas this query, using <code class="notranslate">limit(3)</code>, returns both rows (expected):<br>
<code class="notranslate">staff = School.query.filter_by(id='5d2ab3bb1f28426f8148e47543b1cbee').one()\ .staff.filter_by(deleted=False).limit(3).all()</code></p>