summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMichael Trier <mtrier@gmail.com>2009-07-27 02:12:15 +0000
committerMichael Trier <mtrier@gmail.com>2009-07-27 02:12:15 +0000
commit34aaabf7ea18af8e8a7721238b5bba00e3532c4c (patch)
treee1073f8dc9a4b1b643e79a658b00a09c7da4d569 /examples
parent73554aa4fa60459cd949ca8ac690ac0746a7c445 (diff)
downloadsqlalchemy-34aaabf7ea18af8e8a7721238b5bba00e3532c4c.tar.gz
Added in Examples into the test suite so they get exercised regularly. Cleaned up some deprecation warnings in the examples.
Diffstat (limited to 'examples')
-rw-r--r--examples/__init__.py0
-rw-r--r--examples/adjacencytree/__init__.py0
-rw-r--r--examples/association/__init__.py0
-rw-r--r--examples/collections/__init__.py0
-rw-r--r--examples/custom_attributes/__init__.py0
-rw-r--r--examples/derived_attributes/__init__.py0
-rw-r--r--examples/dynamic_dict/__init__.py0
-rw-r--r--examples/elementtree/__init__.py0
-rw-r--r--examples/elementtree/pickle.py7
-rw-r--r--examples/graphs/__init__.py0
-rw-r--r--examples/nested_sets/__init__.py0
-rw-r--r--examples/pickle/__init__.py0
-rw-r--r--examples/pickle/custom_pickler.py8
-rw-r--r--examples/poly_assoc/__init__.py0
-rw-r--r--examples/polymorph/__init__.py0
-rw-r--r--examples/polymorph/polymorph.py2
-rw-r--r--examples/postgis/__init__.py0
-rw-r--r--examples/query_caching/__init__.py0
-rw-r--r--examples/sharding/__init__.py0
-rw-r--r--examples/vertical/__init__.py0
20 files changed, 14 insertions, 3 deletions
diff --git a/examples/__init__.py b/examples/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/__init__.py
diff --git a/examples/adjacencytree/__init__.py b/examples/adjacencytree/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/adjacencytree/__init__.py
diff --git a/examples/association/__init__.py b/examples/association/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/association/__init__.py
diff --git a/examples/collections/__init__.py b/examples/collections/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/collections/__init__.py
diff --git a/examples/custom_attributes/__init__.py b/examples/custom_attributes/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/custom_attributes/__init__.py
diff --git a/examples/derived_attributes/__init__.py b/examples/derived_attributes/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/derived_attributes/__init__.py
diff --git a/examples/dynamic_dict/__init__.py b/examples/dynamic_dict/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/dynamic_dict/__init__.py
diff --git a/examples/elementtree/__init__.py b/examples/elementtree/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/elementtree/__init__.py
diff --git a/examples/elementtree/pickle.py b/examples/elementtree/pickle.py
index 220bb2295..2176512cf 100644
--- a/examples/elementtree/pickle.py
+++ b/examples/elementtree/pickle.py
@@ -26,12 +26,17 @@ from xml.etree import ElementTree
engine = create_engine('sqlite://')
meta = MetaData(engine)
+# setup a comparator for the PickleType since it's a mutable
+# element.
+def are_elements_equal(x, y):
+ return x == y
+
# stores a top level record of an XML document.
# the "element" column will store the ElementTree document as a BLOB.
documents = Table('documents', meta,
Column('document_id', Integer, primary_key=True),
Column('filename', String(30), unique=True),
- Column('element', PickleType)
+ Column('element', PickleType(comparator=are_elements_equal))
)
meta.create_all()
diff --git a/examples/graphs/__init__.py b/examples/graphs/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/graphs/__init__.py
diff --git a/examples/nested_sets/__init__.py b/examples/nested_sets/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/nested_sets/__init__.py
diff --git a/examples/pickle/__init__.py b/examples/pickle/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/pickle/__init__.py
diff --git a/examples/pickle/custom_pickler.py b/examples/pickle/custom_pickler.py
index 79a8b3fa3..a02b708e5 100644
--- a/examples/pickle/custom_pickler.py
+++ b/examples/pickle/custom_pickler.py
@@ -68,7 +68,13 @@ class Foo(object):
class Bar(object):
def __init__(self, value):
self.data = value
-
+
+ def __eq__(self, other):
+ if not other is None:
+ return self.data == other.data
+ return NotImplemented
+
+
mapper(Foo, foo_table, extension=MyExt())
mapper(Bar, bar_table)
diff --git a/examples/poly_assoc/__init__.py b/examples/poly_assoc/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/poly_assoc/__init__.py
diff --git a/examples/polymorph/__init__.py b/examples/polymorph/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/polymorph/__init__.py
diff --git a/examples/polymorph/polymorph.py b/examples/polymorph/polymorph.py
index ea56ffed1..60ef98f57 100644
--- a/examples/polymorph/polymorph.py
+++ b/examples/polymorph/polymorph.py
@@ -66,7 +66,7 @@ mapper(Company, companies, properties={
'employees': relation(Person, lazy=False, backref='company', cascade="all, delete-orphan")
})
-session = create_session(echo_uow=False)
+session = create_session()
c = Company(name='company1')
c.employees.append(Manager(name='pointy haired boss', status='AAB', manager_name='manager1'))
c.employees.append(Engineer(name='dilbert', status='BBA', engineer_name='engineer1', primary_language='java'))
diff --git a/examples/postgis/__init__.py b/examples/postgis/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/postgis/__init__.py
diff --git a/examples/query_caching/__init__.py b/examples/query_caching/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/query_caching/__init__.py
diff --git a/examples/sharding/__init__.py b/examples/sharding/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/sharding/__init__.py
diff --git a/examples/vertical/__init__.py b/examples/vertical/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/vertical/__init__.py