[sqlalchemy] Re: autoload of db view treating columns as Decimal

2009-07-23 Thread Randy Syring
On Jul 22, 9:02 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 22, 2009, at 8:48 PM, Randy Syring wrote: well this is really easy to analyze, turn on echo=debug and see what SQLite is returning. The mapping of SQLite names to SQLA column types in the 0.5 series is in

[sqlalchemy] Re: autoload of db view treating columns as Decimal

2009-07-23 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Randy Syring Sent: 23 July 2009 07:23 To: sqlalchemy Subject: [sqlalchemy] Re: autoload of db view treating columns as Decimal Well, I am not really sure what the problem

[sqlalchemy] More SA, pyodbc, *nux and MSSQL problems

2009-07-23 Thread Ed Singleton
I've managed to get SA (0.6 branch) and pyodbc connecting to an MSSQL db on Mac OS X, but I've recently been trying to get it working on linux (Debian Lenny) and have been hitting some problems. It's definitely working to some degree. Adding TDS_Version = 8.0 to my odbc.ini fixed some

[sqlalchemy] Re: 'pool_recycle' is not working

2009-07-23 Thread Michael Bayer
On Jul 23, 2009, at 3:44 AM, iSean wrote: Hi, I think 'pool_recycle' is not working. My configuration is: MySql wait_timeout=10 pool_size=10 pool_recycle=5 max_overflow=2 I do one select first, and sleep 15 seconds waiting for connection timeout, at last do other one select. It

[sqlalchemy] lazy=False generated bad SQL

2009-07-23 Thread Mike Conley
I don't know if this is a bug or I don't understand eager loading When I try to eager load a relation containing an order_by clause, the generated SQL fails. It seems that the generated SQL does not account for the fact that the table is internally aliased by SQLAlchemy in the query. File

[sqlalchemy] Re: lazy=False generated bad SQL

2009-07-23 Thread Michael Bayer
Mike Conley wrote: I don't know if this is a bug or I don't understand eager loading eager loading doesn't understand your string bullets.position - it renders it directly as you've specified and can't do anything intelligent with it such as alias it. Specify it as bullets.c.position, or to

[sqlalchemy] Doubts on relation with cascade delete by backend

2009-07-23 Thread sandro dentella
Hi, I have a simple setup that may be summarized as: class User(Base): __tablename__ = 'user' name = Column(String(20), primary_key=True) class Mail(Base): __tablename__ = 'address' mail = Column(String(20), primary_key=True) user_name =

[sqlalchemy] Re: Doubts on relation with cascade delete by backend

2009-07-23 Thread Michael Bayer
add passive_deletes = True sandro dentella wrote: Hi, I have a simple setup that may be summarized as: class User(Base): __tablename__ = 'user' name = Column(String(20), primary_key=True) class Mail(Base): __tablename__ = 'address' mail =

[sqlalchemy] Declarative, correlated subqueries

2009-07-23 Thread Gregg Lind
I have read over http://www.sqlalchemy.org/docs/05/ormtutorial.html#using-subqueries and http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg11439.html, but I'm having trouble putting the pieces together. In the demo() below, I want to find the row in the database with the max for every

[sqlalchemy] Re: Declarative, correlated subqueries

2009-07-23 Thread Michael Bayer
Gregg Lind wrote: I have read over http://www.sqlalchemy.org/docs/05/ormtutorial.html#using-subqueries and http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg11439.html, but I'm having trouble putting the pieces together. In the demo() below, I want to find the row in the database

[sqlalchemy] Re: Declarative, correlated subqueries

2009-07-23 Thread Gregg Lind
On Thu, Jul 23, 2009 at 3:24 PM, Michael Bayermike...@zzzcomputing.com wrote: im assuming you're using MySQL since the GROUP BY below doesn't accommodate every column in the subquery (would be rejected by most DBs). Corrected. It was Sqlite, but good catch. youll want to query each column

[sqlalchemy] Re: Declarative, correlated subqueries

2009-07-23 Thread Michael Bayer
On Jul 23, 2009, at 5:20 PM, Gregg Lind wrote: How do I implement this join? If I do this: sq = session .query (Route .ts ,Route .startpoint,Route.target,func.max(Route.hop_id).label('max_hop')) sq = sq.group_by(Route.ts,Route.startpoint,Route.target).subquery() then: q =

[sqlalchemy] Re: Declarative, correlated subqueries

2009-07-23 Thread Michael Bayer
On Jul 23, 2009, at 8:43 PM, Gregg Lind wrote: Hm. I appreciate the help, but something is clearly still failing here. session.query(Route,*sq.c).join(sq.c.max_hop) ArgumentError: Can't find any foreign key relationships between 'route' and 'max_hop' Maybe the filter based solution

[sqlalchemy] Re: Declarative, correlated subqueries

2009-07-23 Thread Gregg Lind
Hm. I appreciate the help, but something is clearly still failing here. session.query(Route,*sq.c).join(sq.c.max_hop) ArgumentError: Can't find any foreign key relationships between 'route' and 'max_hop' Maybe the filter based solution is just fine here :) On Thu, Jul 23, 2009 at 7:29 PM,

[sqlalchemy] Unsaved, pending instance and is an orphan problem

2009-07-23 Thread Victor Lin
Hi, I am writing a turbogears2 application, with elixir. I got a problem when I try to create an new entity and attach it to another entity. I create a simple program to repruduce the problem: from elixir import * class User(Entity): name = Field(Unicode) site = OneToOne('Site',