Skip to content
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

Add script to auto delete excess data in the database #32

Closed
AndyGrant opened this issue Mar 14, 2019 · 2 comments
Closed

Add script to auto delete excess data in the database #32

AndyGrant opened this issue Mar 14, 2019 · 2 comments

Comments

@AndyGrant
Copy link
Owner

After some time, all of the Result objects for a given test may be deleted. Leaving only the final results, cutting out the massive amount of data due to the 40+ machines connected. Additionally, the EventLog may also be cleared.

I have been doing this by hand every few months to keep the database small, but each time I forget how to do it.

@AndyGrant
Copy link
Owner Author

from OpenBench.models import .

<model>.objects.all().delete()

from django.db import connection
cursor = connection.cursor()
cursor.execute('vacuum')

@AndyGrant
Copy link
Owner Author

from OpenBench.models import *

x = Result.objects.all().delete()
y = Machine.objects.all().delete()
z = LogEvent.objects.all().delete()

[ Nothing else needed for MySQL ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant