Skip to content

Instantly share code, notes, and snippets.

@weiserman
Last active October 10, 2022 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weiserman/f123b2f6905e7cc040a97c1d9950a65e to your computer and use it in GitHub Desktop.
Save weiserman/f123b2f6905e7cc040a97c1d9950a65e to your computer and use it in GitHub Desktop.
Frappe Python API example with SQL
import frappe
// This code is called from a front end script and returns a SQL query with a dictionary list.
@frappe.whitelist()
def get_rental_articles(first_name):
rentals = frappe.db.sql(f""" SELECT * from `tabLibrary Transaction` WHERE library_member = '{first_name}' """, as_dict=True)
return rentals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment