Repository navigation
Conversation
…t into a FROM
union_select() built the count query for __len__() by passing the inner
select() straight to select_from(). SQLAlchemy 1.4 and 2.0 wrapped it in
a subquery with a deprecation warning ("Implicit coercion of SELECT and
textual SELECT constructs into FROM clauses is deprecated; please call
.subquery()"); 2.1 removed the coercion and raises ArgumentError, so
len(graph) fails on every store. Calling .subquery() emits the same SQL
(SELECT count(*) AS aCount FROM (SELECT DISTINCT ...) AS anon_1 UNION
ALL ...) under both versions and silences the warning on 2.0.
This commit was written by an AI coding tool and has not been verified by
a human.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013wcN7XquTfUi4vsKQ4KchL
This was referenced Sep 24, 2026
Contributor
|
Can confirm this is the correct solution, we've merged it downstream - gtfierro#2 If this will be merged - please consider using the version of this from downstream, it has some additional code simplifications for readability, just so downstream wouldn't have this extra diff they'll need to resolve later. |
Collaborator
|
@Andrej730 can you do me a favor and make a PR on this repo with your
downstream changes?
Cheers,
Mark W.
…On Sat, Sep 26, 2026, 01:02 Andrej730 ***@***.***> wrote:
*Andrej730* left a comment (RDFLib/rdflib-sqlalchemy#117)
<#117 (comment)>
Can confirm this is the correct solution, we've merged it downstream -
gtfierro#2 <gtfierro#2>
If this will be merged - please consider using the version of this from
downstream, it has some additional code simplifications for readability,
just so downstream wouldn't have this extra diff they'll need to resolve
later.
—
Reply to this email directly, view it on GitHub
<#117?email_source=notifications&email_token=AALLFSDOLCGXBADASJZ6MZL5Q5LWRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOBUGM3TEMRYGI22M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#issuecomment-5843722825>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALLFSGUQGUIWNSHWCJS4AT5Q5LWRAVCNFSNUABDKJSXA33TNF2G64TZHMZTMNJWGEYTEO2JONZXKZJ3GU2TONJVGEYDANBYUF3AE>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AALLFSAR5WMUBPEW3XU4VLD5Q5LWRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOBUGM3TEMRYGI22M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSVGM33PORSXEX3JN5ZQ>
and Android
<https://github.com/notifications/mobile/android/AALLFSDOIPSB6YENAGBA6P35Q5LWRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOBUGM3TEMRYGI22M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSXGM33PORSXEX3BNZSHE33JMQ>.
Download it today!
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Contributor
Collaborator
|
Merged an equivalent change to develop. Thanks for your contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(AI-written, not verified by Dion.)
SQLAlchemy 2.1.0 (released 2026-09-24) removed the implicit coercion of a
Selectinto a FROM clause that 1.4 and 2.0 had deprecated.union_select()relies on it for the count query behind__len__():Under 2.0 this emits
SADeprecationWarning: Implicit coercion of SELECT and textual SELECT constructs into FROM clauses is deprecated; please call .subquery() ...; under 2.1 it raisesArgumentError: FROM expression, such as a Table or alias() object expected, got <Select>fromsql.py:65, solen(graph)fails on every store (reached, for us, through brickschema'sGraph.__len__).The fix is the
.subquery()the warning asks for. The SQL is identical under both versions:Verified with the package's tests (
DB=sqlite) on SQLAlchemy 2.0.54 and 2.1.0: same results, and no deprecation warning any more on 2.0. Note that on the currentdevelopthe suite needs #116 to import on Python 3.12+ (nopkg_resources), and three tests fail under rdflib 7 because the store is not graph-aware; I have a fix for that too and can open it as a follow-up PR if wanted.