Skip to content

User ORM instead of direct sql query #82

@coulisse

Description

@coulisse

Using an ORM (Object-Relational Mapping) offers numerous advantages, especially when working with object-oriented languages like Python. Here are some of the main reasons why it might be better to use an ORM:

  • Database Abstraction: An ORM allows you to work with the database at a higher level of abstraction, using objects instead of SQL queries. This makes the code more readable and maintainable.
  • Increased Productivity: With an ORM, you can write less boilerplate code to perform common database operations. This allows you to focus more on the application logic.
  • Database Independence: By using an ORM, your application code is less tied to a specific type of database. This makes it easier to switch databases in the future without having to rewrite all the SQL code.
  • Relationship Management: An ORM automatically handles the relationships between database tables, making it easier to work with complex and interconnected data.
  • Security: ORMs can help prevent SQL injection attacks by using safe methods to construct SQL queries.

Some ORMs:

  • SQLAlchemy: One of the most powerful and flexible ORM available for Python. It offers a rich and comprehensive interface for working with relational databases and can be used together with Pandas to manipulate data.
  • Peewee: A lightweight and easy-to-use ORM, ideal for small to medium-sized projects. It has an expressive query syntax and supports MySQL, PostgreSQL, and SQLite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions