{"html_url": "https://github.com/simonw/sqlite-utils/issues/441#issuecomment-1155750270", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/441", "id": 1155750270, "node_id": "IC_kwDOCGYnMM5E41l-", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-06-14T21:57:57Z", "updated_at": "2022-06-14T21:57:57Z", "author_association": "OWNER", "body": "I added `where=` and `where_args=` parameters to that `.search()` method - updated documentation is here: https://sqlite-utils.datasette.io/en/latest/python-api.html#searching-with-table-search", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1257724585, "label": "Combining `rows_where()` and `search()` to limit which rows are searched"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/441#issuecomment-1155515426", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/441", "id": 1155515426, "node_id": "IC_kwDOCGYnMM5E38Qi", "user": {"value": 1448859, "label": "betatim"}, "created_at": "2022-06-14T17:53:43Z", "updated_at": "2022-06-14T17:53:43Z", "author_association": "NONE", "body": "That would be handy (additional where filters) but I think the trick with the `with` statement is already an order of magnitude better than what I had thought of, so my problem is solved by it (plus I got to learn about `with` today!)", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1257724585, "label": "Combining `rows_where()` and `search()` to limit which rows are searched"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/441#issuecomment-1155421299", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/441", "id": 1155421299, "node_id": "IC_kwDOCGYnMM5E3lRz", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-06-14T16:23:52Z", "updated_at": "2022-06-14T16:23:52Z", "author_association": "OWNER", "body": "Actually I have a thought for something that could help here: I could add a mechanism for inserting additional where filters and parameters into that `.search()` method.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1257724585, "label": "Combining `rows_where()` and `search()` to limit which rows are searched"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/441#issuecomment-1154373361", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/441", "id": 1154373361, "node_id": "IC_kwDOCGYnMM5Ezlbx", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-06-13T20:01:25Z", "updated_at": "2022-06-13T20:01:25Z", "author_association": "OWNER", "body": "Yeah, at the moment the best way to do this is with `search_sql()`, but you're right it really isn't very intuitive.\r\n\r\nHere's how I would do this, using a CTE trick to combine the queries:\r\n```python\r\nsearch_sql = db[\"articles\"].search_sql(columns=[\"title\", \"author\"]))\r\nsql = f\"\"\"\r\nwith search_results as ({search_sql})\r\nselect * from search_results where owner = :owner\r\n\"\"\"\r\nresults = db.query(sql, {\"query\": \"my search query\", \"owner\": \"my owner\"})\r\n```\r\nI'm not sure if `sqlite-utils` should ever evolve to provide a better way of doing this kind of thing to be honest - if it did, it would turn into more of an ORM. Something like [PeeWee](http://docs.peewee-orm.com/en/latest/) may be a better option here.", "reactions": "{\"total_count\": 1, \"+1\": 1, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1257724585, "label": "Combining `rows_where()` and `search()` to limit which rows are searched"}, "performed_via_github_app": null}