13 years, 7 months ago
(2011-07-24 10:17:33 UTC)
#6
http://codereview.appspot.com/4248045/diff/15001/examples.rst
File examples.rst (right):
http://codereview.appspot.com/4248045/diff/15001/examples.rst#newcode28
examples.rst:28: >>> select.where = user.name == 'foo'
On 2011/07/24 10:07:41, nicoe wrote:
> I prefer select.where(*conditions) because it does not have the effect of
> polluting select with conditions.
I don't understand. Any way, select will need to handle the where clause.
http://codereview.appspot.com/4248045/diff/15001/examples.rst#newcode38
examples.rst:38: >>> join = Join('user_group')
On 2011/07/24 10:07:41, nicoe wrote:
> Maybe it would be intersting to be able to also add conditions when creating a
> join.
Not possible because you need to have the Join table to express the condition
http://codereview.appspot.com/4248045/diff/15001/examples.rst#newcode40
examples.rst:40: >>> select = (user + join).select(user.name, join.group)
On 2011/07/24 10:07:41, nicoe wrote:
> We should add test for the case where condition on join is not defined.
> It should probably raise an error when doing a '+'.
It is allow to make join without condition
13 years, 7 months ago
(2011-07-24 13:38:42 UTC)
#7
http://codereview.appspot.com/4248045/diff/15001/examples.rst
File examples.rst (right):
http://codereview.appspot.com/4248045/diff/15001/examples.rst#newcode28
examples.rst:28: >>> select.where = user.name == 'foo'
On 2011/07/24 10:17:33, ced wrote:
> On 2011/07/24 10:07:41, nicoe wrote:
> > I prefer select.where(*conditions) because it does not have the effect of
> > polluting select with conditions.
>
> I don't understand. Any way, select will need to handle the where clause.
Imagine this kind of code:
s = user.select()
for condition in conditions:
...
s.where = condition
...
at the end of the loop s.where will either have a value or not according to the
content of conditions. I would prefer that where is a method to prevent this.
http://codereview.appspot.com/4248045/diff/15001/examples.rst#newcode40
examples.rst:40: >>> select = (user + join).select(user.name, join.group)
On 2011/07/24 10:17:33, ced wrote:
> On 2011/07/24 10:07:41, nicoe wrote:
> > We should add test for the case where condition on join is not defined.
> > It should probably raise an error when doing a '+'.
>
> It is allow to make join without condition
Indeed
13 years, 7 months ago
(2011-07-24 13:46:01 UTC)
#8
http://codereview.appspot.com/4248045/diff/15001/examples.rst
File examples.rst (right):
http://codereview.appspot.com/4248045/diff/15001/examples.rst#newcode28
examples.rst:28: >>> select.where = user.name == 'foo'
On 2011/07/24 13:38:43, nicoe wrote:
> On 2011/07/24 10:17:33, ced wrote:
> > On 2011/07/24 10:07:41, nicoe wrote:
> > > I prefer select.where(*conditions) because it does not have the effect of
> > > polluting select with conditions.
> >
> > I don't understand. Any way, select will need to handle the where clause.
>
> Imagine this kind of code:
>
> s = user.select()
> for condition in conditions:
> ...
> s.where = condition
> ...
>
> at the end of the loop s.where will either have a value or not according to
the
> content of conditions. I would prefer that where is a method to prevent this.
I don't see why a method will be better in any way where will be set.
http://codereview.appspot.com/4248045/diff/24002/pysql/__init__.py File pysql/__init__.py (right): http://codereview.appspot.com/4248045/diff/24002/pysql/__init__.py#newcode67 pysql/__init__.py:67: one more <BLANKLINE> to ensure consistency of space b/w ...
13 years, 7 months ago
(2011-07-28 00:25:55 UTC)
#12
Issue 4248045: python-sql: select examples
(Closed)
Created 14 years ago by ced
Modified 13 years, 3 months ago
Reviewers: nicoe, bch, thomas.sharoon
Base URL:
Comments: 40