Here's my issue: 3 tables

CREATE TABLE accounts (
    account_id serial PRIMARY KEY,
name varchar(16) NOT NULL UNIQUE,
);
CREATE TABLE transactions (
    transaction_id serial PRIMARY KEY,
);
CREATE TABLE entries (
    entry_id serial PRIMARY KEY,
    account_id integer NOT NULL REFERENCES accounts,
    transaction_id integer NOT NULL REFERENCES transactions,
);

A Transaction links 1 Account to another one with Entries:

    mapper(Account, table_accounts)
    mapper(Transaction, table_transactions)
    mapper(Entry, table_entries, properties = dict(
        account = relation(Account, uselist=False,
backref=backref('entries', lazy=True)),
        transaction = relation(Transaction, uselist=False,
backref=backref('entries', lazy=False, join_depth=3)),
    ))

I just want to retrieve in one SELECT all tx engaged and the account
of each entry:
acc =
session.query(Account).options(eagerload_all('entries.transaction.entries.account')).get(7)
acc.entries[1].transaction.entries[1].account.name <== execute a new
SELECT to retrieve all entries of this account (I just want
account.name


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to