Description of the tables are:
License: id, customer_id, product_id, expires_at
Customer: id, name
Product: id, name
I am querying like this:
result = session.\
            query(License.id, License.customer_id, License.product_id, License.status, License.expires_at,\
                  Customer.name,\
                  Product.name).\
            # some filtering on those columns (JOIN conditions)
            all()
I want the joined table to contain:
License.id, Customer.name, Product.name
Now the result I am getting is a list of KeyedTuples. How can I access the required columns from those? e.g. result[0].name gives only Customer.name, then how to get Product.name as well?
Use the label method:
Customer.name.label("Customer_name"),\
Product.name.label("Product_name").\
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With