,
func.count(1).label('Amount'),
((100*func.count(1)) / subq.c.countall)).\
group_by(FilmParticipation.PartType)
--
Mike Conley
On Mon, Aug 29, 2011 at 3:05 PM, nospam lhfied...@gmail.com wrote:
I'm trying to construct a query in sqlalchemy similiar
)).group_by(ReportableCondition.disease)
On Aug 31, 5:42 pm, nospam lhfied...@gmail.com wrote:
I get an error saying the countall doesn't appear in the groupby, or
its not an aggregating function.
sqlalchemy.exc.ProgrammingError: (ProgrammingError) column
anon_2.countall must appear in the GROUP
I'm trying to construct a query in sqlalchemy similiar to this:
SELECT FilmParticipation.PartType, COUNT(*) AS Amount,
100*COUNT(*) /(SELECT count(*) FROM FilmParticipation) AS
Percentage_of_Total
FROM FilmParticipation
GROUP BY FilmParticipation.PartType;
I create a subquery for the nested
I'm trying to do something like this in sqlalchemy:
select (score/10)*10 || '-' || (score/10)*10+9 as scorerange,
count(*)from scoresgroup by score/10 order by 1
which should give:
scorerange | count
+---
0-9|11
10-19 |14
20-29 | 3
30-39 | 2
I'm seeing a simple get taking a considerable amount of time.
a = session.query(Annotation).get(annotation.id)
This line can take anywhere between 0.15 secs to all the way up to 1.5
secs ... The query sqlalchemy produces is below. If I execute the
query in pgadmin, it consistently runs in 47
configuration.
On Jun 26, 2011, at 10:25 AM, nospam wrote:
I'm seeing a simple get taking a considerable amount of time.
a = session.query(Annotation).get(annotation.id)
This line can take anywhere between 0.15 secs to all the way up to 1.5
secs ... The query sqlalchemy produces is below
order each user
placed problem, but w/ more complexity around the last order
definition.
http://spyced.blogspot.com/2007/01/why-sqlalchemy-impresses-me.html
Cheers,
Lars
On May 30, 12:06 pm, Lance Edgar lance.ed...@gmail.com wrote:
On 5/30/2010 7:36 AM, nospam wrote: Thanks Lance. Would
...@gmail.com wrote:
On 5/29/2010 11:59 AM, nospam wrote: I'm trying to make the below logic into
1 query, so I don't have to
run an individual query for each item; but can't figure out how to do
it in sqlalchemy. Any ideas what the code would look like?
results = []
items = session.query(Item
I'm trying to make the below logic into 1 query, so I don't have to
run an individual query for each item; but can't figure out how to do
it in sqlalchemy. Any ideas what the code would look like?
results = []
items = session.query(Item).filter(Item.type == person)
for item in items
I'm new to both python and SQLAlchemy, but am improving. I'm building
a new application that will use a sqlite database. A unit test is
failing with this exception:
sqlalchemy.exceptions.ConcurrentModificationError: Updated rowcount 0
does not match number of objects updated 1
Below is a small
10 matches
Mail list logo