This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SQLObject development repository".
The branch, master has been updated
via e70c2760b962d00fc468afcd7c8224057d9c6b00 (commit)
from d1177e2f2833a0a5d5f389a25ee7f9af020a9069 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceforge.net/p/sqlobject/sqlobject/ci/e70c2760b962d00fc468afcd7c8224057d9c6b00
commit e70c2760b962d00fc468afcd7c8224057d9c6b00
Author: Oleg Broytman <ph...@ph...>
Date: Tue May 23 23:49:11 2017 +0300
Add example to ANNOUNCE.rst
[skip ci]
diff --git a/ANNOUNCE.rst b/ANNOUNCE.rst
index 2bf4927..3d68fe4 100644
--- a/ANNOUNCE.rst
+++ b/ANNOUNCE.rst
@@ -58,3 +58,43 @@ https://pypi.python.org/pypi/SQLObject/3.4.0a0.dev20170507
News and changes:
http://sqlobject.org/News.html
+
+
+Example
+=======
+
+Create a simple class that wraps a table::
+
+ >>> from sqlobject import *
+ >>>
+ >>> sqlhub.processConnection = connectionForURI('sqlite:/:memory:')
+ >>>
+ >>> class Person(SQLObject):
+ ... fname = StringCol()
+ ... mi = StringCol(length=1, default=None)
+ ... lname = StringCol()
+ ...
+ >>> Person.createTable()
+
+Use the object::
+
+ >>> p = Person(fname="John", lname="Doe")
+ >>> p
+ <Person 1 fname='John' mi=None lname='Doe'>
+ >>> p.fname
+ 'John'
+ >>> p.mi = 'Q'
+ >>> p2 = Person.get(1)
+ >>> p2
+ <Person 1 fname='John' mi='Q' lname='Doe'>
+ >>> p is p2
+ True
+
+Queries::
+
+ >>> p3 = Person.selectBy(lname="Doe")[0]
+ >>> p3
+ <Person 1 fname='John' mi='Q' lname='Doe'>
+ >>> pc = Person.select(Person.q.lname=="Doe").count()
+ >>> pc
+ 1
diff --git a/docs/index.rst b/docs/index.rst
index 25c07dd..f1f1ece 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -68,6 +68,14 @@ Here's how you'd use the object::
>>> p is p2
True
+Queries::
+
+ >>> p3 = Person.selectBy(lname="Doe")[0]
+ >>> p3
+ <Person 1 fname='John' mi='Q' lname='Doe'>
+ >>> pc = Person.select(Person.q.lname=="Doe").count()
+ >>> pc
+ 1
Indices and tables
==================
-----------------------------------------------------------------------
Summary of changes:
ANNOUNCE.rst | 40 ++++++++++++++++++++++++++++++++++++++++
docs/index.rst | 8 ++++++++
2 files changed, 48 insertions(+)
hooks/post-receive
--
SQLObject development repository
|