What is the main difference between making a query using Manager.raw() method and connection.cursor() method?

I need to know which one is faster and why, and I also need to know the cases for each one.

I try them both but I can't find the difference.

The main difference between using the Manager.raw() method and the connection.cursor() method for making queries is that the Manager.raw() method is used to directly execute queries on the database, while the connection.cursor() method is used to create a cursor object which can be used to iterate over the results of a query.

In terms of speed, the Manager.raw() method is generally faster because it does not require the overhead associated with creating and managing a cursor object. However, the connection.cursor() method is more flexible and allows for more precise control over the iteration of the query results.

The Manager.raw() method should be used when you need to execute a query quickly and do not need to iterate over the results. The connection.cursor() method should be used when you need to iterate over the query results, or need more precise control over the iteration.

Back to Top