Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-09 Thread Michael Bayer

On Jan 8, 2014, at 8:55 PM, limodou limo...@gmail.com wrote:

 
 Yes, I saw the code about 0.8.X and 0.9.1, the None convertion are the same. 
 But difference between them is in AND process. So this inconsistent that 
 you mean it's a bug in 0.8?

it’s a bug in 0.8, yes.

 
 I think raise exception maybe better, so that it'll let user to know what 
 wrong with the condition. Otherwise some code like condition  None can run 
 in 0.8.X very well, but in 0.9 it'll only return nothing without any error 
 thrown at all. It will break the old code.

well we can’t change 0.8 to raise, so raising an exception in 0.9 wouldn’t 
solve much as far as cross-compatibility.   I don’t think this pattern is that 
common in any case.






signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-08 Thread Michael Bayer

On Jan 8, 2014, at 2:39 AM, limodou limo...@gmail.com wrote:

 
 
 
 On Wed, Jan 8, 2014 at 3:31 PM, Wichert Akkerman wich...@wiggy.net wrote:
 
 On 08 Jan 2014, at 01:26, limodou limo...@gmail.com wrote:
 
  But I don't know why make this decision. Because where NULL will get 
  nothing. And in 0.8.X version, I need to combine multiple condition 
  according user input to one condition, so my code just like:
 
  cond = None
  for c in conditions:
  cond = c  cond
 
 Why don’t you change the initial value to true() instead of None? If I read 
 the documentation correctly that should work correctly in both SQLAlchemy 
 versions.
 
 
 Even cond='' is correctly also, but I just think NULL is not a valid 
 condition expression in SQL, so I think the old appoach maybe better. 

“WHERE NULL” is not valid, that’s true; hence neither is select.where(None) 
anymore, which is what would happen above if “conditions” were empty (and if 
conditions is guaranteed not empty, you could say “cond = conditions[0]; for c 
in conditions[1:]:…” )

The change includes that it’s safe to use “true()” explicitly and it will be 
folded in (i.e. not rendered) when used with “AND”.   Some people were doing 
the above pattern that way anyway, now that way works on all backends.

in any case it’s better to use and_():

cond = and_(*conditions)

it’s less code and way fewer method calls internally. Also when you have “cond 
= c  cond”, you end up with a structure like a  (b  (c  (d  e)))” which 
eventually will cause a recursion overflow when parsed, if there’s too many 
conditions.






 
 -- 
 I like python!
 UliPad The Python Editor: http://code.google.com/p/ulipad/
 UliWeb simple web framework: https://github.com/limodou/uliweb
 My Blog: http://my.oschina.net/limodou
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy.
 For more options, visit https://groups.google.com/groups/opt_out.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-08 Thread limodou


 “WHERE NULL” is not valid, that’s true; hence neither is
 select.where(None) anymore, which is what would happen above if
 “conditions” were empty (and if conditions is guaranteed not empty, you
 could say “cond = conditions[0]; for c in conditions[1:]:…” )

 The change includes that it’s safe to use “true()” explicitly and it will
 be folded in (i.e. not rendered) when used with “AND”.   Some people were
 doing the above pattern that way anyway, now that way works on all backends.

 in any case it’s better to use and_():

 cond = and_(*conditions)

 it’s less code and way fewer method calls internally. Also when you have
 “cond = c  cond”, you end up with a structure like a  (b  (c  (d 
 e)))” which eventually will cause a recursion overflow when parsed, if
 there’s too many conditions.




I think there are two things here:

1. Should None be converted to NULL when deal with condition  None or
and_(condition, None)
2. How to combine multiple condition into one condition with and_

And I think the second question should be resolved by application itself,
we just need to obey some good guide, that's ok.

But for the first question, the old style I think None's behavior just like
true(), but in 0.9.x, is not. So this makes the uncompatible process. Here
is a test for 0.9.1:

 print and_('id=3', None)
id=3 AND NULL
 print and_('id=3', '')
id=3
 print and_('id=3', true())
id=3

So empty string is the same as true(), and why empty string can be treated
as true() but None is treated as NULL? Commonly, python will treat None,
empty string are false boolean value, but here sqlalchemy does do like
that obviousely.

-- 
I like python!
UliPad The Python Editor: http://code.google.com/p/ulipad/
UliWeb simple web framework: https://github.com/limodou/uliweb
My Blog: http://my.oschina.net/limodou

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-08 Thread Michael Bayer
sorry, this should read:

Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it as 
follows, in which case it works the same in both versions:

def my_select(conditions):
cond = None
for c in conditions:
cond = c  cond
stmt = select([column(‘x’)])
if cond is not None:
stmt = stmt.where(cond)
return stmt



On Jan 8, 2014, at 11:20 AM, Michael Bayer mike...@zzzcomputing.com wrote:

 Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it as 
 follows, in which case it works the same in both versions:
 
 def my_select(conditions):
 cond = conditions[0]
 for c in conditions[1:]:
 cond = c  cond
 stmt = select([column(‘x’)])
 if cond is not None:
 stmt = stmt.where(cond)
 return stmt
 
  or you assume that “conditions” is non-empty, in which case, as I mentioned 
 earlier, do this:
 
 def my_select(conditions):
 cond = conditions[0]
 for c in conditions[1:]:
 cond = c  cond
 
 return select([column('x')]).where(cond)



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-08 Thread Michael Bayer

On Jan 8, 2014, at 7:54 AM, limodou limo...@gmail.com wrote:

 I think there are two things here:
 
 1. Should None be converted to NULL when deal with condition  None or 
 and_(condition, None) 
 2. How to combine multiple condition into one condition with and_
 
 And I think the second question should be resolved by application itself, we 
 just need to obey some good guide, that's ok.
 
 But for the first question, the old style I think None's behavior just like 
 true(), but in 0.9.x, is not. So this makes the uncompatible process. Here is 
 a test for 0.9.1:
 
  print and_('id=3', None)
 id=3 AND NULL
  print and_('id=3', '')
 id=3
  print and_('id=3', true())
 id=3
 
 So empty string is the same as true(), and why empty string can be treated as 
 true() but None is treated as NULL? Commonly, python will treat None, empty 
 string are false boolean value, but here sqlalchemy does do like that 
 obviously. 

Here is a sample script using the code you gave.   Your code is equally broken 
in both 0.8 and 0.9, as if the list of conditions is empty, the same SELECT is 
produced on both versions both of which are invalid with “WHERE NULL”:

from sqlalchemy.sql import select, column

def my_select(conditions):
cond = None
for c in conditions:
cond = c  cond

return select([column('x')]).where(cond)

print my_select([])

0.8.4:

SELECT x 
WHERE NULL

0.9.1:

SELECT x 
WHERE NULL

Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it as 
follows, in which case it works the same in both versions:

def my_select(conditions):
cond = conditions[0]
for c in conditions[1:]:
cond = c  cond
stmt = select([column(‘x’)])
if cond is not None:
stmt = stmt.where(cond)
return stmt

 or you assume that “conditions” is non-empty, in which case, as I mentioned 
earlier, do this:

def my_select(conditions):
cond = conditions[0]
for c in conditions[1:]:
cond = c  cond

return select([column('x')]).where(cond)

or preferably, just say and_(*conditions).

as for interpreting None as NULL, None has always been treated as NULL in a SQL 
expression context - it is treated as NULL when used as a WHERE condition by 
itself and it is treated as NULL when used in a comparison.  0.8 is 
inconsistent that it is not treated as NULL when it happens to be part of an 
AND:

from sqlalchemy.sql import select, column, literal

c = column('x')

print select([c]).where(c == 5)   # 0.8 / 0.9: SELECT x WHERE x = :x_1

print select([c]).where(c == None) # 0.8 / 0.9: SELECT x WHERE x IS NULL

print select([c]).where(5”) # 0.8 / 0.9: SELECT x WHERE 5

print select([c]).where(None) # 0.8 / 0.9: SELECT x WHERE NULL

print select([c]).where((c == 5)  5”) # 0.8 / 0.9: SELECT x WHERE x = :x_1 
AND 5

print select([c]).where((c == 5)  None) # 0.8: SELECT x WHERE x = :x_1   # 
0.9: SELECT x WHERE x = :x_1 AND NULL

The only thing that might be more appropriate than coercing where(None) and 
where(x  None) into NULL would be raising an error - because in fact 
where(x) and where(expr  x) already throws an exception if x is not a 
SQL expression, string, or None/True/False (on both):

print select([c]).where(5)  # 0.8 / 0.9 - raises exception

print select([c]).where(c  5)  # 0.8 / 0.9 - raises exception

None also doesn’t act like true() in 0.8:

print select([c]).where(true())  # 0.8: SELECT x WHERE true

print select([c]).where(None)  # 0.8: SELECT x WHERE NULL


so overall, this change is mentioned in the “Migration Guide” exactly because 
it is in fact a behavioral change.   You can argue it should be listed under 
“Core Behavioral Changes” instead of “Behavioral Improvements” and I wouldn’t 
have much issue with that, it is just listed under “Improvements” because it 
doesn’t change the behavior of code that’s written correctly in the first place.




















 
 -- 
 I like python!
 UliPad The Python Editor: http://code.google.com/p/ulipad/
 UliWeb simple web framework: https://github.com/limodou/uliweb
 My Blog: http://my.oschina.net/limodou
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy.
 For more options, visit https://groups.google.com/groups/opt_out.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-08 Thread Michael Bayer

geez..its 10 degrees here, sorry, just scratch that first case, it has to be 
like this to be fully compatible both ways:

def my_select(conditions):
stmt = select([column('x')])
if conditions:
stmt = stmt.where(and_(*conditions))
return stmt

“cond  None” was never any kind of publicly documented behavior and it was 
inconsistent, sorry.








On Jan 8, 2014, at 11:22 AM, Michael Bayer mike...@zzzcomputing.com wrote:

 sorry, this should read:
 
 Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it 
 as follows, in which case it works the same in both versions:
 
 def my_select(conditions):
 cond = None
 for c in conditions:
 cond = c  cond
 stmt = select([column(‘x’)])
 if cond is not None:
 stmt = stmt.where(cond)
 return stmt
 
 
 
 On Jan 8, 2014, at 11:20 AM, Michael Bayer mike...@zzzcomputing.com wrote:
 
 Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it 
 as follows, in which case it works the same in both versions:
 
 def my_select(conditions):
 cond = conditions[0]
 for c in conditions[1:]:
 cond = c  cond
 stmt = select([column(‘x’)])
 if cond is not None:
 stmt = stmt.where(cond)
 return stmt
 
  or you assume that “conditions” is non-empty, in which case, as I mentioned 
 earlier, do this:
 
 def my_select(conditions):
 cond = conditions[0]
 for c in conditions[1:]:
 cond = c  cond
 
 return select([column('x')]).where(cond)
 



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-08 Thread Michael Bayer
a new section has been added as the first “Core Behavioral Change”:

http://sqlalchemy.readthedocs.org/en/rel_0_9/changelog/migration_09.html#none-can-no-longer-be-used-as-a-partial-and-constructor



On Jan 8, 2014, at 11:27 AM, Michael Bayer mike...@zzzcomputing.com wrote:

 
 geez..its 10 degrees here, sorry, just scratch that first case, it has to be 
 like this to be fully compatible both ways:
 
 def my_select(conditions):
 stmt = select([column('x')])
 if conditions:
 stmt = stmt.where(and_(*conditions))
 return stmt
 
 “cond  None” was never any kind of publicly documented behavior and it was 
 inconsistent, sorry.
 
 
 
 
 
 
 
 
 On Jan 8, 2014, at 11:22 AM, Michael Bayer mike...@zzzcomputing.com wrote:
 
 sorry, this should read:
 
 Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it 
 as follows, in which case it works the same in both versions:
 
 def my_select(conditions):
 cond = None
 for c in conditions:
 cond = c  cond
 stmt = select([column(‘x’)])
 if cond is not None:
 stmt = stmt.where(cond)
 return stmt
 
 
 
 On Jan 8, 2014, at 11:20 AM, Michael Bayer mike...@zzzcomputing.com wrote:
 
 Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it 
 as follows, in which case it works the same in both versions:
 
 def my_select(conditions):
 cond = conditions[0]
 for c in conditions[1:]:
 cond = c  cond
 stmt = select([column(‘x’)])
 if cond is not None:
 stmt = stmt.where(cond)
 return stmt
 
  or you assume that “conditions” is non-empty, in which case, as I 
 mentioned earlier, do this:
 
 def my_select(conditions):
 cond = conditions[0]
 for c in conditions[1:]:
 cond = c  cond
 
 return select([column('x')]).where(cond)
 
 



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-08 Thread Claudio Freire
Typo:

when condition is non-empty

should be

when conditionS is non-empty


On Wed, Jan 8, 2014 at 1:53 PM, Michael Bayer mike...@zzzcomputing.com wrote:
 a new section has been added as the first “Core Behavioral Change”:

 http://sqlalchemy.readthedocs.org/en/rel_0_9/changelog/migration_09.html#none-can-no-longer-be-used-as-a-partial-and-constructor



 On Jan 8, 2014, at 11:27 AM, Michael Bayer mike...@zzzcomputing.com wrote:


 geez..its 10 degrees here, sorry, just scratch that first case, it has to be
 like this to be fully compatible both ways:

 def my_select(conditions):
 stmt = select([column('x')])
 if conditions:
 stmt = stmt.where(and_(*conditions))
 return stmt

 “cond  None” was never any kind of publicly documented behavior and it was
 inconsistent, sorry.








 On Jan 8, 2014, at 11:22 AM, Michael Bayer mike...@zzzcomputing.com wrote:

 sorry, this should read:

 Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it
 as follows, in which case it works the same in both versions:

 def my_select(conditions):
 cond = None
 for c in conditions:
 cond = c  cond
 stmt = select([column(‘x’)])
 if cond is not None:
 stmt = stmt.where(cond)
 return stmt



 On Jan 8, 2014, at 11:20 AM, Michael Bayer mike...@zzzcomputing.com wrote:

 Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it
 as follows, in which case it works the same in both versions:

 def my_select(conditions):
 cond = conditions[0]
 for c in conditions[1:]:
 cond = c  cond
 stmt = select([column(‘x’)])
 if cond is not None:
 stmt = stmt.where(cond)
 return stmt

  or you assume that “conditions” is non-empty, in which case, as I mentioned
 earlier, do this:

 def my_select(conditions):
 cond = conditions[0]
 for c in conditions[1:]:
 cond = c  cond

 return select([column('x')]).where(cond)





-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-08 Thread Michael Bayer
yeah…plus there’s no need for a “None” check when true() is used.   I’m 
supposed to be napping right now, this is the problem


On Jan 8, 2014, at 12:01 PM, Claudio Freire klaussfre...@gmail.com wrote:

 Typo:
 
 when condition is non-empty
 
 should be
 
 when conditionS is non-empty
 
 
 On Wed, Jan 8, 2014 at 1:53 PM, Michael Bayer mike...@zzzcomputing.com 
 wrote:
 a new section has been added as the first “Core Behavioral Change”:
 
 http://sqlalchemy.readthedocs.org/en/rel_0_9/changelog/migration_09.html#none-can-no-longer-be-used-as-a-partial-and-constructor
 
 
 
 On Jan 8, 2014, at 11:27 AM, Michael Bayer mike...@zzzcomputing.com wrote:
 
 
 geez..its 10 degrees here, sorry, just scratch that first case, it has to be
 like this to be fully compatible both ways:
 
 def my_select(conditions):
stmt = select([column('x')])
if conditions:
stmt = stmt.where(and_(*conditions))
return stmt
 
 “cond  None” was never any kind of publicly documented behavior and it was
 inconsistent, sorry.
 
 
 
 
 
 
 
 
 On Jan 8, 2014, at 11:22 AM, Michael Bayer mike...@zzzcomputing.com wrote:
 
 sorry, this should read:
 
 Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it
 as follows, in which case it works the same in both versions:
 
 def my_select(conditions):
cond = None
for c in conditions:
cond = c  cond
stmt = select([column(‘x’)])
if cond is not None:
stmt = stmt.where(cond)
return stmt
 
 
 
 On Jan 8, 2014, at 11:20 AM, Michael Bayer mike...@zzzcomputing.com wrote:
 
 Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it
 as follows, in which case it works the same in both versions:
 
 def my_select(conditions):
cond = conditions[0]
for c in conditions[1:]:
cond = c  cond
stmt = select([column(‘x’)])
if cond is not None:
stmt = stmt.where(cond)
return stmt
 
 or you assume that “conditions” is non-empty, in which case, as I mentioned
 earlier, do this:
 
 def my_select(conditions):
cond = conditions[0]
for c in conditions[1:]:
cond = c  cond
 
return select([column('x')]).where(cond)
 
 
 
 
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy.
 For more options, visit https://groups.google.com/groups/opt_out.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-08 Thread limodou
On Thu, Jan 9, 2014 at 12:20 AM, Michael Bayer mike...@zzzcomputing.comwrote:


 On Jan 8, 2014, at 7:54 AM, limodou limo...@gmail.com wrote:

 I think there are two things here:


 1. Should None be converted to NULL when deal with condition  None or
 and_(condition, None)
 2. How to combine multiple condition into one condition with and_

 And I think the second question should be resolved by application itself,
 we just need to obey some good guide, that's ok.

 But for the first question, the old style I think None's behavior just
 like true(), but in 0.9.x, is not. So this makes the uncompatible process.
 Here is a test for 0.9.1:

  print and_('id=3', None)
 id=3 AND NULL
  print and_('id=3', '')
 id=3
  print and_('id=3', true())
 id=3

 So empty string is the same as true(), and why empty string can be treated
 as true() but None is treated as NULL? Commonly, python will treat None,
 empty string are false boolean value, but here sqlalchemy does do like
 that obviously.


 Here is a sample script using the code you gave.   Your code is equally
 broken in both 0.8 and 0.9, as if the list of conditions is empty, the same
 SELECT is produced on both versions both of which are invalid with “WHERE
 NULL”:

 from sqlalchemy.sql import select, column

 def my_select(conditions):
 cond = None
 for c in conditions:
 cond = c  cond

 return select([column('x')]).where(cond)

 print my_select([])

 0.8.4:

 SELECT x
 WHERE NULL

 0.9.1:

 SELECT x
 WHERE NULL


But I'm not talking about empty condition, but condition  None. In
application, I can test if the condition is None and don't execute sql at
all.


 Therefore, your script cannot work in either 0.8 or 0.9, unless you fix it
 as follows, in which case it works the same in both versions:

 def my_select(conditions):
 cond = conditions[0]
 for c in conditions[1:]:
 cond = c  cond
 stmt = select([column(‘x’)])
 if cond is not None:
 stmt = stmt.where(cond)
 return stmt

  or you assume that “conditions” is non-empty, in which case, as I
 mentioned earlier, do this:

 def my_select(conditions):
 cond = conditions[0]
 for c in conditions[1:]:
 cond = c  cond

 return select([column('x')]).where(cond)

 or preferably, just say and_(*conditions).


This thing is about how to deal with condition combination, if there is
None value, above code is still not right. So the correct code maybe need
add some test like if c is None:.

And my point is not mainly about how to write correct condition combine,
but the which the right way to convert None.



 as for interpreting None as NULL, None has always been treated as NULL in
 a SQL expression context - it is treated as NULL when used as a WHERE
 condition by itself and it is treated as NULL when used in a comparison.
  0.8 is inconsistent that it is not treated as NULL when it happens to be
 part of an AND:


Yes, I saw the code about 0.8.X and 0.9.1, the None convertion are the
same. But difference between them is in AND process. So this inconsistent
that you mean it's a bug in 0.8?


 from sqlalchemy.sql import select, column, literal

 c = column('x')

 print select([c]).where(c == 5)   # 0.8 / 0.9: SELECT x WHERE x = :x_1

 print select([c]).where(c == None) # 0.8 / 0.9: SELECT x WHERE x IS NULL

 print select([c]).where(5”) # 0.8 / 0.9: SELECT x WHERE 5

 print select([c]).where(None) # 0.8 / 0.9: SELECT x WHERE NULL

 print select([c]).where((c == 5)  5”) # 0.8 / 0.9: SELECT x WHERE x =
 :x_1 AND 5

 print select([c]).where((c == 5)  None) # 0.8: SELECT x WHERE x = :x_1
 # 0.9: SELECT x WHERE x = :x_1 AND NULL

 The only thing that might be more appropriate than coercing where(None)
 and where(x  None) into NULL would be raising an error - because in fact
 where(x) and where(expr  x) already throws an exception if x is not
 a SQL expression, string, or None/True/False (on both):


I think raise exception maybe better, so that it'll let user to know what
wrong with the condition. Otherwise some code like condition  None can run
in 0.8.X very well, but in 0.9 it'll only return nothing without any error
thrown at all. It will break the old code.



 print select([c]).where(5)  # 0.8 / 0.9 - raises exception

 print select([c]).where(c  5)  # 0.8 / 0.9 - raises exception

 None also doesn’t act like true() in 0.8:

 print select([c]).where(true())  # 0.8: SELECT x WHERE true

 print select([c]).where(None)  # 0.8: SELECT x WHERE NULL


 so overall, this change is mentioned in the “Migration Guide” exactly
 because it is in fact a behavioral change.   You can argue it should be
 listed under “Core Behavioral Changes” instead of “Behavioral Improvements”
 and I wouldn’t have much issue with that, it is just listed under
 “Improvements” because it doesn’t change the behavior of code that’s
 written correctly in the first place.



 Or the doc add the inconsistant about condition  None maybe the better.

Thank you very much.

-- 
I like 

Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-07 Thread Michael Bayer
that’s this: 
http://docs.sqlalchemy.org/en/rel_0_9/changelog/migration_09.html#improved-rendering-of-boolean-constants-null-constants-conjunctions


On Jan 7, 2014, at 4:13 AM, limodou limo...@gmail.com wrote:

 I found a problem in 0.9.1 version:
 
 in 0.8.x :
  print (Blog.c.id==5)  None
 blog.id = :id_1
 
 But in 0.9.1:
  print (Blog.c.id==5)  None
 blog.id = :id_1 AND NULL
 
 So I don't know if it's a bug?
 
 
 On Tue, Jan 7, 2014 at 2:25 AM, Jonathan Vanasco jonat...@findmeon.com 
 wrote:
 automap sounds neat!  thanks!
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 -- 
 I like python!
 UliPad The Python Editor: http://code.google.com/p/ulipad/
 UliWeb simple web framework: https://github.com/limodou/uliweb
 My Blog: http://my.oschina.net/limodou
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy.
 For more options, visit https://groups.google.com/groups/opt_out.



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-07 Thread limodou
But I don't know why make this decision. Because where NULL will get
nothing. And in 0.8.X version, I need to combine multiple condition
according user input to one condition, so my code just like:

cond = None
for c in conditions:
cond = c  cond

So in 0.9.X, the result will be something like: WHERE todo.id = 1 AND NULL,
so I got nothing. Above code is totally wrong in 0.9.X.

And I think maybe the old way makes sence.


On Tue, Jan 7, 2014 at 10:42 PM, Michael Bayer mike...@zzzcomputing.comwrote:

 that’s this:
 http://docs.sqlalchemy.org/en/rel_0_9/changelog/migration_09.html#improved-rendering-of-boolean-constants-null-constants-conjunctions


 On Jan 7, 2014, at 4:13 AM, limodou limo...@gmail.com wrote:

 I found a problem in 0.9.1 version:

 in 0.8.x :
  print (Blog.c.id http://blog.c.id/==5)  None
 blog.id = :id_1

 But in 0.9.1:
  print (Blog.c.id http://blog.c.id/==5)  None
 blog.id = :id_1 AND NULL

 So I don't know if it's a bug?


 On Tue, Jan 7, 2014 at 2:25 AM, Jonathan Vanasco jonat...@findmeon.comwrote:

 automap sounds neat!  thanks!

 --
 You received this message because you are subscribed to the Google Groups
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 I like python!
 UliPad The Python Editor: http://code.google.com/p/ulipad/
 UliWeb simple web framework: https://github.com/limodou/uliweb
 My Blog: http://my.oschina.net/limodou

 --
 You received this message because you are subscribed to the Google Groups
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to sqlalchemy+unsubscr...@googlegroups.com.
 To post to this group, send email to sqlalchemy@googlegroups.com.
 Visit this group at http://groups.google.com/group/sqlalchemy.
 For more options, visit https://groups.google.com/groups/opt_out.





-- 
I like python!
UliPad The Python Editor: http://code.google.com/p/ulipad/
UliWeb simple web framework: https://github.com/limodou/uliweb
My Blog: http://my.oschina.net/limodou

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-07 Thread Wichert Akkerman

On 08 Jan 2014, at 01:26, limodou limo...@gmail.com wrote:

 But I don't know why make this decision. Because where NULL will get 
 nothing. And in 0.8.X version, I need to combine multiple condition according 
 user input to one condition, so my code just like:
 
 cond = None
 for c in conditions:
 cond = c  cond

Why don’t you change the initial value to true() instead of None? If I read the 
documentation correctly that should work correctly in both SQLAlchemy versions.

Wichert.

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-07 Thread limodou
On Wed, Jan 8, 2014 at 3:31 PM, Wichert Akkerman wich...@wiggy.net wrote:


 On 08 Jan 2014, at 01:26, limodou limo...@gmail.com wrote:

  But I don't know why make this decision. Because where NULL will get
 nothing. And in 0.8.X version, I need to combine multiple condition
 according user input to one condition, so my code just like:
 
  cond = None
  for c in conditions:
  cond = c  cond

 Why don’t you change the initial value to true() instead of None? If I
 read the documentation correctly that should work correctly in both
 SQLAlchemy versions.


Even cond='' is correctly also, but I just think NULL is not a valid
condition expression in SQL, so I think the old appoach maybe better.

-- 
I like python!
UliPad The Python Editor: http://code.google.com/p/ulipad/
UliWeb simple web framework: https://github.com/limodou/uliweb
My Blog: http://my.oschina.net/limodou

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-06 Thread Michael Bayer
Just an update, read the docs has been having problems building, the current 
changelog for 0.9.1 can be viewed at:

http://docs.sqlalchemy.org/en/latest/changelog/changelog_09.html#change-0.9.1



On Jan 5, 2014, at 7:54 PM, Michael Bayer mike...@zzzcomputing.com wrote:

 Hello again list!
 
 SQLAlchemy release 0.9.1 is now available.
 
 This release is primarily a quick-hit regression release; as we moved fast 
 through 0.9 betas only releasing a single beta, a couple of small regressions 
 popped up since then; this release fixes those.
 
 The release does however include one major, though experimental feature. 
 After spending many hours on IRC with a particular user's use case of 
 automatically generating relationship() objects for an existing schema, a new 
 extension is proposed known as sqlalchemy.ext.automap. Automap expands upon 
 the Declarative model as well as the deferred reflection class to attempt 
 producing a full model at runtime based on a reflected, or otherwise 
 non-mapped, schema collection. In some ways, Automap can more or less replace 
 what the very famous SQLSoup extension has historically been used for, e.g. 
 to generate classes on the fly based on a reflected schema. Automap expands 
 on this idea by proposing simple logic to also generate rudimentary 
 relationships between classes, and also is structured so as to interoperate 
 smoothly with the Declarative mapping system that didn't exist when SQLSoup 
 was created.
 
 Full changelog for SQLAlchemy 0.9.1 is at: 
 http://docs.sqlalchemy.org/en/rel_0_9/changelog/changelog_09.html#change-0.9.1
 
 
 Download SQLAlchemy 0.9.1 at: http://www.sqlalchemy.org/download.html



signature.asc
Description: Message signed with OpenPGP using GPGMail