How to create a repository pattern handler?

I’m currently developing a project that requires an effective way to implement a repository pattern handler. However, I’m feeling a bit lost regarding the optimal structure for the code and the necessary methods that should be incorporated into the handler class.

Here’s my current attempt:

class Repository:
    def __init__(self, db_connection):
        self.db = db_connection
    
    def get_user(self, id):
        sql = "SELECT * FROM users WHERE id = ?"
        return self.db.execute(sql, id)
    
    def create_user(self, user_info):
        sql = "INSERT INTO users (name, email) VALUES (?, ?)"
        return self.db.execute(sql, user_info['name'], user_info['email'])

Am I on the right track with this repository approach? Are there any additional methods I should consider or should I modify the current structure? Any insights would be greatly appreciated.

This forum is mainly for gaming chats, so it might not be the best place for coding advice. Check out a developer forum or a programming subreddit for more targeted help.

This isn’t really the right place for programming questions. You might find better guidance on a developer subreddit or a coding forum. This forum is more focused on gaming topics, so look elsewhere for help with repository patterns.

This isn’t a gaming topic - you’re asking about programming. You’d get better help on a dev forum or subreddit.

This isn’t really a programming forum. You might want to check out a developer community for better advice.