comparison libervia/backend/memory/sqla.py @ 4376:7ac28a270b7f default tip

memory (sqla): Add a filter for `origin` in `history_get`: rel 459
author Goffi <goffi@goffi.org>
date Sun, 08 Jun 2025 17:16:58 +0200
parents 5e48ae998976
children
comparison
equal deleted inserted replaced
4375:42becd4b819f 4376:7ac28a270b7f
672 # FIXME: "json_each" works with SQLite, but when PostGreSQL support will 672 # FIXME: "json_each" works with SQLite, but when PostGreSQL support will
673 # be added, "json_array_elements" may have to be used with it. 673 # be added, "json_array_elements" may have to be used with it.
674 subquery = func.json_each(History.extra["keywords"]).table_valued("value") 674 subquery = func.json_each(History.extra["keywords"]).table_valued("value")
675 stmt = stmt.where( 675 stmt = stmt.where(
676 exists().where(subquery.c.value == keyword) 676 exists().where(subquery.c.value == keyword)
677 )
678 if "origin" in filters:
679 stmt = stmt.where(
680 History.extra["origin"].as_string() == filters["origin"]
677 ) 681 )
678 682
679 if limit is not None: 683 if limit is not None:
680 stmt = stmt.limit(limit) 684 stmt = stmt.limit(limit)
681 685