~free.ekanayaka/storm/any-expr

« back to all changes in this revision

Viewing changes to tests/tutorial.txt

  • Committer: Thomas Hervé
  • Date: 2008-09-02 11:45:25 UTC
  • mfrom: (262.1.3 262607-join-none)
  • Revision ID: thomas@canonical.com-20080902114525-82j6grtlc71vwb8b
Merge 262607-join-none [f=262607] [r=niemeyer,jamesh]

Make LEFT JOIN works with empty objects in the joined tables and constraints
on the keys (like allow_none=False).

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
 
84
84
{{{#!python
85
85
>>> store.add(joe)
86
 
<...Person object at 0x...>
 
86
<Person object at 0x...>
87
87
 
88
88
>>> print "%r, %r" % (joe.id, joe.name)
89
89
None, u'Joe Johnes'
166
166
>>> mary = Person()
167
167
>>> mary.name = u"Mary Margaret"
168
168
>>> store.add(mary)
169
 
<...Person object at 0x...>
 
169
<Person object at 0x...>
170
170
 
171
171
>>> print "%r, %r" % (mary.id, mary.name)
172
172
None, u'Mary Margaret'
539
539
 
540
540
{{{#!python
541
541
>>> store.get(CompanyAccountant, (sweets.id, frank.id))
542
 
<...CompanyAccountant object at 0x...>
 
542
<CompanyAccountant object at 0x...>
543
543
 
544
544
}}}
545
545
 
618
618
{{{#!python
619
619
>>> laura = Accountant(u"Laura Montgomery")
620
620
>>> store.add(laura)
621
 
<...Accountant ...>
 
621
<Accountant ...>
622
622
 
623
623
>>> subselect = Select(CompanyAccountant.accountant_id, distinct=True)
624
624
>>> result = store.find(Accountant, Not(Accountant.id.is_in(subselect)))
897
897
>>> list(result)
898
898
[...] EXECUTE: u'SELECT employee.company_id, employee.id, employee.name, "...".company_id, "...".id, "...".name FROM employee, employee AS "..." WHERE employee.company_id = "...".company_id AND employee.id > "...".id', ()
899
899
[...] DONE
900
 
[(<...Employee object at ...>, <...Employee object at ...>)]
 
900
[(<Employee object at ...>, <Employee object at ...>)]
901
901
 
902
902
>>> debug(False)
903
903
>>> list(result)
904
 
[(<...Employee object at ...>, <...Employee object at ...>)]
 
904
[(<Employee object at ...>, <Employee object at ...>)]
905
905
 
906
906
}}}
907
907