[sqlalchemy] Re: help w/ creating complex query

2010-05-30 Thread nospam
Thanks Lance. Would this lazily load the annotations for each item? I'm trying to avoid # of item trips to the db, and also avoid loading all the annotations.for each item. I'm thinking I can do w/ some joins, and subquery()'s... Cheers, Lars On May 29, 2:58 pm, Lance Edgar

[sqlalchemy] engine bound to Session

2010-05-30 Thread Eric Lemoine
Hello I use Pylons. Pylons does: Session = scoped_session(sessionmaker()) and then: Session.configure(bind=engine) My question: with a reference to Session how can I get the engine that's bound to it? I tried Session.get_bind() but I get this error: TypeError: get_bind() takes at least 2

[sqlalchemy] Re: engine bound to Session

2010-05-30 Thread Eric Lemoine
On Sun, May 30, 2010 at 4:39 PM, Eric Lemoine eric.lemo...@camptocamp.com wrote: Hello I use Pylons. Pylons does: Session = scoped_session(sessionmaker()) and then: Session.configure(bind=engine) My question: with a reference to Session how can I get the engine that's bound to it? I

[sqlalchemy] sqlalchemy 0.5.8 or 0.6.0?

2010-05-30 Thread Krishnakant Mane
Hello, I am using pylons for my web application development. Currently pylons is in version 1.0 and 0.9.7 is also going stable. I want to know which is the correct version of sqlalchemy for both versions of Pylons. I know it might not make that much of a difference but there are some changes

Re: [sqlalchemy] Re: help w/ creating complex query

2010-05-30 Thread Lance Edgar
On 5/30/2010 7:36 AM, nospam wrote: Thanks Lance. Would this lazily load the annotations for each item? I'm trying to avoid # of item trips to the db, and also avoid loading all the annotations.for each item. I'm thinking I can do w/ some joins, and subquery()'s... This would load the

Re: [sqlalchemy] Re: engine bound to Session

2010-05-30 Thread Lance Edgar
On 5/30/2010 9:43 AM, Eric Lemoine wrote: On Sun, May 30, 2010 at 4:39 PM, Eric Lemoine eric.lemo...@camptocamp.com wrote: Hello I use Pylons. Pylons does: Session = scoped_session(sessionmaker()) and then: Session.configure(bind=engine) My question: with a reference to Session how

Re: [sqlalchemy] Re: Rolling back an ALTER TABLE in sqlite3?

2010-05-30 Thread Michael Bayer
On May 29, 2010, at 8:26 PM, jgarbers wrote: On May 29, 2:42 pm, Michael Bayer mike...@zzzcomputing.com wrote: to my knowledge sqlite does not support transactional DDL (seems to have some support, but its not fully operational) Hi, Michael -- and thanks for your quick help. I found a

Re: [sqlalchemy] sqlalchemy 0.5.8 or 0.6.0?

2010-05-30 Thread Michael Bayer
Please see the list of enhancements in SQLAlchemy 0.6 at http://www.sqlalchemy.org/trac/wiki/06Migration . Pylons itself does not make use of any deprecated features in SQLAlchemy. On May 30, 2010, at 12:02 PM, Krishnakant Mane wrote: Hello, I am using pylons for my web application

Re: [sqlalchemy] sqlalchemy 0.5.8 or 0.6.0?

2010-05-30 Thread Krishnakant Mane
So I asume that 0.6.0 is pritty stable. Is all the documentation upto date? Happy hacking. Krishnakant. On Sunday 30 May 2010 10:10 PM, Michael Bayer wrote: Please see the list of enhancements in SQLAlchemy 0.6 at http://www.sqlalchemy.org/trac/wiki/06Migration . Pylons itself does not make

Re: [sqlalchemy] sqlalchemy 0.5.8 or 0.6.0?

2010-05-30 Thread Alexandre Conrad
2010/5/30 Krishnakant Mane krm...@gmail.com: So I asume that 0.6.0 is pritty stable. Is all the documentation upto date? SQLAlchemy 0.6's documentation is up-to-date and probably is one of the best documentation in the Python eco-system. -- Alex twitter.com/alexconrad -- You received this

Re: [sqlalchemy] Re: For each begin_nested() call, a corresponding rollback() or commit() must be issued.

2010-05-30 Thread Michael Bayer
On May 28, 2010, at 1:46 PM, Kent Bower wrote: On 5/28/2010 10:08 AM, Michael Bayer wrote: Is the pattern that you want to keep re-issuing a savepoint repeatedly using the same name ? Does that have some different usage of resources versus issuing/closing distinct savepoints with different

Re: [sqlalchemy] Help with optimizing

2010-05-30 Thread Michael Bayer
On May 28, 2010, at 5:43 PM, Michael Bayer wrote: you can use it right now like this (assuming usage of a scoped session): OK, everything I said about this was incorrect.I failed to remember that the compiled_cache feature uses the actual statement object as a key. All of the

[sqlalchemy] joinedload-ing a 1:many lazy='dynamic'

2010-05-30 Thread chrysn
i've got problems with joinedload on a to-many property which is mapped as lazy='dynamic'. my query is runs = test.runs.options(joinedload(TestRun.questions)) (here, test.runs is a lazy='dynamic' property itself, but the important lazy='dynamic' is TestRun.questions.) if i don't set lazy on

[sqlalchemy] AUTO_INCREMENT non-primary key (but unique) column in MySQL

2010-05-30 Thread Anthony Theocharis
Hi everybody, I'm looking to create an auto increment column on a non-primary key column. I'm using SqlAlchemy 0.6.0 and MySQL 5 I can do this in plain SQL with the following: CREATE TABLE person ( id INTEGER NOT NULL AUTO_INCREMENT, first_name VARCHAR(100) NOT NULL, last_name

[sqlalchemy] Initializing ORM objects manually

2010-05-30 Thread Chris C
I'm hoping to write a Python package which integrates Sphinx Search (open-source SQL full-text search) and SQLAlchemy. Unfortunately, I don't have much insight into the internals of SQLAlchemy (though I've been reviewing the documentation/source trying to understand more..) Once I return a

Re: [sqlalchemy] joinedload-ing a 1:many lazy='dynamic'

2010-05-30 Thread Michael Bayer
need full, succinct, test case illusrtating how you get that result + sqlalchemy version in use. On May 30, 2010, at 4:46 PM, chrysn wrote: i've got problems with joinedload on a to-many property which is mapped as lazy='dynamic'. my query is runs =

Re: [sqlalchemy] AUTO_INCREMENT non-primary key (but unique) column in MySQL

2010-05-30 Thread Michael Bayer
your best bet for now is to issue an ALTER TABLE that applies the AUTO_INCREMENT, if MySQL supports that. from sqlalchemy.schema import DDL DDL(ALTER TABLE person ..., on='mysql').execute_at('after-create', person_table) On May 30, 2010, at 7:20 PM, Anthony Theocharis wrote: Hi everybody,

Re: [sqlalchemy] Help with optimizing

2010-05-30 Thread Michael Bayer
On May 30, 2010, at 3:20 PM, Michael Bayer wrote: On May 28, 2010, at 5:43 PM, Michael Bayer wrote: you can use it right now like this (assuming usage of a scoped session): OK, everything I said about this was incorrect.I failed to remember that the compiled_cache feature uses

Re: [sqlalchemy] Initializing ORM objects manually

2010-05-30 Thread Lance Edgar
On 5/30/2010 5:49 PM, Chris C wrote: I'm hoping to write a Python package which integrates Sphinx Search (open-source SQL full-text search) and SQLAlchemy. Unfortunately, I don't have much insight into the internals of SQLAlchemy (though I've been reviewing the documentation/source trying to

[sqlalchemy] Working with relationships in reflected tables

2010-05-30 Thread Urko M.
Hello, I'm using sqlalchemy 0.6.0, and reflecting a couple of tables to retrieve data. I'm not particularly interested in modifying the data for now. One of the tables has a Foreign Key to the other, and has multiple rows for each row in the main table. The purpose of this is to allow custom