-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Creating new table in peewee database #68
Comments
What you did should be enough, if you put a print statement in the If you're going to write a cache I'd suggest you'd use something else than the datastore storage strategies like PeeweeStorage (which shouldn't be complicated by caching, and caching should be storage-method independent). @johan-bjareholt is working on implementing a storage method using plain SQL for better performance (see PR in aw-core), yet another reason why you'd want to be storage method independent. I'm still not quite sure how you're planning to do the caching, how would it work with queries? |
When I attempted this previously I had an ID for each query and saved the result. My plan for it was to later query it in a hierarchy like hour->day->week->month->year (which is likely very hard due to timezone issues like you said) but never got that far since I thought that a good query system was of higher priority (query2). It would also be good to save down the last time of access of the cache so we can auto-clean the cache so it doesn't grow too much. |
@johan-bjareholt Yeah but queries can return all kinds of results, how would you know how to merge query results? |
That didn't use to be the case in query1, good point. EDIT: I do not think this is a good solution, just throwing around ideas |
This is the structure I was considering: You can essentially run the same functions for summary(browserSummaryQuery, windowQuery), and then just insert the data from them into the table. What do you guys think? |
I still don't believe that this is a good idea though because it's not flexible enough. On the other hand, we could just invalidate the cache every time the user upgrades activitywatch and we have a new format. |
What other features would a more flexible cache have? |
A flexible cache would not hardcode the columns of the DB table. |
I've created a new table in the peewee.py file. I've tried both make build and make install in aw-core, yet it doesn't seem like the peewee file ever runs the code. I've looked into the source code and couldn't find when the PeeweeStorage was initialized. Any idea on how to get the file to run manually?
Code below:
The text was updated successfully, but these errors were encountered: