diff options
author | Jonathan Ellis <jbellis@gmail.com> | 2007-01-23 06:30:17 +0000 |
---|---|---|
committer | Jonathan Ellis <jbellis@gmail.com> | 2007-01-23 06:30:17 +0000 |
commit | a06cf30cfe1b2a771800429430818ab35dbf37f6 (patch) | |
tree | e08b6ec432b0419a8355fc2e0f984bc23409b4a3 /lib/sqlalchemy/ext/sqlsoup.py | |
parent | f68e1f45022b04aeaa0f88dee4085412a3cd8d2d (diff) | |
download | sqlalchemy-a06cf30cfe1b2a771800429430818ab35dbf37f6.tar.gz |
justify text
Diffstat (limited to 'lib/sqlalchemy/ext/sqlsoup.py')
-rw-r--r-- | lib/sqlalchemy/ext/sqlsoup.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/sqlalchemy/ext/sqlsoup.py b/lib/sqlalchemy/ext/sqlsoup.py index 390a2c16d..0f644b02f 100644 --- a/lib/sqlalchemy/ext/sqlsoup.py +++ b/lib/sqlalchemy/ext/sqlsoup.py @@ -106,18 +106,19 @@ To finish covering the basics, let's insert a new loan, then delete it: >>> db.delete(loan) >>> db.flush() -You can also delete rows that have not been loaded as objects. Let's do our insert/delete cycle once more, -this time using the loans table's delete method. (For SQLAlchemy experts: -note that no flush() call is required since this -delete acts at the SQL level, not at the Mapper level.) The same where-clause construction rules -apply here as to the select methods. +You can also delete rows that have not been loaded as objects. Let's do our +insert/delete cycle once more, this time using the loans table's delete +method. (For SQLAlchemy experts: note that no flush() call is required since +this delete acts at the SQL level, not at the Mapper level.) The same +where-clause construction rules apply here as to the select methods. >>> db.loans.insert(book_id=book_id, user_name=user.name) MappedLoans(book_id=2,user_name='Bhargan Basepair',loan_date=None) >>> db.flush() >>> db.loans.delete(db.loans.c.book_id==2) -You can similarly update multiple rows at once. This will change the book_id to 1 in all loans whose book_id is 2: +You can similarly update multiple rows at once. This will change the book_id +to 1 in all loans whose book_id is 2: >>> db.loans.update(db.loans.c.book_id==2, book_id=1) >>> db.loans.select_by(db.loans.c.book_id==1) @@ -159,8 +160,8 @@ to disambiguate columns with their table name: >>> db.with_labels(join1).c.keys() ['users_name', 'users_email', 'users_password', 'users_classname', 'users_admin', 'loans_book_id', 'loans_user_name', 'loans_loan_date'] -You can disambiguate just one table in a join by applying labels to that table, -and joining on the returned object: +You can also join directly to a labeled object: + >>> labeled_loans = db.with_labels(db.loans) >>> db.join(db.users, labeled_loans, isouter=True).c.keys() ['name', 'email', 'password', 'classname', 'admin', 'loans_book_id', 'loans_user_name', 'loans_loan_date'] |