[sqlalchemy] Re: Session will not commit within a class

2009-08-05 Thread kportertx
UGGG! I have been fighting with this for a while. I never thought to just use an actual file for my db instead of using memory. I was using memory because I was only wanting to test things and didn't want to keep the data. Seems that perhaps due to cherrypy the database was being deleted. I

[sqlalchemy] Re: Alchemy + Firebird Generators

2009-08-05 Thread León
Yeah! That's what I was looking for...and I didn't find. Actually I'm using a declarative model thru declarative_base: every column in the table is an attribute in the class, so I have a column very similar to the one you wrote. The problem was that I was looking for generator instead of

[sqlalchemy] Re: Backref introspection

2009-08-05 Thread nail.xx
I just discovered answer for myself: from sqlalchemy.orm.properties import RelationProperty from sqlalchemy.orm import class_mapper def foo(entity_class, collection_property): rel_prop = class_mapper(entity_class, compile=False).get_property (collection_property) related_entity_class =

[sqlalchemy] Re: Session will not commit within a class

2009-08-05 Thread Gaetan de Menten
On Wed, Aug 5, 2009 at 08:16, kportertxkporte...@gmail.com wrote: O on a side note would you recommend elixir over declarative_base? The biggest difference between the two is that Elixir can generate some columns and tables for you (using common patterns). Michael Bayer probably won't

[sqlalchemy] Re: Session will not commit within a class

2009-08-05 Thread Gaetan de Menten
On Wed, Aug 5, 2009 at 08:13, kportertxkporte...@gmail.com wrote: UGGG!  I have been fighting with this for a while.  I never thought to just use an actual file for my db instead of using memory.  I was using memory because I was only wanting to test things and didn't want to keep the data.  

[sqlalchemy] Re: Netezza

2009-08-05 Thread dusans
Netezza = data warehouse appliance server 1. yes its SQL 2. I can connect to it via pyodbc ok will take a look at it :) On Aug 4, 4:52 pm, Michael Bayer mike...@zzzcomputing.com wrote: dusans wrote: Is there a possibility to connect to Netezza db server? to use SQLalchemy with a certain

[sqlalchemy] share objects with threads and scoped_session

2009-08-05 Thread drakkan
Hi all, I'm trying to share an object with a thread, I already tryed to use Session.merge but I'm doing something wrong, here is a test case: from sqlalchemy import * from sqlalchemy.orm import * e = create_engine('postgres://postgres:postg...@127.0.0.1/test', echo=True) m = MetaData(e) t1 =

[sqlalchemy] Re: Netezza

2009-08-05 Thread dusans
a link to a example would be nice. tnx :) On 4 avg., 16:52, Michael Bayer mike...@zzzcomputing.com wrote: dusans wrote: Is there a possibility to connect to Netezza db server? to use SQLalchemy with a certain backend, you have to answer these questions: 1. is it SQL ? 2. is there a

[sqlalchemy] missing parenthesis on generated query?

2009-08-05 Thread Wichert Akkerman
I have a fairly complex SQL query which looks like this: sql.or_( sql.and_(model.SurveyTreeItem.type==module, model.SurveyTreeItem.skip_children==False, sql.exists().correlate(model.Risk.__table__).where(sql.and_(

[sqlalchemy] Re: Netezza

2009-08-05 Thread dusans
a link to a example would be nice. tnx :) what would be the simplest interface that only performes SELECT, INSERT, UPDATE, DELETE (netezza uses standard sql for that...) since i dont want to create tables with sqlalchemy... netezza has a bit different syntax and more simple types btw. netezza

[sqlalchemy] Re: missing parenthesis on generated query?

2009-08-05 Thread Mike Conley
SQL precedence will evaluate the AND's before the OR's. So unless there is an OR condition embedded within a series of AND's the parenthesis are not needed. I do agree that using parenthesis can make the intent clearer, but will not change the result. The clauses a AND b OR c (a AND b) OR

[sqlalchemy] GIS support for SQLAlchemy

2009-08-05 Thread Sanjiv Singh
Hi, I have been working on supporting spatial data types and spatial operations on SQLAlchemy as my summer of code project. The code is available at http://bitbucket.org/sanjiv/geoalchemy/ and a demo TG2 app using it is at http://geo.turbogears.org/ . I started out by following the postgis

[sqlalchemy] Re: Advice on modeling a many-to-many relationship

2009-08-05 Thread Hollister
That was exactly the conclusion I reached before I read your reply. I modeled it that way and it seems to work perfectly. Guess I was just overthinking it. Thanks for getting back to me, Mike. On Aug 3, 11:41 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Aug 3, 2009, at 5:21 PM,

[sqlalchemy] Re: Hierarchical data: Get all (sub-) children? Parents?

2009-08-05 Thread allen.fowler
On Jul 28, 12:17 pm, David Gardner dgard...@creatureshop.com wrote: Just thought I would toss in my 2-cents here, since I have lots of hierarchical data and have at one time or another used most of the below methods. Choice #1 is the option that I have found that works the best. I Use a

[sqlalchemy] Re: share objects with threads and scoped_session

2009-08-05 Thread drakkan
Seems that once I defined a scoped session as: Session = scoped_session(sessionmaker()) I can switch to a non scoped session simply calling: sess=Session() infact: sess=Session sess sqlalchemy.orm.scoping.ScopedSession object at 0x1debbd0 sess=Session() sess sqlalchemy.orm.session.Session

[sqlalchemy] Suggestions for db connect string configuration?

2009-08-05 Thread AF
Hello, Where do you folks recommend storing the database connection string in my application. Clearly not in the same file with my declaratively defined model objects. And more generally, how do you recommend laying out an SQLAlchemy based application? (In what files to define the engine,