-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Violent deprecation warnings vs sqlalchemy 1.4.46 #100
Comments
Hi, thanks for reporting this. I'll try to address the issue, but I'm short
on time for rdflib-sqlalchemy and think the project could use a new
maintainer. If you're interested, let me know.
…On Fri, Jan 20, 2023, 13:43 Nicholas Bollweg ***@***.***> wrote:
Use of rdflib_sqlalchemy.store.union_select with sqlalchemy 1.4.46 shows:
The legacy calling style of select() is deprecated and will be removed in SQLAlchemy 2.0. Please use the new calling style described at select(). (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
It's possible to hide these errors with SQLALCHEMY_SILENCE_UBER_WARNING=1,
but it can be difficult to reason about this error, and how a downstream
would be able to effectively do it.
—
Reply to this email directly, view it on GitHub
<#100>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALLFSAVBOROUUL3FJJ3KF3WTLTHTANCNFSM6AAAAAAUB4FPIU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I am updating the library to use SQLAlchemy version 2.0.23. Doing so results in the failing of multiple tests. I believe this is also has to do with the deprecation of the |
@mwatts15 , so I fixed all tests but one. I'm still unable to get the class SQLATestCase(unittest.TestCase):
identifier = URIRef("rdflib_test")
dburi = Literal("sqlite://")
def setUp(self):
self.store = plugin.get(
"SQLAlchemy", Store)(identifier=self.identifier, configuration=self.dburi)
self.graph = ConjunctiveGraph(self.store, identifier=self.identifier)
self.graph.open(self.dburi, create=True)
def test_contexts_result(self):
ctx_id = URIRef('http://example.org/context')
g = self.graph.get_context(ctx_id)
g.add((michel, likes, pizza))
actual = list(self.store.contexts())
self.assertEqual(actual[0], ctx_id) So it seems that information about michel liking pizza is transferred in the graph. However, when retrieving the I added my commit in the links below. |
So it does seems to work when the test gets a adjusted a little bit. def test_contexts_result(self):
ctx_id = URIRef('http://example.org/context')
g = self.graph.get_context(ctx_id)
g.add((michel, likes, pizza))
actual = list(self.store.contexts(triple=(michel, likes, pizza)))
self.assertEqual(actual[0], ctx_id) Here I fill in the parameter I've also started a pull request. |
Good catch, Richard. It should definitely work without the triple argument
passed in. My first guess at why it might not is a change in how SQLAlchemy
generates the query or stores the triples. More verbose logging should help
determine what the cause is.
… Message ID: ***@***.***>
|
I believe it has to do with the following code: # sql.py line 68
elif select_type == CONTEXT_SELECT:
select_clause = expression.select(*[table.c.context]).where(whereClause)
If I change it to the code below the test # sql.py line 68
elif select_type == CONTEXT_SELECT:
select_clause = expression.select(table.c.context)
if whereClause:
select_clause = expression.select(table.c.context).where(whereClause) New error: def __bool__(self):
> raise TypeError("Boolean value of this clause is not defined")
E TypeError: Boolean value of this clause is not defined
|
Ah never mind. Already fixed it with; if whereClause is not None: I believe the pull request is ready for reviewing, @mwatts15 |
Sounds good. I will try to merge in the next few days.
…On Tue, Dec 5, 2023, 07:01 Richard Scholtens ***@***.***> wrote:
Ah never mind. Already fixed it with;
if whereClause is not None:
—
Reply to this email directly, view it on GitHub
<#100 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALLFSE6GUAVR7O4RNL7V23YH4LKLAVCNFSM6AAAAAAUB4FPIWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBQG42TAMRQHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Thanks! Let me know if there are any issues. |
I noticed I still had an old commit message in the PR. Updated this PR comment. |
@mwatts15 , I believe this issue can be closed now. |
Use of
rdflib_sqlalchemy.store.union_select
withsqlalchemy 1.4.46
shows:It's possible to hide these errors with
SQLALCHEMY_SILENCE_UBER_WARNING=1
, but it can be difficult to reason about this error, and how a downstream would be able to effectively do it.The text was updated successfully, but these errors were encountered: