StarryPy / StarryPy3k

StarryPy on Python3k
Other
53 stars 35 forks source link

Replace Shelf/Cupboard with other database #152

Closed evonzee closed 1 year ago

evonzee commented 1 year ago

Hi folks,

I have a server admin requesting capability to store the player database in MySQL so it can be shared with other applications. I read that you had plans (years ago) to switch away from Cupboard to SQLite, so I thought perhaps an abstraction layer would make sense to provide some level of database platform independence.

I've got experience in other languages but I've not done much DB work in Python. After looking briefly at some ORMs I'm leaning towards Peewee since Alchemy seemed heavier and this is a simple use case. But before starting work I wanted to get some alignment on vision - ideally I'd like to contribute this back so I want to use similar tools as you'd choose if building this out yourselves.

rubellyte commented 1 year ago

So, this is actually a slightly tricky question. As you noted, we did indeed have plans to move to a proper database format over the Shelf construction. In fact, we started working on a ground-up rewrite of StarrPy as a whole here, which, among other things, uses SQLAlchemy to do object mapping.

Unfortunately the rewrite has been dormant as long as StarryPy itself - and, of course, it's incomplete. I don't remember how far I actually got, but a cursory glance suggests that the core machinery is in place, at least, though there aren't any plugins.

It is up for debate whether it would be better to try and retrofit an ORM onto StarryPy3k, or revive the rewrite instead. It would probably be easier to stick with the current codebase, but it's so crusty that the rewrite might be the better option overall... I dunno.

evonzee commented 1 year ago

Thanks. I'll spend some time evaluating the reboot project. At first glance it looks much more modern and well architected compared to the legacy codebase. Lots for me to learn; I've only picked up enough Python to contribute to this repo :)

If I find the basics to be working, I'll take a shot at producing a Discord plugin, and then perhaps supporting other DB platforms.