On Tue, Nov 11, 2008 at 4:31 AM, King Simon-NFHD78
[EMAIL PROTECTED] wrote:
Which is pretty much the query we wanted, apart from the names. I hope
it works in your original example as well!
This worked great -- and I learned a bunch of useful sql and
sqlalchemy tricks along the way. Many
On Mon, Nov 10, 2008 at 4:33 AM, King Simon-NFHD78
[EMAIL PROTECTED] wrote:
I'm no SQL expert, so please take this with a pinch of salt, but as far
as I know, conditions in the 'WHERE' clause of an SQL statement are
applied BEFORE any grouping, so you can't use grouping functions (such
as
On Mon, Nov 10, 2008 at 10:05 AM, King Simon-NFHD78
[EMAIL PROTECTED] wrote:
Actually, the section after that (Using Subqueries) probably does
something very close to what you want. What's the result of these lines:
q1 = (session.query(Snapshot.strategy, Snapshot.symbol, sum_pnl)
On Mon, Nov 10, 2008 at 11:10 AM, Michael Bayer
[EMAIL PROTECTED] wrote:
you need an extra tuple on the join, query.join((q1, s.s==q1.c.s))
This gets past the syntax error, but does not produce the right
results. I had to take some time off today to work on other problems,
but am now
I am having trouble writing a sqlalchemy query which selects all rows
where a field equals the max for that field, eg
q =
session.query(Snapshot).filter(Snapshot.totalqty==func.max(Snapshot.totalqty))
When I try and get the results of the query, I get the error below.
How should I use
On Fri, Nov 7, 2008 at 3:57 PM, Michael Bayer [EMAIL PROTECTED] wrote:
Theres a good tutorial on the topic of GROUP BY from a SQL
perspective, here:
http://weblogs.sqlteam.com/jeffs/jeffs/archive/2007/07/20/60261.aspx
in this case you probably want
I have some tables with financial data -- one table has price data on
a given date and another data has fundamental data on a given report
date. I am wondering if it is possible to create another object that
is a ratio on a join between values in the two tables, eg in pseudo
code
# divide the
On Thu, Oct 9, 2008 at 6:28 PM, Michael Bayer [EMAIL PROTECTED] wrote:
On Oct 9, 2008, at 3:28 PM, John Hunter wrote:
I have some tables with financial data -- one table has price data on
a given date and another data has fundamental data on a given report
date. I am wondering