[sqlalchemy] Sqlalchemy & Stored Procedures

2008-04-07 Thread Madhu Alagu
Hi, I would like to use advantage of the Sqlalchemy & Stored Procedures. engine = create_engine('postgres://postgres:[EMAIL PROTECTED]:5432/ neithal', echo=True) session = scoped_session(sessionmaker(bind=eng,transaction=True,autoflush=False)) trans=session.begin() sql = select([func.add_user

[sqlalchemy] Re: has() and multiple tables

2008-04-07 Thread Jonathan Ellis
On 4/7/08, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Apr 7, 2008, at 4:54 PM, Tim Lesher wrote: > > session > > .query(Action).filter(Action.task.has(Connection.caller==caller1)) > for this kind of thing, you're joining across three tables, so you can > put an extra join condition in the h

[sqlalchemy] Re: sqlalchemy 0.4.5 released

2008-04-07 Thread Empty
> > i.e. > > session.query([MappedObject.id, > > MappedObject.name]).filter(...).all() I actually thought of this mapping as well. Only because it seemed consistent with select. Granted I don't understand all the reasons why it could / could not work. That said I'm happy with value

[sqlalchemy] Re: has() and multiple tables

2008-04-07 Thread Michael Bayer
On Apr 7, 2008, at 4:54 PM, Tim Lesher wrote: > > I'm having some trouble using the has() operator to avoid a long chain > of joins in a select. > > > session > .query(Action).filter(Action.task.has(Connection.caller==caller1)) > > However, this appears to generate a cartesian join on the 'tasks

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-07 Thread Rick Morrison
> The limitation here I guess is 30 char identifier limit but I will > need to test it. Ah yeah, you're going to have bigger problems than 30 char identifiers with the Sybase TDS settings. MSSQL uses a different set of wire-protocol representations of datetime types, and your dates are going to be

[sqlalchemy] Re: mssql, Linux, unixODBC - Could not locate column in row for column

2008-04-07 Thread Lukasz Szybalski
On Thu, Apr 3, 2008 at 1:36 PM, Lukasz Szybalski <[EMAIL PROTECTED]> wrote: > On Wed, Apr 2, 2008 at 4:24 PM, Michael Bayer <[EMAIL PROTECTED]> wrote: > > Gottit. Notice, pyodbc is truncating all the column names to 30 > characters. > > anyway, thats why its broken. Is this a bug in pyodbc ?

[sqlalchemy] has() and multiple tables

2008-04-07 Thread Tim Lesher
I'm having some trouble using the has() operator to avoid a long chain of joins in a select. A stripped-down version of my schema looks like this: a Caller has a (phone) number. A Caller can create Connections (each to a phone number). A Connection can involve one or more Tasks, each of which

[sqlalchemy] Re: Save instead of update

2008-04-07 Thread Michael Bayer
On Apr 6, 2008, at 11:19 PM, Michael Robellard wrote: > > Michael, > > Thanks for your reply. I have been trying what you suggested as well > as several variants > and I keep getting stuck with something along the lines of: > > FlushError: New instance [EMAIL PROTECTED] with identity key > ( dbm

[sqlalchemy] Re: web application too slow

2008-04-07 Thread Rick Morrison
> But to ask otherwise, is there anybody else who has experienced > similar performance problems when accessing lots of heavy eagerloaded > sqlalchemy models wich are all already in the memory? My app does quite a bit of heavy eagerloading in a lazy as-needed fashion, and then clears the session u

[sqlalchemy] Re: web application too slow

2008-04-07 Thread tux21b
On Apr 7, 4:48 pm, Ross Vandegrift <[EMAIL PROTECTED]> wrote: > In other words - make sure the slowness isn't the client :) I hope this post wasn't serious. Mozilla's CSS rendering engine, doesn't write in our python profile on the server and no, we don't use Mozilla for benchmarking (we are curr

[sqlalchemy] Re: web application too slow

2008-04-07 Thread Ross Vandegrift
On Sun, Apr 06, 2008 at 05:26:31PM -0700, tux21b wrote: > It's an Apache 2 with mod_wsgi. The server setup isn't configured for > performance yet, and we can probably tune it a bit. But even when I > test with the wsgi-ref server (without parallel requests) the > application is slow. Beside sqlalc

[sqlalchemy] Re: Creating multiple tables based on the same class

2008-04-07 Thread Bobby Impollonia
Yes, you can have the same class be associated with different tables at different times. Sqlalchemy uses a 'maper' to associate a class with a table. You can define multiple mappers for the same class that map it to different tables. One of these will be the primary mapper and will be used by def

[sqlalchemy] Re: Insert Expressions - Executing Multiple Statements

2008-04-07 Thread Rick Morrison
> > > You could specify that fullname is null (None) for the columns that > don't have a full name value. > In fact you *need* to do that. The insert statement is compiled based on the first set of values given, so that will drive the remainder of the operation. --~--~-~--~~--

[sqlalchemy] Creating multiple tables based on the same class

2008-04-07 Thread GK
This is another "I'm new to SQLAlchemy" kind of question... I have two datasets that have exactly the same structure, and I wish to create separate database tables for these that are mapped to/from the structure of same underlying Python class. I looked for discussion of this in the SQLAlchemy m

[sqlalchemy] Re: Insert Expressions - Executing Multiple Statements

2008-04-07 Thread Bobby Impollonia
You could specify that fullname is null (None) for the columns that don't have a full name value. On Mon, Apr 7, 2008 at 8:04 AM, Carla <[EMAIL PROTECTED]> wrote: > > Hello all > > I'd like to insert more than one expression in a table. Some > expressions don't have an entry in every column: >

[sqlalchemy] Insert Expressions - Executing Multiple Statements

2008-04-07 Thread Carla
Hello all I'd like to insert more than one expression in a table. Some expressions don't have an entry in every column: >>> conn = engine.connect() >>> conn.execute(addresses.insert(), [ ...{'name': 'mike', 'email_address' : '[EMAIL PROTECTED]'}, ...{'name': 'wendy', 'fullname': 'Wendy

[sqlalchemy] Re: Does SQLAlchemy ORM use column indexes to optimize queries?

2008-04-07 Thread GK
Jason, Thanks for your examples - there are lots of useful SQLAlchemy coding hints in there for me... On Apr 5, 5:30 pm, jason kirtland <[EMAIL PROTECTED]> wrote: > GK wrote: > > Michael, > > > Thank you for your response - it was very helpful for me. > > > It turns out my main problem was that

[sqlalchemy] Re: why something not show the updated items ?

2008-04-07 Thread ZhangShen Peng(Uestc graduating...)
now I use like this class Feed(Entity): has_property('posts',dynamic_loader(Post)) everything is ok ! My english is pool , so I don't know how to express the appreciate for your help . I just want to say THANKS VERY VERY MUCH :) On Mon, Apr 7, 2008 at 12:39 AM, Michael Bayer <[EMAIL PRO