Hi all,
I'm trying to delete cascade a linked row without success.
Could anyone give me some help?
This is my mapper:
mapper(Azienda,
tbl['azienda'],
properties = {
'anagrafica': relation(Anagrafica, cascade='all, delete,
delete-orphan'),
})
the table Azienda
Hi All,
I have a JSON field that's value is usually a dictionary:
class MyModel(Base):
config = Column(JSONType(255))
(Does SA have a JSONType now? we're using a homebrew one, that may be
where the problem lies...)
So, if I do:
obj = session.query(MyModel).one()
obj.config['foo'] += 1
On 24/02/2012 10:49, Chris Withers wrote:
(Does SA have a JSONType now? we're using a homebrew one, that may be
where the problem lies...)
For reference, I've included the code for this type at the end of this
email, it uses MutableType, so the following should work:
obj =
can it be possible that drop_all does not empty the database of there
are circular references between tables?
I am using sqlite.
Cheers, Lars
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to
On 24/02/2012 12:40, lars van gemerden wrote:
can it be possible that drop_all does not empty the database of there
are circular references between tables?
You want:
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/DropEverything
...which is available here too:
Thanks very much,
Nothing is ever easy ... :-(
why not .. :-)
On Feb 24, 2:11 pm, Chris Withers ch...@simplistix.co.uk wrote:
On 24/02/2012 12:40, lars van gemerden wrote:
can it be possible that drop_all does not empty the database of there
are circular references between tables?
You
Thanks Michael for the response.
A few things:
1. the Python dict class cannot be mapped. Classes can only extend from
object or other classes that in turn extend from object.
2. SQLAlchemy instrumentation relies upon Python descriptors (see
http://docs.python.org/howto/descriptor.html)
The recipe didn't work; it collects all tables, but no foreign keys
and in the end removes nothing.
I am using this in tearDown of unit tests. I have the DB in memory and
even create a new engine in setUp ... maybe I am overlooking somthing
dumb, but I don't get it.
I'll try using a sqlite file
I have a question about the Association Pattern
http://docs.sqlalchemy.org/en/latest/orm/relationships.html#association-object
I have a structure as such:
useraccount
group
useraccount_2_group ( useraccount_id , group_id , metadata like
relation type / date / etc )
Is it
I wrote a small script to clean up the db of old entries.
So when I do obj.delete() I get this error. I also do a session.update(obj)
right before to make sure the object is present in the session.
File deletor.py, line 95, in delete
m.delete()
File
Hi, Chris.
Have you checked
http://docs.sqlalchemy.org/en/latest/orm/extensions/mutable.html
?
Regards,
Tate
-Original Message-
From: Chris Withers ch...@simplistix.co.uk
Sender: sqlalchemy@googlegroups.com
Date: Fri, 24 Feb 2012 10:49:46
To: sqlalchemy@googlegroups.com
Reply-To:
Hi, jo.
At first, try with cascade option 'all, delete'
(note that dropped 'delete-orphan').
Second, I've ever been your situation before, maybe
-Original Message-
From: jo jose.soa...@sferacarta.com
Sender: sqlalchemy@googlegroups.com
Date: Fri, 24 Feb 2012 11:41:48
To:
an certain anagrafica has another parent which conflicts delete-orphan.
The anagrafica's relationship may has done by just setting
anagrafica.azienda_pk (not by azienda.anagrafica_set.append )
(Sorry about that separated mail...my mistake.)
Regards,
Tate
-Original Message-
From:
Opps I didn't know that subject has been changed.
FYI, in 0.6.x, I used to play with class JSONType(MutableType, TypeDecorator)
pretty well.
But 0.7.x, I'm not sure it works as well as 0.6.x...
Regards,
Tate
-Original Message-
From: Chris Withers ch...@simplistix.co.uk
Sender:
Hi All,
When using Alembic, is there a way to just say create the table
required for this model (well, okay this model.__table__ ;-) )
Chris
--
Simplistix - Content Management, Batch Processing Python Consulting
- http://www.simplistix.co.uk
--
You received this message because
On Feb 24, 2012, at 12:37 PM, Jakob D. wrote:
I wrote a small script to clean up the db of old entries.
So when I do obj.delete() I get this error. I also do a session.update(obj)
right before to make sure the object is present in the session.
File deletor.py, line 95, in delete
I'd augment the comments on the SO post by saying you'd want to look at
psycopg2 directly, and possibly ask on their mailing list, what the expected
behavior and options are here. If you provide sample code to the psycopg2
folks, make sure that code is in terms of psycopg2 directly and not any
Heh, thanks Michael!
I believe to have found a working solution, using a special cancel
method that was introduced in the 2.4 psycopg2 driver. I've updated
the SO post with my current solution.
Thanks for the quick reply!
Cody
On Feb 24, 1:06 pm, Michael Bayer mike...@zzzcomputing.com wrote:
I too encountered the same problem that wasted me days, until I caught
pdtb_sqla_queries with my very limited memory profiling skill.
I have actually filed a bug here:
https://github.com/Pylons/pyramid_debugtoolbar/issues/51
and there is a separate issue to make it less leaky:
19 matches
Mail list logo