summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-07-28 15:50:05 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-07-28 15:50:05 -0400
commit27913554a85c308d81e6c018669d0246ceecc639 (patch)
tree191305298ce66000c95c9c8fec1e27350f0d206e /examples
parent90571b3a3a4eca329ec14e9bd142ad2b96526d99 (diff)
downloadsqlalchemy-27913554a85c308d81e6c018669d0246ceecc639.tar.gz
trailing whitespace bonanza
Diffstat (limited to 'examples')
-rw-r--r--examples/adjacency_list/adjacency_list.py8
-rw-r--r--examples/large_collection/large_collection.py18
-rw-r--r--examples/postgis/__init__.py6
-rw-r--r--examples/sharding/attribute_shard.py34
-rw-r--r--examples/versioning/__init__.py2
5 files changed, 34 insertions, 34 deletions
diff --git a/examples/adjacency_list/adjacency_list.py b/examples/adjacency_list/adjacency_list.py
index 91c6e1ccf..1020cc57d 100644
--- a/examples/adjacency_list/adjacency_list.py
+++ b/examples/adjacency_list/adjacency_list.py
@@ -15,13 +15,13 @@ class TreeNode(Base):
parent_id = Column(Integer, ForeignKey(id))
name = Column(String(50), nullable=False)
- children = relationship("TreeNode",
+ children = relationship("TreeNode",
# cascade deletions
cascade="all",
# many to one + adjacency list - remote_side
- # is required to reference the 'remote'
+ # is required to reference the 'remote'
# column in the join condition.
backref=backref("parent", remote_side=id),
@@ -46,7 +46,7 @@ class TreeNode(Base):
return " " * _indent + repr(self) + \
"\n" + \
"".join([
- c.dump(_indent +1)
+ c.dump(_indent +1)
for c in self.children.values()]
)
@@ -107,7 +107,7 @@ if __name__ == '__main__':
"selecting tree on root, using eager loading to join four levels deep.")
session.expunge_all()
node = session.query(TreeNode).\
- options(joinedload_all("children", "children",
+ options(joinedload_all("children", "children",
"children", "children")).\
filter(TreeNode.name=="rootnode").\
first()
diff --git a/examples/large_collection/large_collection.py b/examples/large_collection/large_collection.py
index 20c3b5218..b3aa5299d 100644
--- a/examples/large_collection/large_collection.py
+++ b/examples/large_collection/large_collection.py
@@ -6,7 +6,7 @@ from sqlalchemy.orm import (mapper, relationship, sessionmaker)
meta = MetaData()
-org_table = Table('organizations', meta,
+org_table = Table('organizations', meta,
Column('org_id', Integer, primary_key=True),
Column('org_name', String(50), nullable=False, key='name'),
mysql_engine='InnoDB')
@@ -27,20 +27,20 @@ class Member(object):
self.name = name
mapper(Organization, org_table, properties = {
- 'members' : relationship(Member,
+ 'members' : relationship(Member,
# Organization.members will be a Query object - no loading
# of the entire collection occurs unless requested
- lazy="dynamic",
+ lazy="dynamic",
- # Member objects "belong" to their parent, are deleted when
+ # Member objects "belong" to their parent, are deleted when
# removed from the collection
cascade="all, delete-orphan",
# "delete, delete-orphan" cascade does not load in objects on delete,
# allows ON DELETE CASCADE to handle it.
- # this only works with a database that supports ON DELETE CASCADE -
+ # this only works with a database that supports ON DELETE CASCADE -
# *not* sqlite or MySQL with MyISAM
- passive_deletes=True,
+ passive_deletes=True,
)
})
@@ -65,7 +65,7 @@ if __name__ == '__main__':
print "-------------------------\nflush one - save org + 3 members\n"
sess.commit()
- # the 'members' collection is a Query. it issues
+ # the 'members' collection is a Query. it issues
# SQL as needed to load subsets of the collection.
print "-------------------------\nload subset of members\n"
members = org.members.filter(member_table.c.name.like('%member t%')).all()
@@ -80,8 +80,8 @@ if __name__ == '__main__':
print "-------------------------\nflush two - save 3 more members\n"
sess.commit()
- # delete the object. Using ON DELETE CASCADE
- # SQL is only emitted for the head row - the Member rows
+ # delete the object. Using ON DELETE CASCADE
+ # SQL is only emitted for the head row - the Member rows
# disappear automatically without the need for additional SQL.
sess.delete(org)
print "-------------------------\nflush three - delete org, delete members in one statement\n"
diff --git a/examples/postgis/__init__.py b/examples/postgis/__init__.py
index 3eb4ed3bc..e8f10e59d 100644
--- a/examples/postgis/__init__.py
+++ b/examples/postgis/__init__.py
@@ -1,11 +1,11 @@
-"""A naive example illustrating techniques to help
+"""A naive example illustrating techniques to help
embed PostGIS functionality.
This example was originally developed in the hopes that it would be extrapolated into a comprehensive PostGIS integration layer. We are pleased to announce that this has come to fruition as `GeoAlchemy <http://www.geoalchemy.org/>`_.
The example illustrates:
-* a DDL extension which allows CREATE/DROP to work in
+* a DDL extension which allows CREATE/DROP to work in
conjunction with AddGeometryColumn/DropGeometryColumn
* a Geometry type, as well as a few subtypes, which
@@ -24,7 +24,7 @@ The example illustrates:
* a standalone operator example.
The implementation is limited to only public, well known
-and simple to use extension points.
+and simple to use extension points.
E.g.::
diff --git a/examples/sharding/attribute_shard.py b/examples/sharding/attribute_shard.py
index 5831d7ee3..410346838 100644
--- a/examples/sharding/attribute_shard.py
+++ b/examples/sharding/attribute_shard.py
@@ -9,7 +9,7 @@ from sqlalchemy.sql import operators, visitors
import datetime
# step 2. databases.
-# db1 is used for id generation. The "pool_threadlocal"
+# db1 is used for id generation. The "pool_threadlocal"
# causes the id_generator() to use the same connection as that
# of an ongoing transaction within db1.
echo = True
@@ -36,7 +36,7 @@ meta = MetaData()
# we need a way to create identifiers which are unique across all
# databases. one easy way would be to just use a composite primary key, where one
-# value is the shard id. but here, we'll show something more "generic", an
+# value is the shard id. but here, we'll show something more "generic", an
# id generation function. we'll use a simplistic "id table" stored in database
# #1. Any other method will do just as well; UUID, hilo, application-specific, etc.
@@ -53,7 +53,7 @@ def id_generator(ctx):
# table setup. we'll store a lead table of continents/cities,
# and a secondary table storing locations.
# a particular row will be placed in the database whose shard id corresponds to the
-# 'continent'. in this setup, secondary rows in 'weather_reports' will
+# 'continent'. in this setup, secondary rows in 'weather_reports' will
# be placed in the same DB as that of the parent, but this can be changed
# if you're willing to write more complex sharding functions.
@@ -81,7 +81,7 @@ db1.execute(ids.insert(), nextid=1)
# step 5. define sharding functions.
-# we'll use a straight mapping of a particular set of "country"
+# we'll use a straight mapping of a particular set of "country"
# attributes to shard id.
shard_lookup = {
'North America':'north_america',
@@ -94,7 +94,7 @@ def shard_chooser(mapper, instance, clause=None):
"""shard chooser.
looks at the given instance and returns a shard id
- note that we need to define conditions for
+ note that we need to define conditions for
the WeatherLocation class, as well as our secondary Report class which will
point back to its WeatherLocation via its 'location' attribute.
@@ -109,8 +109,8 @@ def id_chooser(query, ident):
given a primary key, returns a list of shards
to search. here, we don't have any particular information from a
- pk so we just return all shard ids. often, youd want to do some
- kind of round-robin strategy here so that requests are evenly
+ pk so we just return all shard ids. often, youd want to do some
+ kind of round-robin strategy here so that requests are evenly
distributed among DBs.
"""
@@ -132,8 +132,8 @@ def query_chooser(query):
# "shares_lineage()" returns True if both columns refer to the same
# statement column, adjusting for any annotations present.
# (an annotation is an internal clone of a Column object
- # and occur when using ORM-mapped attributes like
- # "WeatherLocation.continent"). A simpler comparison, though less accurate,
+ # and occur when using ORM-mapped attributes like
+ # "WeatherLocation.continent"). A simpler comparison, though less accurate,
# would be "column.key == 'continent'".
if column.shares_lineage(weather_locations.c.continent):
if operator == operators.eq:
@@ -150,7 +150,7 @@ def _get_query_comparisons(query):
"""Search an orm.Query object for binary expressions.
Returns expressions which match a Column against one or more
- literal values as a list of tuples of the form
+ literal values as a list of tuples of the form
(column, operator, values). "values" is a single value
or tuple of values depending on the operator.
@@ -160,15 +160,15 @@ def _get_query_comparisons(query):
comparisons = []
def visit_bindparam(bind):
- # visit a bind parameter.
+ # visit a bind parameter.
# check in _params for it first
if bind.key in query._params:
value = query._params[bind.key]
elif bind.callable:
- # some ORM functions (lazy loading)
- # place the bind's value as a
- # callable for deferred evaulation.
+ # some ORM functions (lazy loading)
+ # place the bind's value as a
+ # callable for deferred evaulation.
value = bind.callable()
else:
# just use .value
@@ -185,7 +185,7 @@ def _get_query_comparisons(query):
binary.operator == operators.in_op and \
hasattr(binary.right, 'clauses'):
comparisons.append(
- (binary.left, binary.operator,
+ (binary.left, binary.operator,
tuple(binds[bind] for bind in binary.right.clauses)
)
)
@@ -213,8 +213,8 @@ def _get_query_comparisons(query):
# further configure create_session to use these functions
create_session.configure(
- shard_chooser=shard_chooser,
- id_chooser=id_chooser,
+ shard_chooser=shard_chooser,
+ id_chooser=id_chooser,
query_chooser=query_chooser
)
diff --git a/examples/versioning/__init__.py b/examples/versioning/__init__.py
index 990900940..72b5afe96 100644
--- a/examples/versioning/__init__.py
+++ b/examples/versioning/__init__.py
@@ -9,7 +9,7 @@ Usage is illustrated via a unit test module ``test_versioning.py``, which can
be run via nose::
cd examples/versioning
- nosetests -v
+ nosetests -v
A fragment of example usage, using declarative::