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

[idea] Let other modules hook in and run their own custom queries #3

Closed
dgw opened this issue Dec 3, 2015 · 1 comment
Closed

[idea] Let other modules hook in and run their own custom queries #3

dgw opened this issue Dec 3, 2015 · 1 comment

Comments

@dgw
Copy link
Owner

dgw commented Dec 3, 2015

The bot.db system doesn't really allow for running custom queries against the bot's database, at least as far as I can see in the documentation. What if this module allowed not only bot owner/admins to run queries, but also other modules?

Considerations:

  • Would need more granular permissions management
  • Not clear how to let modules call each other, or if standard Python import statements would work as expected
  • Basically, there's a big question mark over the whole "how to implement" section

If it is doable, maybe it would even be possible to make this module a sort of wrapper for other modules that want to define custom tables. For example, dgw/sopel-UnoBot#9 currently uses a file on disk to store score info (previously plain-text/TSV, now JSON). It would be better to have that in a custom table. (Can't put it in bot.db because (as investigations for dgw/sopel-duel#1, dgw/sopel-roulette#1, and dgw/sopel-BombBot#11 have shown) there's no good way to query for leaderboard-type statistics AND resolve each entry to the correct nick. Custom database tables are probably the only way to solve this.

This might even turn into a general "dbutils" module, rather than "admindb", and I'd have to rename it—but that would put even more framework-type stuff in-scope, like managed module tables that reference the ID of a nick group but also have a canonical nick stored. Too bad bot.db.add_table() was removed last year…

@dgw dgw added the enhancement label Dec 3, 2015
@dgw
Copy link
Owner Author

dgw commented Jul 9, 2018

This is unnecessary. bot.db.execute() already allows running arbitrary SQL. https://sopel.chat/docs/db.html#sopel.db.SopelDB.execute

@dgw dgw closed this as completed Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant