Oh my mistake.
It works totally!
On 13 fév, 21:29, Michael Bayer mike...@zzzcomputing.com wrote:
On Feb 13, 2009, at 12:05 PM, GustaV wrote:
Hello!
In a configuration looking like this:
class Parent:
pass
class Child(Parent):
pass
class ChildChild(Child):
pass
I
( SQL : WHERE type
IN (2) ), and I'd like to avoid to manually list the classes that
inherit Child class.
Thanks
GustaV
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send
u'INSERT INTO parent (dumb) VALUES (?)' [None]
which let me think the object was somehow added to the autoflush...
I hope that will help to solve this.
GustaV
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy
for NOT NULL column, etc.
Is it a normal behavior? I though a Session.add() should be called
explicitly to add the object to the session. Do the object shouldn't
be added after the __init__ call anyway?
Thanks a lot
GustaV
--~--~-~--~~~---~--~~
You received
meta.Session = orm.scoped_session(sm)
On 28 jan, 16:46, Michael Bayer zzz...@gmail.com wrote:
On Jan 28, 10:45 am, GustaV buisson.guilla...@gmail.com wrote:
Hi all,
In the __init__ method of a mapper, the load of a relation may lead to
an autoflush operation. When it happens, the object
= Parent()
c = Child()
assoc1 = Assoc(parent=p1, child=c)
assoc2 = Assoc(parent=p2, child=c)
p1.children = [ ] will lead to:
- delete assoc1 (ok)
- delete c (not ok)
- update assoc2.c_id = null (not ok)
So why is it not really a delete-orphan? :)
Thanks
GustaV
and raising errors
in 0.6. The conditions are, using delete-orphan without delete,
and using delete-orphan with secondary. Neither is supported at
this time.
On Jan 15, 2009, at 11:30 AM, GustaV wrote:
Hi all,
I try to set up a many-to-many relation with an association object.
But I want
What is the best way to achieve the auto delete of the child then
(refering to the example earlier)? I think about using an attribute
extension...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To
Hi everybody.
I'm stuck in something bad:
I use a relation with a arbitrary foreign key + backref (the reason is
that I use single table inheritance, and the relation happen only on
one of the subclasses, so I can't set the foreign key on the
table...). But I get quickly a circular dependency!
that the Session
stays in sync with what's currently in it. the CASCADE then occurs
after this when SQLA deletes the parent row.
On Oct 27, 2008, at 4:57 PM, GustaV wrote:
The reason I ask that is that it is not really safe to use both DB
cascades and SA delete management.
The time comes
Hi all!
In a 1-N relation between a country and its regions, I'm using an
attribute extension to update the current count of regions into
countries. It works very well when I append or remove regions from
country.
But if I delete one of the region directly (session.delete(region)),
the country
, 2008, at 2:05 PM, GustaV wrote:
Hi all!
In a 1-N relation between a country and its regions, I'm using an
attribute extension to update the current count of regions into
countries. It works very well when I append or remove regions from
country.
But if I delete one of the region
Hi all,
I'm experiencing an issue on MySQL (5.0.51a) when sqlalchemy create
the tables with foreign keys.
The SQL issued :
CREATE TABLE `referenced` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY
) TYPE = InnoDB;
CREATE TABLE `referencing` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`f`
- I've just tried to execute
your first example causing the error on my 5.0.45 mysql server and
tables were created ok. Can you post the code snippet causing the
error?
Regards,
Alex
On 1 окт, 16:59, GustaV [EMAIL PROTECTED] wrote:
Hi all,
I'm experiencing an issue on MySQL (5.0.51a
):
@property
def neighbors(self):
return
object_session(self).query(Tile).filter(Tile.idself.id).all()
have the possibility to query neighbors for many objects at a time.
On Sep 12, 4:22 pm, Michael Bayer [EMAIL PROTECTED] wrote:
On Sep 12, 2008, at 4:08 AM, GustaV wrote:
The main
How do I create a unique constraint with the declarative plugin
(latest version 0.5) ?
both:
__table_args__ = ( UniqueConstraint('region.x', 'region.y'),
{'mysql_engine':'InnoDB'} )
__table_args__ = ( UniqueConstraint(x, y), {'mysql_engine':'InnoDB'} )
don't work.
Thanks!
. Eagerloading does that
that's why I want relations...
Maybe today that demand doesn't make any sense, but last time I used
DB, it was much more efficient to issue 1 big request rather than 50
small ones.
On Sep 11, 8:24 pm, Michael Bayer [EMAIL PROTECTED] wrote:
On Sep 11, 2008, at 2:04 PM, GustaV wrote
even a flush! :)
On Sep 10, 3:29 am, Michael Bayer [EMAIL PROTECTED] wrote:
On Sep 9, 2008, at 7:27 PM, GustaV wrote:
t4 = session.query(Tile).get(4)
print t4.neighbors[0]._data
will print None
you have to adjust the other mapping appropriately:
related_tiles = mapper(Tile, tile_alias
Hello,
I'm looking into something a bit tricky : having a relation between a
table and itself (an adjacency list then) with a non-trivial join
condition.
Let's say for example, in the case of a Checkers game board for
example, to query the neighboring tiles of a given tile. To do the
query
= sessionmaker(bind=engine)()
t1 = Tile(id=1)
t2 = Tile(id=2)
t3 = Tile(id=3)
t4 = Tile(id=4)
session.add_all([t1, t2, t3, t4])
session.commit()
assert t2.neighbors == [t1]
assert t4.neighbors == [t1, t2, t3]
assert t1.neighbors == []
On Sep 9, 2008, at 4:50 PM, GustaV wrote:
Hello
'
On 29 août, 18:32, Michael Bayer [EMAIL PROTECTED] wrote:
in r5069, extension can be a list of SessionExtension objects. You
can also append to session.extensions.
On Aug 29, 2008, at 11:36 AM, GustaV wrote:
You must be right.
Of course, Turbogears2 already add an extension to the session
set up for the *next* flush, use
after_flush_postexec().
On Aug 30, 2008, at 10:08 AM, GustaV wrote:
It almost works.
A small problem though : when I get and modify instances (a priori not
loaded before the flush) in after_flush method, they are correctly
added in the dirty list
better?
On Aug 29, 3:57 am, Michael Bayer [EMAIL PROTECTED] wrote:
On Aug 28, 2008, at 6:57 PM, GustaV wrote:
Hi all.
I'm currently working on a map (like in geography :) )
When a new tile in inserted in the DB, I'm using an extension mapper
to update some neighbor's properties (like
Hi all.
I'm currently working on a map (like in geography :) )
When a new tile in inserted in the DB, I'm using an extension mapper
to update some neighbor's properties (like the neighbors count). The
after_insert method helps a lot... but:
When I modify another object than the one being
Hi all,
Really, you do an amazing job on that stuff, it's a pleasure to work
with!
A short question though. It's possible to get a random order on
selects in mysql using the RAND() in parameter of ORDER BY. I know
similar (but different) was possible on others.
What about sqlalchemy?
The goal is
, Michael Bayer [EMAIL PROTECTED] wrote:
On Aug 23, 2008, at 12:10 PM, GustaV wrote:
Hi all,
Really, you do an amazing job on that stuff, it's a pleasure to work
with!
A short question though. It's possible to get a random order on
selects in mysql using the RAND() in parameter of ORDER
Hi all!
I'm looking for an easy way to get informed when someone append or
remove an object from a specific one-to-many relation. For example to
keep a count on the parent object, with no need to query the children.
There are a lot of stuff about it, but I'm not sure how to do it
really:
- 1st :
27 matches
Mail list logo