[sqlalchemy] How to resolve ForeignKey to object reference

2012-01-25 Thread Tim Black
My *model* is like this: __init__.py: from projects.model.auth import User from projects.model.main import Company auth.py: class User(DeclarativeBase): company_id = Column('company_id', Integer, ForeignKey('company.id')) # many-to-one main.py: class Company(DeclarativeBase): id =

Re: [sqlalchemy] How to resolve ForeignKey to object reference

2012-01-25 Thread Tim Black
On 01/25/2012 01:57 PM, Tim Black wrote: My *model* is like this: __init__.py: from projects.model.auth import User from projects.model.main import Company auth.py: class User(DeclarativeBase): company_id = Column('company_id', Integer, ForeignKey('company.id')) # many-to-one

Re: [sqlalchemy] order_by on model property

2011-09-08 Thread Tim Black
-distinct-from-attribute-behavior The float() call in SQL would likely be using CAST, so take a look at http://www.sqlalchemy.org/docs/core/expression_api.html?highlight=cast#sqlalchemy.sql.expression.cast for that. On Sep 7, 2011, at 2:27 PM, Tim Black wrote: What is the right way to use

[sqlalchemy] order_by on model property

2011-09-07 Thread Tim Black
What is the right way to use .order_by() to order by the values returned by a model object property? My model object is like this: class Project(DeclarativeBase): __tablename__ = 'project' id = Column(Integer, primary_key=True) ... @property def remainderDue(self):

Re: [sqlalchemy] Error: When initializing mapper, expression failed to locate a name (name is not defined).

2011-08-17 Thread Tim Black
the mappings. On Aug 13, 2011, at 4:01 PM, Tim Black wrote: I'm getting the following error message running TurboGears 2.1.1 and SQLAlchemy 0.7.2, using TurboGears' multiple database setup described here: http://turbogears.org/2.1/docs/main/MultipleDatabases.html. Both databases are SQLite3

Re: [sqlalchemy] Error: When initializing mapper, expression failed to locate a name (name is not defined).

2011-08-17 Thread Tim Black
will be used for all classes, mappers, and tables except where another engine is specified by binds. For brevity's sake, I note that 1. is implicit in 2. Tim On Aug 17, 2011, at 12:03 PM, Tim Black wrote: Michael, Thank you for your advice. It took me a while to figure out how to follow

Re: [sqlalchemy] Error: When initializing mapper, expression failed to locate a name (name is not defined).

2011-08-17 Thread Tim Black
On 08/17/2011 02:05 PM, Michael Bayer wrote: On Aug 17, 2011, at 1:06 PM, Tim Black wrote: But here is how the docs could be made more clear - simply state 1. whether it is allowable to use bind and binds simultaneously on the same object, and (if 2. is the case) 2. that the engine specified

Re: [sqlalchemy] Error: When initializing mapper, expression failed to locate a name (name is not defined).

2011-08-17 Thread Tim Black
On 08/17/2011 03:30 PM, Tim Black wrote: On 08/17/2011 02:05 PM, Michael Bayer wrote: On Aug 17, 2011, at 1:06 PM, Tim Black wrote: But here is how the docs could be made more clear - simply state 1. whether it is allowable to use bind and binds simultaneously on the same object, and (if 2

[sqlalchemy] Error: When initializing mapper, expression failed to locate a name (name is not defined).

2011-08-13 Thread Tim Black
I'm getting the following error message running TurboGears 2.1.1 and SQLAlchemy 0.7.2, using TurboGears' multiple database setup described here: http://turbogears.org/2.1/docs/main/MultipleDatabases.html. Both databases are SQLite3 databases; one is the main database for the TurboGears app; the

Re: [sqlalchemy] sqlalchemy and desktop apps

2010-09-13 Thread Tim Black
I'm not sure to what extent it works at present, but someone ported OpenERP server to work with SQLAlchemy: http://openerp-team.blogspot.com/2009/08/open-erp-server-with-mysql.html And some parts of OpenERP look like they use SQLAlchemy: