[sqlalchemy] Suggestions for abbreviations

2009-01-11 Thread Cito

I wonder why declarative_base() doesn't simply set __tablename__ to
the name of the class by default (maybe translating camelcase to
lowercase with underscores), similar to how it is done in SQLObject
and Elixir. Also, the error message if you forget to set __tablename__
is misleading, it should mention __tablename__ in declarative usage.

Another idea (not sure if it really makes sense): In the order_by
clause, negative integers could be used for descending order, i.e. -2
would work like desc(2).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: problem with join, count on 0.5.0rc3

2008-11-10 Thread Cito

The new behavior is exactly what I expect, namely that query.count()
returns the same as len(query.all()). Are there cases in which this
does not make sense or where this would not work?

-- Christoph
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: problem with join, count on 0.5.0rc3

2008-11-09 Thread Cito

On 8 Nov., 22:03, Michael Bayer [EMAIL PROTECTED] wrote:
 oh sorry, also count() is meant to count instances of a single kind of  
 object.  So in fact you should be saying:

 session.query(UserRss).join(Rss, item).count()

This question is actually coming from the TurboGears group. The
problem here is that our pagination mechanism takes an existing query
and checks its result size with count(). I.e. we have no influence on
the actual query, we just assume that if you can get all() or slices
from the query that you can also count() its results. This had worked
all the time up to 0.4.8, but with 0.5 it doesn't work any more.

In this example Greg probably wanted to display data from both UserRss
*and* Rss in a data grid, so it would not help him to alter the query
that way.

-- Christoph
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Ordering null dates

2008-06-10 Thread Cito

Only for the record: I just noticed that another simple workaround is
ordering by something like start_date is not null, start_date,
end_date is null, end_date. SA could also implement nullsfirst()/
nullslast() that way if the database engine does not support nulls
first/nulls last.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---