5a26d4c039e8339d13d0b446dfa1a813657ec61f,homeassistant/components/recorder/purge.py,,purge_old_data,#Any#Any#,12

Before Change


        // will delete the protected state when deleting its associated
        // event. Also, we would be producing NULLed foreign keys otherwise.

        protected_event_ids = session.query(States.event_id).join(
            protected_states, States.state_id == protected_states.c.state_id)\
            .filter(~States.event_id is not None).subquery()

        deleted_rows = session.query(Events) \
            .filter((Events.time_fired < purge_before)) \
            .filter(~Events.event_id.in_(

After Change


                              .group_by(States.entity_id).all()

        protected_state_ids = tuple((state[0] for state in protected_states))
        protected_event_ids = tuple((state[1] for state in protected_states))

        deleted_rows = session.query(States) \
                              .filter((States.last_updated < purge_before)) \
                              .filter(~States.state_id.in_(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: home-assistant/home-assistant
Commit Name: 5a26d4c039e8339d13d0b446dfa1a813657ec61f
Time: 2018-01-16
Author: mail+github@tinloaf.de
File Name: homeassistant/components/recorder/purge.py
Class Name:
Method Name: purge_old_data


Project Name: NifTK/NiftyNet
Commit Name: 14f7fd88d24cf31a466726fc89060a4b7778e2e6
Time: 2017-09-04
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/engine/image_window.py
Class Name:
Method Name: _read_window_sizes


Project Name: home-assistant/home-assistant
Commit Name: fc302186b27d04f01415b829e1e48adf19cb17f9
Time: 2018-01-16
Author: mail+github@tinloaf.de
File Name: homeassistant/components/recorder/purge.py
Class Name:
Method Name: purge_old_data