[sqlalchemy] offending objects removed from session

2009-10-18 Thread Brett
I just came across this issue where if an IntegrityError is raised on session.commit() then the offending object that caused the error is automatically removed from the session. If the object is a child object is related to parent object and the child object is in session.new then it is removed

[sqlalchemy] Re: offending objects removed from session

2009-10-18 Thread Brett
for and throw them out when you're done. Not to be reused throughout the life of your application. On Oct 18, 2:14 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Oct 18, 2009, at 3:24 PM, Brett wrote: I just came across this issue where if an IntegrityError is raised on session.commit

[sqlalchemy] intersphinx docs

2009-09-15 Thread Brett
There is a Sphinx module called intersphinx that allows API docs to be cross referenced between sites. To make it work you have to upload the objects.inv file to you web server so that when someone generates their own Sphinx-based docs it knows how to reference the remote docs. Does SQLAlchemy

[sqlalchemy] Re: intersphinx docs

2009-09-15 Thread Brett
Sorry, I had put a . in 05 On Sep 15, 4:22 pm, Michael Bayer mike...@zzzcomputing.com wrote: Brett wrote: There is a Sphinx module called intersphinx that allows API docs to be cross referenced between sites.  To make it work you have to upload the objects.inv file to you web server so

[sqlalchemy] Re: unions and order_by

2009-01-25 Thread Brett
The Controlling Ordering section of the docs mentions that using order_by on mappers is the standard way for setting a default ordering against a single mapped entity. This seems like a good feature. Is there another way? Will this be deprecated in the future? What's also really weird is that

[sqlalchemy] Re: How to improve performance of sqlalchemy based application?

2009-01-24 Thread Brett
I drastically sped up my inserts by precomputing any defaults on a column and passing them explicitly instead of calculating them on each insert. For example, each row had a timestamp and the timestamp was being calculated on each insert for each row. Since I was inserting them all at the same

[sqlalchemy] Re: How to improve performance of sqlalchemy based application?

2009-01-24 Thread Brett
See it here on lines 323-352: http://bazaar.launchpad.net/~bauble/bauble/trunk/annotate/head%3A/bauble/plugins/imex/csv_.py --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group,

[sqlalchemy] unions and order_by

2009-01-24 Thread Brett
The script below is giving me the following error: sqlalchemy.exc.OperationalError: (OperationalError) ORDER BY clause should come after UNION not before u'SELECT anything.id, anything.any, anything.something_id \nFROM anything JOIN something ON something.id = anything.something_id ORDER BY any

[sqlalchemy] ambiguous order_by column error

2008-10-03 Thread Brett
The following code give an error about an ambiguous column on the order_by. This can easily be fixed by changing the order by column to 'anything.code' but I would assume that since the query will return objects of type Anything then it would assume anything.code

[sqlalchemy] Re: Attribute extension in 0.5rc1

2008-10-03 Thread Brett
:28 PM, Brett wrote: I'm using AttributeExtension for my project and it would greatly simplify things if I could receive the events after the attributes are set.  Is there any way this will make it into SqlAlchemy? having the events received before is a strong feature since it allows

[sqlalchemy] Re: Attribute extension in 0.5rc1

2008-10-01 Thread Brett
I'm using AttributeExtension for my project and it would greatly simplify things if I could receive the events after the attributes are set. Is there any way this will make it into SqlAlchemy? On Sep 28, 8:09 pm, Mike Bernson [EMAIL PROTECTED] wrote: Michael Bayer wrote: On Sep 28, 2008, at

[sqlalchemy] Re: update sequence on insert

2008-02-16 Thread Brett
I have to be able to dump my tables to CSV so I need to keep the primary key values so my foreign keys match up. Michael Bayer wrote: On Feb 15, 2008, at 5:53 PM, Brett wrote: serial column instead. On sqlite the id column seems to always generate a unique number. I'm not sure what

[sqlalchemy] update sequence on insert

2008-02-15 Thread Brett
Hello all, On a Postgres database when I explicitly insert a value into a column with a sequence on it the sequence doesn't get updated and can return ids that aren't unique. This can be be fixed with SQLAlchemy equivalent of: maxid = select max(id) on family; select setval(family_id_seq,

[sqlalchemy] moving objects between sessions

2008-02-01 Thread Brett
Is it possible to move a pending object that is a child in a relation to a new sessions without flushing the objects original session? - import sqlalchemy from sqlalchemy import * from sqlalchemy.orm import * uri = 'sqlite:///:memory:' metadata = MetaData()

[sqlalchemy] association object to associate table to itself

2007-12-19 Thread Brett
Hello, I'm trying to create an association between two objects of the same type. For example I have table A and then I have an association table that has two foreign keys to table A. What I'm looking for is to be able to say: one_typeA.append(two_typeA) but the association_proxy seems only

[sqlalchemy] Re: Solution!!! ENUM type that works with sqlite too

2007-04-23 Thread Brett
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Enum On Sun, 2007-04-22 at 13:33 +, Ian Charnas wrote: I'm sure a lot of us have done something like this, I figured I'd post it so people can find it in a google search and won't have to write it and debug it themselves... This is a Type