What does sess.delete() do?

  1. a) remove data from in memory

  2. b) remove from database.

  3. c) remove from sessionFactory

  4. d) None of the above.


Correct Option: B
Explanation:

To understand what sess.delete() does, we need to know that it is a method used in SQLAlchemy, which is a Python library for working with SQL databases.

The sess.delete() method is used to delete an object from the database using the SQLAlchemy session object that it is called on.

Now let's go through each option and explain why it is right or wrong:

A. a) remove data from in-memory: This option is incorrect because calling sess.delete() does not remove data from in-memory, it only marks the object for deletion from the database.

B. b) remove from the database: This option is correct. Calling sess.delete() method marks the object for deletion from the database. The object is only removed from the database when the session is committed.

C. c) remove from sessionFactory: This option is incorrect because sess.delete() method does not remove an object from the sessionFactory.

D. d) None of the above: This option is incorrect because option B is correct.

Therefore, the answer is: B. remove from the database.

Find more quizzes: