I found there are 2 ways to get value from single doctype using python:
frappe.get_single('System Settings').country,
frappe.db.get_single_value('System Settings', 'country'),
What are the difference?
What are the recommended one?
I found there are 2 ways to get value from single doctype using python:
frappe.get_single('System Settings').country,
frappe.db.get_single_value('System Settings', 'country'),
What are the difference?
What are the recommended one?
The function get_single()
returns a frappe.model.document.Document
object. You can interact with the Document using all its methods.
The function get_single_value()
calls the database directly, and returns a simple datatype. An integer, string, float, boolean, etc.
Which to use depends on your use-case.
So to get only single field value would be better using the db call?