Frappe.db.sql in print format

Hi,
I want to print total of each expense claim types in print format.
I get the desired output with the following query.
SELECT sum(claim_amount) from tab Expense Claim Detail where parent like ‘%s’ and
expense_type like “Food Expenses”
how do i use it in print format or in custom script??