-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
db: add methods to delete a channel or nick's key from database #1526
db: add methods to delete a channel or nick's key from database #1526
Conversation
It's easy to 👍 a function to delete values from the database, though I would definitely name the functions Getting on board with an adjustment function is much harder. Sopel's database doesn't care what you put in it—everything becomes strings under the hood. Because of that, I don't think the |
I agree with @dgw. I would like to point out that Sopel's DB interface will be modified for 7.x, by using SQLAlchemy. So if you want to add or change DB-related features, I invite you to either wait for #1446 to be merged, or to base your work on this branch (but that's risky, considering it's a very living branch with rebase every now and then). |
Well it's not changing much at this point, but I agree that rebasing onto a branch that has been rebased is annoying. Shouldn't be long, though! |
ba384bc
to
7d2f5c0
Compare
7d2f5c0
to
8743a3c
Compare
I removed the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Straightforward, yet naming things is still hard! 😉
Reminder for myself (and/or the ambitious PR owner) to give the function names and docstrings a good once-over after this is reworked on top of SQLAlchemy/#1446. (I still prefer |
Ready to rework, @deathbybandaid. #1446 just merged in. ☺ |
7e2d78d
to
523e86c
Compare
Assuming #1603 gets fixed, my research shows that this is how to delete a value via sqlalchemy. This will need some testing pending that fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure you want to call session.delete(result)
(not result.value
), but I'd get confirmation from @RustyBower on that one since he has much more SQLAlchemy experience than any of the rest of us.
Going off of https://stackoverflow.com/a/26643978/5991 fwiw
523e86c
to
628c927
Compare
Yeah it's definitely |
628c927
to
88f2ed2
Compare
Applied suggestions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closed/reopened to kick Scrutinizer in the pants (it errored during the last inspection and I didn't notice until this weekend). I guess we'll also get a new Travis build out of it, so yay? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One wee copy-and-paste leftover to fix, and then I think this is ready.
95585fa
to
31a95a6
Compare
updated, and squashed |
77ae01d
to
f45825b
Compare
I went an added step and added tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm 99% 👍; just want to make these two docstrings consistent with their siblings.
e6e93ca
to
ddb9617
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 🙏
These are functions I've had for my bot for a long time,
Reset can likely use a better method like
DELETE FROM
instead of replacing values with None.Adjust is something I've been using for a long time now to retrieve a current value and add a positive or negative number to it. Handy for modules that need to update stat counters.