<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[I&#x27;m sure I&#x27;m doing something stupid, but I&#x27;m seeing SQLAlchemy+sqlite return a row that doesn&#x27;t match the select condition.]]></title><description><![CDATA[<p>I'm sure I'm doing something stupid, but I'm seeing SQLAlchemy+sqlite return a row that doesn't match the select condition.  It is likely that SQLAlchemy is caching something, even though the session is fresh,</p><p>But the query is:<br />stmt = select(orm.Files).where(orm.Files.user == user and orm.Files.ontape == False).limit(1)</p><p>and it's returning:<br />Files(user='someuser', uuid='1b9f0805-6587-46ba-a44d-df0e2a1654bb', name='filename', size=3181952, ontape=True)</p><p>NEVER EVER should database software cache data at the start of a session.  That's just wrong.</p><p><a href="https://flyovercountry.social/tags/Python" rel="tag">#<span>Python</span></a> <a href="https://flyovercountry.social/tags/SQLAlchemy" rel="tag">#<span>SQLAlchemy</span></a></p>]]></description><link>https://board.circlewithadot.net/topic/4dc48516-0402-4f05-a496-a82fe39ba787/i-m-sure-i-m-doing-something-stupid-but-i-m-seeing-sqlalchemy-sqlite-return-a-row-that-doesn-t-match-the-select-condition.</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 01:04:26 GMT</lastBuildDate><atom:link href="https://board.circlewithadot.net/topic/4dc48516-0402-4f05-a496-a82fe39ba787.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 30 Apr 2026 05:41:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to I&#x27;m sure I&#x27;m doing something stupid, but I&#x27;m seeing SQLAlchemy+sqlite return a row that doesn&#x27;t match the select condition. on Thu, 30 Apr 2026 06:18:42 GMT]]></title><description><![CDATA[<p><span><a href="/user/encthenet%40flyovercountry.social">@<span>encthenet</span></a></span> I don't think you can use Python's own `and` and `or` operators. I seem to remembee that that won't work as expected, and the manual doesn't mention their use. Either make two chained `.where()` calls, or import and use `and_()` and `or_()`.</p><p></p><div class="card col-md-9 col-lg-6 position-relative link-preview p-0">



<a href="https://docs.sqlalchemy.org/en/20/tutorial/data_select.html" title="
        
        
    
    Using SELECT Statements
 —
    SQLAlchemy 2.0 Documentation

        
    ">
<img src="https://www.sqlalchemy.org/img/sqla_logo.png" class="card-img-top not-responsive" style="max-height:15rem" alt="Link Preview Image" />
</a>







<div class="card-body">
<h5 class="card-title">
<a href="https://docs.sqlalchemy.org/en/20/tutorial/data_select.html">

        
        
    
    Using SELECT Statements
 —
    SQLAlchemy 2.0 Documentation

        
    
</a>
</h5>
<p class="card-text line-clamp-3"></p>
</div>
<a href="https://docs.sqlalchemy.org/en/20/tutorial/data_select.html" class="card-footer text-body-secondary small d-flex gap-2 align-items-center lh-2">



<img src="https://www.sqlalchemy.org/favicon.ico" alt="favicon" class="not-responsive overflow-hiddden" style="max-width:21px;max-height:21px" />



<p class="d-inline-block text-truncate mb-0"> <span class="text-secondary">(docs.sqlalchemy.org)</span></p>
</a>
</div><p></p>]]></description><link>https://board.circlewithadot.net/post/https://infosec.space/users/stiiin/statuses/116492201011712376</link><guid isPermaLink="true">https://board.circlewithadot.net/post/https://infosec.space/users/stiiin/statuses/116492201011712376</guid><dc:creator><![CDATA[stiiin@infosec.space]]></dc:creator><pubDate>Thu, 30 Apr 2026 06:18:42 GMT</pubDate></item></channel></rss>