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 e647b7ae7af1bd21fd93da83187ca1250054e454 (commit)
via 71aba5018d2b0f853c305faa66bec88540ec367f (commit)
via a6e8fa8dadd2bd0a72297631cb9b3b33e64a97a0 (commit)
via b7acfd9247fd748c0a8598544180f9523373c6ea (commit)
via 97c84567cf6f0138a51c78d02912c666f7f719b5 (commit)
from 682d1e95bbefaa540483d23d6a849eab6e42cf38 (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/e647b7ae7af1bd21fd93da83187ca1250054e454
commit e647b7ae7af1bd21fd93da83187ca1250054e454
Merge: 71aba50 97c8456
Author: Oleg Broytman <ph...@ph...>
Date: Thu Feb 26 22:16:40 2015 +0300
Merge pull request #101 from drnlm/py34_protect_compat_flake8
Flag python2 compatibility definitions for flake8
http://sourceforge.net/p/sqlobject/sqlobject/ci/71aba5018d2b0f853c305faa66bec88540ec367f
commit 71aba5018d2b0f853c305faa66bec88540ec367f
Merge: 682d1e9 a6e8fa8
Author: Oleg Broytman <ph...@ph...>
Date: Thu Feb 26 22:15:13 2015 +0300
Merge pull request #100 from drnlm/update_doctests
Update doctests
http://sourceforge.net/p/sqlobject/sqlobject/ci/a6e8fa8dadd2bd0a72297631cb9b3b33e64a97a0
commit a6e8fa8dadd2bd0a72297631cb9b3b33e64a97a0
Author: Neil <drn...@gm...>
Date: Thu Feb 26 12:02:37 2015 +0200
Rework select documention to move selections involving joins after the discussion on relationships
diff --git a/docs/SQLObject.txt b/docs/SQLObject.txt
index 2d7057e..d4bb0b4 100644
--- a/docs/SQLObject.txt
+++ b/docs/SQLObject.txt
@@ -355,16 +355,19 @@ that's generated)::
1/COMMIT : auto
[<Person 1 firstName='John' middleInitial='Q' lastName='Doe'>]
-This example returns everyone with the first name John. An expression
-could be more complicated as well, like::
+This example returns everyone with the first name John.
+
+Queries can be more complex::
>>> peeps = Person.select(
- ... AND(Address.q.personID == Person.q.id,
- ... Address.q.zip.startswith('504')))
+ ... OR(Person.q.firstName == "John",
+ ... LIKE(Person.q.lastName, "%Hope%")))
>>> list(peeps)
- 1/Select : SELECT person.id, person.first_name, person.middle_initial, person.last_name FROM person, address WHERE ((address.person_id = person.id) AND (address.zip LIKE '504%'))
+ 1/Select : SELECT person.id, person.first_name, person.middle_initial, person.last_name FROM person WHERE (((person.first_name) = ('John')) OR (person.last_name LIKE ('%Hope%')))
+ 1/QueryR : SELECT person.id, person.first_name, person.middle_initial, person.last_name FROM person WHERE (((person.first_name) = ('John')) OR (person.last_name LIKE ('%Hope%')))
1/COMMIT : auto
- []
+ [<Person 1 firstName='John' middleInitial='Q' lastName='Doe'>, <Person 2 firstName='Robert' middleInitial='Q' lastName='Hope Jr.'>]
+
You'll note that classes have an attribute ``q``, which gives access
to special objects for constructing query clauses. All attributes
@@ -372,15 +375,10 @@ under ``q`` refer to column names and if you construct logical
statements with these it'll give you the SQL for that statement. You
can also create your SQL more manually::
- >>> Person._connection.debug = False # Needed for doctests
- >>> peeps = Person.select("""address.person_id = person.id AND
- ... address.zip LIKE '504%'""",
- ... clauseTables=['address'])
+ >>> Person._connection.debug = False # Need for doctests
+ >>> peeps = Person.select("""person.first_name = 'John' AND
+ ... person.last_name LIKE 'D%'""")
-Note that you have to use ``clauseTables`` if you use tables besides
-the one you are selecting from. If you use the ``q`` attributes
-SQLObject will automatically figure out what extra classes you might
-have used.
You should use `MyClass.sqlrepr` to quote any values you use if you
create SQL manually (quoting is automatic if you use ``q``).
@@ -696,6 +694,38 @@ keyword argument to override this). Its use:
>>> Role.byName('admin')
<Role 1 name='admin'>
+
+Selecting Objects Using Relationships
+-------------------------------------
+
+An select expression can refer to multiple classes, like::
+
+ >>> Person._connection.debug = False # Needed for doctests
+ >>> peeps = Person.select(
+ ... AND(Address.q.personID == Person.q.id,
+ ... Address.q.zip.startswith('504')))
+ >>> list(peeps)
+ []
+ >>> peeps = Person.select(
+ ... AND(Address.q.personID == Person.q.id,
+ ... Address.q.zip.startswith('554')))
+ >>> list(peeps)
+ [<Person 2 firstName='Robert' middleInitial='Q' lastName='Hope Jr.'>]
+
+
+It is also possible to use the ``q`` attribute when constructing complex
+queries, like::
+
+ >>> Person._connection.debug = False # Needed for doctests
+ >>> peeps = Person.select("""address.person_id = person.id AND
+ ... address.zip LIKE '504%'""",
+ ... clauseTables=['address'])
+
+Note that you have to use ``clauseTables`` if you use tables besides
+the one you are selecting from. If you use the ``q`` attributes
+SQLObject will automatically figure out what extra classes you might
+have used.
+
Class sqlmeta
-------------
http://sourceforge.net/p/sqlobject/sqlobject/ci/b7acfd9247fd748c0a8598544180f9523373c6ea
commit b7acfd9247fd748c0a8598544180f9523373c6ea
Author: Neil <drn...@gm...>
Date: Thu Feb 26 12:07:17 2015 +0200
Update doctests to reflect correct order after d8cc22debdd
diff --git a/docs/SQLObject.txt b/docs/SQLObject.txt
index 42663e9..2d7057e 100644
--- a/docs/SQLObject.txt
+++ b/docs/SQLObject.txt
@@ -301,8 +301,8 @@ same actions with the SQL that is sent, along with some commentary::
>>> # This will make SQLObject print out the SQL it executes:
>>> Person._connection.debug = True
>>> p = Person(firstName='Bob', lastName='Hope')
- 1/QueryIns: INSERT INTO person (last_name, middle_initial, first_name) VALUES ('Hope', NULL, 'Bob')
- 1/QueryR : INSERT INTO person (last_name, middle_initial, first_name) VALUES ('Hope', NULL, 'Bob')
+ 1/QueryIns: INSERT INTO person (first_name, middle_initial, last_name) VALUES ('Bob', NULL, 'Hope')
+ 1/QueryR : INSERT INTO person (first_name, middle_initial, last_name) VALUES ('Bob', NULL, 'Hope')
1/COMMIT : auto
1/QueryOne: SELECT first_name, middle_initial, last_name FROM person WHERE ((person.id) = (2))
1/QueryR : SELECT first_name, middle_initial, last_name FROM person WHERE ((person.id) = (2))
http://sourceforge.net/p/sqlobject/sqlobject/ci/97c84567cf6f0138a51c78d02912c666f7f719b5
commit 97c84567cf6f0138a51c78d02912c666f7f719b5
Author: Neil <drn...@gm...>
Date: Thu Feb 26 11:03:57 2015 +0200
Flag python2 compatibility definitions for flake8
diff --git a/sqlobject/compat.py b/sqlobject/compat.py
index e975486..fe7b8d4 100644
--- a/sqlobject/compat.py
+++ b/sqlobject/compat.py
@@ -18,10 +18,11 @@ def with_metaclass(meta, *bases):
# Compatability definitions (inspired by six)
if sys.version_info[0] < 3:
- string_type = basestring
- unicode_type = unicode
+ # disable flake8 checks on python 3
+ string_type = basestring # noqa
+ unicode_type = unicode # noqa
class_types = (type, types.ClassType)
- buffer_type = buffer
+ buffer_type = buffer # noqa
else:
string_type = str
unicode_type = str
diff --git a/sqlobject/converters.py b/sqlobject/converters.py
index 8757e40..1383c41 100644
--- a/sqlobject/converters.py
+++ b/sqlobject/converters.py
@@ -96,7 +96,8 @@ def StringLikeConverter(value, db):
registerConverter(str, StringLikeConverter)
if sys.version_info[0] < 3:
- registerConverter(unicode, StringLikeConverter)
+ # noqa for flake8 & python3
+ registerConverter(unicode, StringLikeConverter) # noqa
registerConverter(array, StringLikeConverter)
if sys.version_info[0] < 3:
registerConverter(buffer_type, StringLikeConverter)
@@ -114,7 +115,8 @@ def LongConverter(value, db):
return str(value)
if sys.version_info[0] < 3:
- registerConverter(long, LongConverter)
+ # noqa for flake8 & python3
+ registerConverter(long, LongConverter) # noqa
if NumericType:
registerConverter(NumericType, IntConverter)
-----------------------------------------------------------------------
Summary of changes:
docs/SQLObject.txt | 62 ++++++++++++++++++++++++++++++++++------------
sqlobject/compat.py | 7 +++--
sqlobject/converters.py | 6 +++-
3 files changed, 54 insertions(+), 21 deletions(-)
hooks/post-receive
--
SQLObject development repository
|