On 26 Mar, 18:04, Michael Bayer mike...@zzzcomputing.com wrote:
it would only do that if you have delete-orphan on the relation, and the
object was never saved.it will get re-added once you attach it to
that's exactly the situation I have. thanks for the explanation.
sandro
*:-)
Hi folks, I'm working on a set of test utilities for functional tests
using SA. Because they use a turbogears model, they import the tg
model and so get the SA class definitions with the mappers from the TG
scoped_session. My problem is that I want to reseed this data on each
test. So I have a
On 26 Mar, 18:02, Michael Bayer mike...@zzzcomputing.com wrote:
you can check if an object is an orphan related to a certain relation()
its supposed to belong to, though there's no automated way to go from that
object to the actual collection it was removed from unless you scan
through all
The version is ok: 0.5.3
The problem is I don't know how to do the unit tests: no tests package.
from tests import eq_, Comparable
How can i do the unit tests?
Suha
On Thu, Mar 26, 2009 at 19:04, Michael Bayer mike...@zzzcomputing.com wrote:
not sure. make sure you're on 0.5.3. do the
Hello everyone,
I have tested that session.add(changed_sqla_object) in at least one
context (when the object with id of changed_sqla_object already exists
in the db) does issue UPDATE sql query and updates the object in the
database.
However, there's also session.update() method. Help on
Try this:
mapper(Parent, parent_table, properties = {
'boys':relation(Child, backref='parent',
primaryjoin=(and_(child_table.c.pid=parent_table.c.id,
child_table.c.gb=='b'),
'girls':relation(Child, backref='parent',
Marcin Krol wrote:
Hello everyone,
I have tested that session.add(changed_sqla_object) in at least one
context (when the object with id of changed_sqla_object already exists
in the db) does issue UPDATE sql query and updates the object in the
database.
However, there's also
install nose and type nosetests.
Suha Onay wrote:
The version is ok: 0.5.3
The problem is I don't know how to do the unit tests: no tests package.
from tests import eq_, Comparable
How can i do the unit tests?
Suha
On Thu, Mar 26, 2009 at 19:04, Michael Bayer
Thanks, it is easy and works just as expected.
Using declarative it looks like this:
Parent.boys = relation(Child, viewonly=True,
primaryjoin=(and_(Child.pid==Parent.id, Child.bg=='b')))
Parent.girls = relation(Child, viewonly=True,
primaryjoin=(and_(Child.pid==Parent.id,
How can i implement the following query with sqlalchemy.orm objects?
SELECT columns.*
FROM columns AS col
JOIN
(
SELECT object_id, revision
FROM columns
GROUP BY id, revision
HAVING revision = 20
) AS lr ON
subq = session.query(ColumnOrm.object_id, ColumnOrm.revision).\
group_by(ColumnOrm.id, ColumnOrm.revision).\
having(ColumnOrm.revision=20).subquery()
print session.query(ColumnOrm).join((subq,
and_(ColumnOrm.object_id==subq.c.object_id,
11 matches
Mail list logo