Splitting out joined table data
You can use itertools.groupby to group the items by order number.
Don't use is to compare numbers. is checks object identity and the same number can be represented by different objects:

&gt;&gt;&gt; a=1234
&gt;&gt;&gt; b=1234
&gt;&gt;&gt; a is b
False
&gt;&gt;&gt; a=12
&gt;&gt;&gt; b=12
&gt;&gt;&gt; a is b
True                

Checking if len(orders) &gt; 0 before the for loop is redundant. If the list is empty the loop won't run even once.


Revised code:

from itertools import groupby
from operator import itemgetter

# Fetch my orders
orders = repo.get_orders_for(self._customer[0])

for order_number, items in groupby(orders, key=itemgetter(0)):
    print("Order #{}".format(order_number))
    for _, quantity, pid in items:
        print("    Product #{}, ordered x{}".format(pid, quantity))