1.

What is ORM? Advantages of ORM? What is ORM? Advantages of ORM?

Answer»

ORM that is Object-Relational Mapping is a programming technique to convert data between the relational database and object-oriented programming languages such as Java, C#, etc. ORM maps database entities to Python code usually classes. You can construct your query in Python and it gets translated to SQL BEHIND the scene.

For example instead of this SQL query - 

SELECT * FROM <TABLE NAME>

you can use -

users = User.objects.all()

In SQL you have to execute that query using a driver, parse the result and then access the columns, but here ORM is doing that for you. That makes things easier and faster to use.

The most powerful feature of Django is its object-Relational Mapper that enables you to interact with the database.  

Let us see the advantages of ORM -

  1. You can write in the language you are familiar with. 
  2. It abstracts away the database system so that switching the backend database easy without any worry.
  3. You get a LOT of advanced features such as support for transactions, connection pooling, migrations, seeds, etc. depending on the ORM
  4. Cache management, Entities are CACHED in memory thus reducing the load on the database.
  5. Key management, Identifiers and SURROGATE keys automatically propagate and manage.
  6. Multiple users can update the same data simultaneously.
  7. Data loads are configurable and allow you to load appropriate data for each scenario.
  8. You can navigate object relationships transparently, related objects automatically load when required.
  9. ORM tools provide an object-oriented query language that allows developers to FOCUS on the object model without worrying about database structure or SQL semantics.


Discussion

No Comment Found