How to use ascending sql on print format , or frappe db sql not working

I want to use ascending sql on print format but frappe.db.sql not work in print format … how can i use ascending sql

What are you trying to achieve? Please mention more details.

e.g.

frappe.db.sql("select name from `tabCustomer` order by name asc")

But Print Format dont support at frappe.db.sql show error

print format has limited access to all python functions basically because it Jinja templating .
if you want to add it I think the best is to fetch the data from a field or custom field which get its data from the db command .