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

2009-07-22 Thread Randy Syring
On Jul 22, 9:02 pm, Michael Bayer 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/databases/sqlite.py in

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

2009-07-22 Thread Michael Bayer
On Jul 22, 2009, at 8:48 PM, Randy Syring wrote: > > I work with the OP. The columns are correctly typed and the > reflection code seems to work correctly with views that are directly > selecting from tables. Its when a view selects from another view that > we have problems with the type being

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

2009-07-22 Thread Randy Syring
I work with the OP. The columns are correctly typed and the reflection code seems to work correctly with views that are directly selecting from tables. Its when a view selects from another view that we have problems with the type being lost. Can anyone else say for sure whether it is supported

[sqlalchemy] Re: How to define 'count' as an SQL mapped attribute for many-to-many relationships?

2009-07-22 Thread Michael Bayer
good idea I added a ticket for that. bojanb wrote: > > There was an error in my posted code, I meant: > > 'book_count': column_property(select([func.count(books.c.id)], > book_authors.c.author_id==authors.c.id).label('books_count')) > > but that's irrelevant. > > Using and_(), the *correct* defin

[sqlalchemy] Re: How to define 'count' as an SQL mapped attribute for many-to-many relationships?

2009-07-22 Thread bojanb
There was an error in my posted code, I meant: 'book_count': column_property(select([func.count(books.c.id)], book_authors.c.author_id==authors.c.id).label('books_count')) but that's irrelevant. Using and_(), the *correct* definition is: 'book_count': column_property(select([func.count(books.c

[sqlalchemy] Re: How to define 'count' as an SQL mapped attribute for many-to-many relationships?

2009-07-22 Thread Michael Bayer
bojanb wrote: > mapper(Book, books) > mapper(Author, authors, properties={ > 'books': relation(Book, secondary=book_authors, > backref='authors'), > 'book_count': column_property(select([func.count(books.c.id)], > book_authors.c.author_id==books.c.id).label('books_count')) > }) > the

[sqlalchemy] Re: How to do the mapper configuration when the left table and right table of Association Object are the same?

2009-07-22 Thread Michael Bayer
Stone Puzzle wrote: > > I got those error messages > ArgumentError: Could not determine join condition between parent/child > tables on relation Friend.user. Specify a 'primaryjoin' expression. If > this > is a many-to-many relation, 'secondaryjoin' is needed as well. primaryjoin and secondaryjoi

[sqlalchemy] Insert failure on MySQL InnoDB tables

2009-07-22 Thread 나종열
Hi, I'm using SA 0.5.5 with MySQL 5.0 I had no problems doing insertions on my InnoDB tables with SA 0.4.8 ubuntu dist However since yesterday, after upgrading to 0.5.5, insertions won't work my InnoDB tables. MyISAM tables work just fine. Anyone have similar problems? Thanks in advance Sammy

[sqlalchemy] How to define 'count' as an SQL mapped attribute for many-to-many relationships?

2009-07-22 Thread bojanb
I'm not sure if this is a bug or I am just setting up the attribute wrong. Anyways, I'm having a problem defining count-type SQL mapped attribute in a situation with many-to-many relationships. The example here uses the classic book-author many-to-many relation. An author can have many books, and

[sqlalchemy] How to do the mapper configuration when the left table and right table of Association Object are the same?

2009-07-22 Thread Stone Puzzle
I am confused when I want to define the relation of User and User's Friends (a user is another user's friend) There is a example about association object pattern at http://www.sqlalchemy.org/docs/05/mappers.html#association-object Code from the document: left_table = Table('left', metadata,