[sqlalchemy] order_by(datetime)

2011-01-10 Thread F.A.Pinkse
Hi All. I have a datetime column in my model. If I do an .order_by I get year-month-day but how do I do an order_by to get month-day-year? or even a day-month-year Thanks, Frans. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to

Re: [sqlalchemy] order_by(datetime)

2011-01-10 Thread Michael Bayer
you'd need to use SQL functions that break the datetime into its component parts, and order by them. such as: order_by(func.datepart(MONTH, my_date_col), func.datepart(DAY, my_date_col), func.datepart(YEAR, my_date_col)) datepart routines vary by database backend with very little cross

Re: [sqlalchemy] Re: partial rollback in transaction ?

2011-01-10 Thread Michael Bayer
One important change here is to change the engine type to InnoDB, otherwise transactions are entirely meaningless with MySQL. If I use InnoDB, the end result of used is 0 in all cases. If I don't and use MyISAM, the end result of used is 1 in all cases, regardless of whether InviteCode is

[sqlalchemy] Re: Gracefully recovering from MySQL failures in a connection pool

2011-01-10 Thread Don Dwiggins
On 1/7/2011 7:52 AM, Michael Bayer wrote: the disconnect detection has to be implemented individually for each DBAPI for each backend. pymssql is not very frequently used so this would appear to be a missing message. We currently intercept: Error 10054, Not

Re: [sqlalchemy] SQLAlchemy 0.6.6 Released

2011-01-10 Thread Chris Withers
On 09/01/2011 16:25, Michael Bayer wrote: The limitations of distutils are also troubling here. In my own work app, we use pip in conjunction with a Makefile and for the SQLAlchemy install the flag is on in the Makefile. In that regard the flag being off by default doesn't feel like that

[sqlalchemy] Relationship (Foreign key) inside composite column

2011-01-10 Thread Arturo Sevilla
Hello, I'm trying to do the following: 'home': orm.composite( Address, user.c.HomeAddress_Street, # The following column is a UUID but is a foreign key to a mapped # table in SQLAlchemy, ideally would be to say relationship(City)

[sqlalchemy] Relationships : how to properly filter children ?

2011-01-10 Thread Franck
Dear all, I'm developing a website aimed at handling tournaments' results and subscriptions. One subscription is bound to one user and one tournament. subscriptions_table = Table('SUBSCRIPTIONS', metadata, ... Column('tournament_id', Integer,

Re: [sqlalchemy] Relationship (Foreign key) inside composite column

2011-01-10 Thread Michael Bayer
On Jan 10, 2011, at 1:10 PM, Arturo Sevilla wrote: Hello, I'm trying to do the following: 'home': orm.composite( Address, user.c.HomeAddress_Street, # The following column is a UUID but is a foreign key to a mapped # table in

[sqlalchemy] Re: Relationship (Foreign key) inside composite column

2011-01-10 Thread Arturo Sevilla
Hello, Thanks again for the quick reply! I tried to isolate all the mapper columns to try to make it less confusing, now I know that was not a good idea. orm.mapper(User, user, properties={ 'id': user.c.ID, '_first_name': user.c.FirstName, '_middle_name':

Re: [sqlalchemy] Re: Relationship (Foreign key) inside composite column

2011-01-10 Thread Michael Bayer
On Jan 10, 2011, at 2:21 PM, Arturo Sevilla wrote: Hello, Thanks again for the quick reply! I tried to isolate all the mapper columns to try to make it less confusing, now I know that was not a good idea. orm.mapper(User, user, properties={ 'id': user.c.ID,

Re: [sqlalchemy] combining join with alias

2011-01-10 Thread Petra Clementson
On Sat, Jan 8, 2011 at 7:59 PM, Petra Clementson petraclement...@gmail.comwrote: On Sat, Jan 8, 2011 at 10:38 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Jan 8, 2011, at 3:23 PM, Petra Clementson wrote: I want to do a self join on combined but it wont let me. Essensially, I

[sqlalchemy] Re: partial rollback in transaction ?

2011-01-10 Thread Romy
Face palm.. missed the forest for the trees. Does this mean both tables would need to be InnoDB ? On Jan 10, 7:10 am, Michael Bayer mike...@zzzcomputing.com wrote: One important change here is to change the engine type to InnoDB, otherwise transactions are entirely meaningless with MySQL.

Re: [sqlalchemy] combining join with alias

2011-01-10 Thread Michael Bayer
On Jan 10, 2011, at 3:47 PM, Petra Clementson wrote: Okay, so I implemented join(A, B).alias(), but I can't seem to access the columns of the aliased table. Here is my code: session = sessionfactory() combined_1 = join(DiskFile, Header).alias() combined_2 = join(DiskFile,

Re: [sqlalchemy] Re: partial rollback in transaction ?

2011-01-10 Thread Michael Bayer
yah MySQL doesn't really operate with a mixture. On Jan 10, 2011, at 4:13 PM, Romy wrote: Face palm.. missed the forest for the trees. Does this mean both tables would need to be InnoDB ? On Jan 10, 7:10 am, Michael Bayer mike...@zzzcomputing.com wrote: One important change here is to

[sqlalchemy] Re: order_by(datetime)

2011-01-10 Thread F.A.Pinkse
Hi Michael, Thanks for your quick reply. I understand. I am using SQLite as the engine. I have not found the functions needed in the doc. I will leave this sort option open and stick with SQlite for a while. Frans Op 1/10/2011 4:03 PM, Michael Bayer schreef: you'd need to use SQL

[sqlalchemy] Re: partial rollback in transaction ?

2011-01-10 Thread Romy
Not sure what you mean, as I've seen hybrid setups before. In any case, thanks for helping me narrow this down. I need to decide whether I'll need real transactions here. Despite being an oversight on my part, do you think perhaps the docs for rollback / commit should mention DB support ? I did