On Nov 16, 5:15 pm, Conor conor.edward.da...@gmail.com wrote:
Tomas Zulberti wrote:
Hi. I am sort of a newbie on SQLAlchemy. Is there a way to do a query
with the ORM, and doing an as on the select.
For example:
class Example(Base):
name = Column(Unicode(512) )
query =
anyone??
On Nov 14, 6:48 pm, rajasekhar911 rajasekhar...@gmail.com wrote:
Hi guys,
how do i apply order by on a column with a label.
My requirement is like this
class x
id,
amount,
date
i have to group based on id and take sum of amount within a date
range.
i am applying a
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of rajasekhar911
Sent: 17 November 2009 11:32
To: sqlalchemy
Subject: [sqlalchemy] Re: column label and order by
anyone??
On Nov 14, 6:48 pm, rajasekhar911
And you do need to quote the column name in order_by also.
session.query(func.sum(X.amount).label('tot_amount')).group_by(X.date).order_by('tot_amount').limit(10)
generates code
SELECT sum(x.amount) AS tot_amount
FROM x GROUP BY x.date ORDER BY tot_amount
LIMIT 10 OFFSET 0
I have changed my code to be like this:
job = session.merge(job)
# Merge docs says that object does not get into the session
session.add(job)
log.info(Job finished! %s % job.file)
When using latest SQLAlchemy trunk and 0.5.6 sometimes i get
UnboundExecutionError.
Also, i can assure that all
session.query( func.sum(x.amount).label('tot_amount'), x.id ).
filter(x.datefromdate).filter(x.datetodate).
.group_by(x.id)
.order_by('tot_amount DESC')
.limit(5)
On Nov 17, 4:55 pm, Mike Conley mconl...@gmail.com wrote:
And you do need to quote the column name in order_by also.
scott wrote:
Is there a way to filter a query involving an association_proxy?
For example, say I have a one to many relation between Pages and Tags,
and an association_proxy like this to let me represent tags as a list
of strings.
tag_objects = orm.relation('Tag')
tags =
I have a one-to-many object relation, A-to-B.
When an instance of A with several Bs is created it needs to be
persisted by SQLAlchemy. I have that via save-update rule. But when I
delete an A I DON'T WANT SQLAlchemy to do anything to its Bs - it's
taken care of by foreign key constraints in the
This does it. One small drawback is that since the field is now
defined as an attribute, one can't query on it (ie. session.query
(class_).filter_by(modified_by='jack')), but we don't envison such a
use case for this funcionality so it's OK for us.
Recap of what was done: table columns were
bojanb wrote:
This does it. One small drawback is that since the field is now
defined as an attribute, one can't query on it (ie. session.query
(class_).filter_by(modified_by='jack')), but we don't envison such a
use case for this funcionality so it's OK for us.
you get this by using
Greetings SA community!
I've got mapped objects being created and added to a session, but not
committed. Once in a while, I'd like to do something a-la:
oid = 42
object = MyClass(oid)
sessionA.add(object)
# ... time passes, things happen ... then
object = get_obj_from_session(oid,
psychogenic wrote:
My questions are:
- why does the instance state think it doesn't need to insert this
object, that was never committed?
it was INSERTed in your other session. You probably didn't commit the
transaction. The object then gets the key and such is now persistent,
until
Eric Smith wrote:
I'm writing a new database dialect for sqlalchemy 0.6 for Netezza. This
is on Windows. I have an ODBC driver for Netezza. A couple of questions:
- Why isn't there a generic talk to an ODBC source dialect? I
thought that was the beauty of ODBC. Is this possible and
Hello!
I want to introduce an artificial root object into my model to obtain
a traversable container hierarchy:
class Root:
foos = []
bars = []
Foo and Bar are both mapped classes and I had hoped to be able to do
something like
mapper(Root,
properties=dict(foos=relation(Foo),
14 matches
Mail list logo