Well, this error says that you have rows in other(or same) tables
referring to this row you are going to delete,
and you should delete referring rows first. If you want SQLA to do it
automatically,
you need to use sessions and mappers (not raw SQL expression engine),
more info here:
Tested with trunk. Works, thanks.
On Jan 29, 6:42 am, Michael Bayer mike...@zzzcomputing.com wrote:
OK, well that was painful but we are stronger for the effort, thanks
for bringing up the issue. r5740 of trunk will allow your original
mapper(A.join(B))-mapper(B) to configure properly.
I quite sure I'm not using it...
Look at that code that reproduce the bug
http://utilitybase.com/paste/11481
The last line (p2 = Parent(p)) leads to a load of the children, so
an autoflush. I have a failure with 0.5.2:
sqlalchemy.exc.IntegrityError: (IntegrityError) parent.dumb may not
be NULL
I have some items which are related but I need to change it so they
related to another item.
Before getting myself in a mess (as I need to do this for a bunch of
tables) I wanted to check if the following approach is fine.
I am using SA 0.5, ORM and declarative and the model is:
class
Hi folks,
I have recently started to learn ORM tools in python. I am trying to
write an update query based on a where clause. This is the original
SQL:
UPDATE mail SET fl=20 WHERE f =1 and uid =2 ;
This is what I did in SA:
flTot = 19
fNo = 2
uidNo = 5
a = column('f') + bindparam('fNo')
b =
that's the cascade of p2 being added to the session upon being
associated with the in-session items in p.children. So yes, cascade
rules do add things to the session. setting cascade=None on
Child.parent would prevent it, or alternatively you can turn off
autoflush on the session for
Hi,
My code is like that:
try:
for some_val in some_values:
rec = SomeModel()
rec.some_val = some_val
session.save(rec)
session.commit()
except:
session.rollback()
For each record that I'm creating, I need to send an email right
after. And each email
Werner F. Bruhin wrote:
I have some items which are related but I need to change it so they
related to another item.
Before getting myself in a mess (as I need to do this for a bunch of
tables) I wanted to check if the following approach is fine.
I am using SA 0.5, ORM and declarative
On Jan 29, 2009, at 11:32 AM, Werner F. Bruhin wrote:
Werner F. Bruhin wrote:
I have some items which are related but I need to change it so they
related to another item.
Before getting myself in a mess (as I need to do this for a bunch of
tables) I wanted to check if the following
Michael,
Michael Bayer wrote:
...
there's no need to reassign the FK column yourself and the original
pattern you're using is correct. that only one item in the list is
the exception suggests something else is changing its state again
further down the road.
Thanks for the quick
Hi,
query.count().scalar()
This code works fine with sqlite and Oracle, but with PG it goes nuts and
complains that an explicit AS must be used in a subselect, i.e. it's doing
this:
select count(*) as blah from (select ...)
But PG wants this:
select count(*) as blah from (select
sorry. i obviously didn't explain too well. it DOES work with ORM. i
don't have a problem at all.
however, i can't work with the tables using engine.conect or straight
MySQLdb, for that matter.
in fact, closer examination suggests that not only are the onupdate,
ondelete = CASCADE not set
in the
for the SQL expression language we try not to guess things like that.
the difference between a select() and an alias() is pretty big.
On Jan 29, 2009, at 12:36 PM, Bob Farrell wrote:
Hi,
query.count().scalar()
This code works fine with sqlite and Oracle, but with PG it goes
nuts
Michael,
I run the following script and initially had the either my application
and/or the IB Expert database tool (for Firebird SQL v 2.1) open at the
same time. Now the following tests are done without any other task
accessing the database.
script:
engine = db.sa.create_engine(dburl,
that sess.fulsh() in the middle there... if u move it up/down/out,
will behaviour change? e.g. if u print the things in itemB.purchase
just _After that flush - is 80 there or not?
On Thursday 29 January 2009 20:19:59 Werner F. Bruhin wrote:
Michael,
I run the following script and initially
On Jan 29, 2009, at 1:19 PM, Werner F. Bruhin wrote:
Michael,
I run the following script and initially had the either my application
and/or the IB Expert database tool (for Firebird SQL v 2.1) open at
the
same time. Now the following tests are done without any other task
accessing
I worked up a test case that simulates your usage, and checks the number of
open MSSQL connections using a call to the system stored proc sp_who, so
it can run in a more automated fashion.
I originally got mixed results on this, it would pass about 50% of the time
and fail about 50% of the time.
Michael Bayer wrote:
..
right there, purchasid 80 is not even in the list of items anymore.
This is basically iterate the list, 80 is there, then flush(), then 80
is not there. this is all before anything has been moved. so
either the flush() does something, or just the move of
oh, duh. do it like this:
for purchase in list(aItem.purchase):
purchase.cbbottle = bItem
I leave it to you as an exercise why this is the case.
On Jan 29, 2009, at 3:08 PM, Werner F. Bruhin wrote:
Michael Bayer wrote:
..
right there, purchasid 80 is not even in the list of
why don't you work off the las/previous committed rec id?
On Jan 29, 4:05 am, Dejan Mayo dejan.m...@gmail.com wrote:
Hi,
My code is like that:
try:
for some_val in some_values:
rec = SomeModel()
rec.some_val = some_val
session.save(rec)
session.commit()
20 matches
Mail list logo