*** tosky_ is now known as tosky | 09:48 | |
abhishekk | dansmith, will it be wise to rollback update and delete queries to not use join? | 14:35 |
---|---|---|
dansmith | abhishekk: oh sorry, I meant to go looking at options and got distracted | 14:36 |
dansmith | I think we can probably use a subquery there | 14:36 |
abhishekk | So use direct plain query syntax in conn.execute? | 14:36 |
dansmith | looks like zzzeek isn't around but he can probably tell us easily | 14:36 |
dansmith | no I think you can do it with sqla | 14:37 |
abhishekk | ok, I will look for it | 14:37 |
abhishekk | if possible will update PS tomorrow this time | 14:38 |
abhishekk | thank you! | 14:38 |
dansmith | abhishekk: https://docs.sqlalchemy.org/en/20/tutorial/data_update.html#correlated-updates | 14:38 |
dansmith | I think you can just use the subquery for the "where" part | 14:38 |
abhishekk | I know the query, just need to find out how to put this in sqla | 14:39 |
abhishekk | I guess I have used subquery at one api, let me check | 14:39 |
dansmith | I imagine query.filter_by(subquery) where subquery just grabs the node id | 14:39 |
abhishekk | ack | 14:40 |
abhishekk | something like this, https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L1575 ? | 14:46 |
abhishekk | this method is not used anywhere now :/ | 14:47 |
dansmith | yeah I mean you could do raw SQL as well, but I probably wouldn't unless you can't do it any other way | 14:50 |
abhishekk | Update cached_images set values last_accessed=?, hits=(cached_images.hits + ?) where cached_images.image_id = ? and cached_images.node_reference_id = (select node_reference_id from node_reference where node_reference.node_reference_url = ?) | 14:50 |
abhishekk | I will find out how to do it using sqla | 14:51 |
dansmith | did subquery not work? | 14:51 |
abhishekk | I didn't tried it yet | 14:52 |
dansmith | oh okay | 14:52 |
abhishekk | but subquey will generate above query, right? | 14:52 |
dansmith | yep, should be pretty much exactly that | 14:53 |
abhishekk | ack, thanks for the inputs | 14:54 |
dansmith | np :) | 14:57 |
abhishekk | subquery doesn't work with delete, managed to get it worked with update | 17:15 |
abhishekk | ignore above statement | 17:29 |
dansmith | heh, I was going to say... :D | 17:52 |
opendevreview | Abhishek Kekane proposed openstack/glance master: Add required database API(s) for cache https://review.opendev.org/c/openstack/glance/+/899870 | 18:28 |
opendevreview | Abhishek Kekane proposed openstack/glance master: Introduce centralized database driver for image cache https://review.opendev.org/c/openstack/glance/+/899871 | 18:28 |
opendevreview | Abhishek Kekane proposed openstack/glance master: Read global config file for cache utilities https://review.opendev.org/c/openstack/glance/+/899872 | 18:28 |
opendevreview | Abhishek Kekane proposed openstack/glance master: Move sqlite code in common module https://review.opendev.org/c/openstack/glance/+/900418 | 18:28 |
opendevreview | Abhishek Kekane proposed openstack/glance master: Migrate from SQLite to Centralized db https://review.opendev.org/c/openstack/glance/+/900419 | 18:28 |
opendevreview | Abhishek Kekane proposed openstack/glance master: Use centralized_db cache driver in tempest jobs https://review.opendev.org/c/openstack/glance/+/901429 | 18:28 |
opendevreview | Abhishek Kekane proposed openstack/glance master: New grenade job to upgrding cache driver https://review.opendev.org/c/openstack/glance/+/901649 | 18:28 |
opendevreview | Abhishek Kekane proposed openstack/glance master: Make `centralized_db` cache driver default https://review.opendev.org/c/openstack/glance/+/907111 | 18:28 |
opendevreview | Abhishek Kekane proposed openstack/glance master: [docs] Configure centralized_db cache driver https://review.opendev.org/c/openstack/glance/+/908247 | 18:28 |
abhishekk | :D hopefully sqlalchemy-tips job agrees with me | 18:31 |
abhishekk | it does | 18:47 |
* abhishekk signing out | 18:47 |
Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!