TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/frappe/frappe/llms.txt
Use this file to discover all available pages before exploring further.
frappe.db object provides methods for database operations including queries, transactions, and value operations.
Query execution
sql
Execute a SQL query and fetch all rows.SQL query to execute
Values to be escaped and substituted in the query
Return results as dictionaries
Return results as lists
Return only the first column values
Print query and execution time
Commit after executing the query
Return an iterator instead of fetching all results at once
Getting values
get_value
Return a document property or list of properties.DocType name
Filters like
{"x": "y"} or document name. None for Single DocTypeColumn name or list of column names
Return values as dict
Print the query
Select row with FOR UPDATE clause
get_single_value
Get a field value from a Single DocType.Single DocType name
Field name
get_all
Get a list of document names matching filters. Does not check permissions.DocType name
Filter conditions
Fields to fetch. Default:
["name"]Sort order. Example:
"creation desc"Start index for pagination
Number of records per page. 0 for all records
Column name to pluck values from
get_list
Get a list of documents. Checks permissions.DocType name
Filter conditions
Fields to fetch
Sort order
Start index for pagination
Number of records per page
Setting values
set_value
Set a field value for a document.DocType name
Document name
Field name or dict of field-value pairs
Value to set (not required if fieldname is dict)
Update the modified timestamp
Checking existence
exists
Check if a document exists.DocType name
Document name or filters
Document name if exists, None otherwise
Counting records
count
Count documents matching filters.DocType name
Filter conditions
Number of matching documents
Transactions
commit
Commit the current transaction.rollback
Rollback the current transaction.savepoint
Create a savepoint for partial rollback.Savepoint name
Table operations
table_exists
Check if a table exists in the database.Table name (use
tab prefix for DocTypes)True if table exists
get_table_columns
Get the list of column names in a table.Table name
List of column names
Bulk operations
delete
Delete a document from the database directly (bypasses controller logic).DocType name
Document name or filter conditions