[SQL-CVS] r509 - in home/phd/SQLObject/inheritance: docs examples
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2005-01-05 11:43:13
|
Author: phd Date: 2005-01-05 11:43:06 +0000 (Wed, 05 Jan 2005) New Revision: 509 Modified: home/phd/SQLObject/inheritance/docs/SQLObject.txt home/phd/SQLObject/inheritance/docs/build home/phd/SQLObject/inheritance/examples/personaddress.py Log: Merged patches from revisions 502:508 Modified: home/phd/SQLObject/inheritance/docs/SQLObject.txt =================================================================== --- home/phd/SQLObject/inheritance/docs/SQLObject.txt 2005-01-03 19:29:15 UTC (rev 508) +++ home/phd/SQLObject/inheritance/docs/SQLObject.txt 2005-01-05 11:43:06 UTC (rev 509) @@ -275,7 +275,20 @@ with non-database properties (there's no benefit, but it helps hide the difference between database and non-database attributes). +Lazy Updates +------------ +By default SQLObject sends an ``UPDATE`` to the database for every +attribute you set, or everytime you call ``.set()``. If you want to +avoid this many updates, add ``_lazyUpdate = True`` to your class +definition. Then updates will only be written to the database when +you call ``inst.syncUpdate()`` or ``obj.sync()``: ``.sync()`` also +refetches the data from the database, which ``.syncUpdate()`` does not +do. + +When enabled instances will have a property ``dirty``, which indicates +if there are pending updates. Inserts are still done immediately. + One-to-Many Relationships ------------------------- @@ -455,6 +468,18 @@ .. _`SQLBuilder documentation`: SQLBuilder.html +Select-By Method +~~~~~~~~~~~~~~~~ + +An alternative to ``.select`` is ``.selectBy``. It works like: + +.. raw:: html + :file: ../examples/snippets/person-select-by.html + +Each keyword argument is a column, and all the keyword arguments +are ANDed together. The return value is a `SelectResult`, so you +can slice it, count it, order it, etc. + Customizing the Objects ----------------------- @@ -1083,7 +1108,7 @@ column -- strings can go in integer columns, dates in integers, etc. SQLiteConnection doesn't support `automatic class generation`_ and -SQLite does not support `runtime column changes`_ or transactions_. +SQLite does not support `runtime column changes`_. SQLite may have concurrency issues, depending on your usage in a multi-threaded environment. Modified: home/phd/SQLObject/inheritance/docs/build =================================================================== --- home/phd/SQLObject/inheritance/docs/build 2005-01-03 19:29:15 UTC (rev 508) +++ home/phd/SQLObject/inheritance/docs/build 2005-01-05 11:43:06 UTC (rev 509) @@ -1,7 +1,7 @@ #!/bin/sh -pushd ../examples > /dev/null +cd ../examples ./examplestripper.py -popd > /dev/null +cd ../docs buildhtml.py --report=2 --prune=.svn --prune=europython --silent --no-toc-backlinks Modified: home/phd/SQLObject/inheritance/examples/personaddress.py =================================================================== --- home/phd/SQLObject/inheritance/examples/personaddress.py 2005-01-03 19:29:15 UTC (rev 508) +++ home/phd/SQLObject/inheritance/examples/personaddress.py 2005-01-05 11:43:06 UTC (rev 509) @@ -56,6 +56,11 @@ # SELECT person.id FROM person WHERE person.first_name = 'John'; ## end snippet +## Snippet "person-select-by" +peeps = Person.selectBy(firstName="John", lastName="Doe") +## end snippet +list(peeps) + ## Snippet "person-select2" peeps = Person.select( AND(Address.q.personID == Person.q.id, |