[sqlalchemy] Re: relationships for no-table-related Class

2010-11-16 Thread neurino
I didn't mean mapping Root to a Table (if not necessary) is my intent, what I'd like to know is how to get the same behavior without the bloat of an extra table. make your application work a certain way (where certain way here is not clear) I make an example, maybe I'm wrong tho: let's say I

[sqlalchemy] Re: version_id_col and custom DeclarativeMeta with 0.6

2010-11-16 Thread Joril
On 15 Nov, 18:57, Michael Bayer mike...@zzzcomputing.com wrote: First off, I can't reproduce your issue: Found the culprit: I had a stray 0.5.8 directory lying around, and of course it was being picked up.. T_T Sorry :( Second, if you want to switch to newer declarative features, just stick

Re: [sqlalchemy] order_by: ArgumentError

2010-11-16 Thread Enrico Morelli
On Mon, 15 Nov 2010 15:56:06 -0500 Michael Bayer mike...@zzzcomputing.com wrote: its looking for a Column object.menus_table.c.weight instead of 'weight'. Thanks, I modified the query: main_menu = Session.query(Menu).filter(and_(Menu.parent_id==None,

[sqlalchemy] association_proxy as property?

2010-11-16 Thread A . M .
Hello, To generate json from our SQLAlchemy model objects, we are using iterate_properties to determine how to dictify the object. One of our objects uses association_proxy which we would like to represent in the JSON. Unfortunately, because it is not a property, the dictification misses this

Re: [sqlalchemy] order_by: ArgumentError

2010-11-16 Thread Michael Bayer
On Nov 16, 2010, at 6:16 AM, Enrico Morelli wrote: On Mon, 15 Nov 2010 15:56:06 -0500 Michael Bayer mike...@zzzcomputing.com wrote: its looking for a Column object.menus_table.c.weight instead of 'weight'. Thanks, I modified the query: main_menu =

Re: [sqlalchemy] association_proxy as property?

2010-11-16 Thread Michael Bayer
On Nov 16, 2010, at 11:14 AM, A.M. wrote: Hello, To generate json from our SQLAlchemy model objects, we are using iterate_properties to determine how to dictify the object. One of our objects uses association_proxy which we would like to represent in the JSON. Unfortunately, because it

Re: [sqlalchemy] Re: relationships for no-table-related Class

2010-11-16 Thread Michael Bayer
On Nov 16, 2010, at 4:19 AM, neurino wrote: I didn't mean mapping Root to a Table (if not necessary) is my intent, what I'd like to know is how to get the same behavior without the bloat of an extra table. make your application work a certain way (where certain way here is not clear)

Re: [sqlalchemy] association_proxy as property?

2010-11-16 Thread A.M.
On Nov 16, 2010, at 11:43 AM, Michael Bayer wrote: On Nov 16, 2010, at 11:14 AM, A.M. wrote: Hello, To generate json from our SQLAlchemy model objects, we are using iterate_properties to determine how to dictify the object. One of our objects uses association_proxy which we would

Re: [sqlalchemy] association_proxy as property?

2010-11-16 Thread jason kirtland
On Tue, Nov 16, 2010 at 9:05 AM, A.M. age...@themactionfaction.com wrote: On Nov 16, 2010, at 11:43 AM, Michael Bayer wrote: On Nov 16, 2010, at 11:14 AM, A.M. wrote: To generate json from our SQLAlchemy model objects, we are using iterate_properties to determine how to dictify the object.

Re: [sqlalchemy] association_proxy as property?

2010-11-16 Thread Michael Bayer
On Nov 16, 2010, at 12:05 PM, A.M. wrote: 2. implicit conversion to JSON and such is a little sloppy. You'd be better off using a structured approach like Colander: http://docs.repoze.org/colander/ It looks like I would have to either re-define all objects using the Colander syntax

[sqlalchemy] Problems when querying the database

2010-11-16 Thread Alvaro Reinoso
Hi all, I have a problem when querying the database: This channel class: class Channel(rdb.Model): Represents both complex channels and trivial ones (media) rdb.metadata(metadata) rdb.tablename(channels) id = Column(id, Integer, primary_key=True) title =

[sqlalchemy] using __mapper_args__ with Declarative ORM

2010-11-16 Thread Royce
Using version 0.6.5 under python 2.6.5 even simple augments to __mapper_args__ variable course errors E.g. from sqlalchemy import * from sqlalchemy.dialects.mysql import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class CourseAliases(Base):

Re: [sqlalchemy] using __mapper_args__ with Declarative ORM

2010-11-16 Thread Michael Bayer
primary_key argument to mapper is a list primary_key=[my_column, my_other_column, ..] clearly this is a bug: http://www.sqlalchemy.org/docs/orm/mapper_config.html#, ill change that now I'll see if I can add a scalar-list adapter in 0.7 for that arg On Nov 16, 2010, at 4:53 PM, Royce

[sqlalchemy] declarative one to many relationship with composite primary key

2010-11-16 Thread Adrien
Hi list, Sorry if this is trivial, I'm relatively new to sqlalchemy. I'm trying to set a one to many relationship between class Foo and class Bar (ie Foo should have a list of Bars). Foo has a composite primary key. # from sqlalchemy import * from sqlalchemy.orm

Re: [sqlalchemy] declarative one to many relationship with composite primary key

2010-11-16 Thread Michael Bayer
ForeignKeyConstraint needs to go into __table_args__ when using declarative. http://www.sqlalchemy.org/docs/orm/extensions/declarative.html#table-configuration On Nov 16, 2010, at 6:28 PM, Adrien wrote: Hi list, Sorry if this is trivial, I'm relatively new to sqlalchemy. I'm trying to set