Source code:
# list of Belgian cities and number of inhabitants from lino.apps.contacts.contacts_demo import startup from lino.apps.contacts.contacts_tables import Nation sess=startup() be=sess.query(Nation).peek("be") qry=be.cities("name inhabitants",orderBy="inhabitants") qry.show(width=50) print print qry.getSqlSelect()
Output:
Cities (nation=Belgium) ======================= name |inhabitan |ts ----------------------------------------+--------- Raeren |9933 Kelmis |10175 Eupen |17872 Verviers |52739 Mons |90992 Brugge |116848 Liège |185608 Charleroi |200983 Bruxelles |1004239 SELECT nation_id, id, name, inhabitants FROM Cities WHERE nation_id = 'be' ORDER BY inhabitants