I was wondering if anyone knows of a library that resembles the Django DB functionality to replace the standard mysql library?
So; create tables with a model class and access it like you would in a Django projects.
Django makes querying so much easier. I would honestly rather use that in my non-django projects instead of manually joining tables.
As an example, Django allows you to create two tables 'Blog' and 'Author' with a foreign key from Blog to it's Author:
class Author(models.Model): name = models.CharField(max_length=128) location = models.CharField(max_length=128) class Blog(models.Model): # Foreign author = models.ForeignKey(Author, on_delete=models.CASCADE, related_name='blog') # Columns title = models.CharField(max_length=128) content = models.CharField(max_length=6000) timestamp = models.DateTimeField(auto_now_add=True)
And, for example, access the author of a specific blog like so:
blog = Blog.objects.filter(id=1) author = blog.author
And it gets only nicer when you have many-to-many relationships! Clean and simple.