[sqlalchemy] Re: Elixir performance

2007-09-06 Thread Gaetan de Menten
On 9/5/07, Paul Johnston [EMAIL PROTECTED] wrote: data. I did some benchmarks a while back to see how everything stacked up as I was wondering if I was doing everything the hard way (in C++) instead of using SqlAlchemy, etc. TurboEntity is the same as Great work Eric. I am quite

[sqlalchemy] Re: [patch] max() arg is an empty sequence while trying to reflect bugzilla table

2007-09-06 Thread Marcin Kasperski
Michael Bayer [EMAIL PROTECTED] writes: hey Marcin - Seems like Jason Kirtland is out today. Any chance you could add a simple test case to test/dialect/mysql.py for this ? Seems he already did this ;-) And he also improved my patch, in the meantime I discovered that while my patch was

[sqlalchemy] max/coalesce bug in 0.4?

2007-09-06 Thread Koen Bok
Hi there, I am upgrading my app to 0.4 and while it's going pretty well, I encountered something strange. I have the following code: request_table = Table('request', metadata, Column('id', Integer, primary_key=True), ... Column('metanumberstate', Integer, nullable=False,

[sqlalchemy] Re: max/coalesce bug in 0.4?

2007-09-06 Thread Michael Bayer
all the default SQL functions are being executed inline here. so it doesnt like aggregates like max being placed into defaults like that. the best I can do for you here, other than rolling back the entire inilne default thing, would look like this: Column('foo', Integer,

[sqlalchemy] Re: Elixir performance

2007-09-06 Thread Michael Bayer
since performance is the hot topic these days, I thought Id note that I've made some ORM improvements in the current SQLAlchemy trunk. We have a profiling test that loads 10 objects each with 50 child objects, eagerly loaded across 500 rows. Version 0.3.10 uses 70040 function calls,

[sqlalchemy] Re: max/coalesce bug in 0.4?

2007-09-06 Thread Koen Bok
Tried that, but it just places the select statement within the insert statement without brackets: 2007-09-06 18:00:57,603 INFO sqlalchemy.engine.base.Engine.0x..90 INSERT INTO request (id, metanumberstate) VALUES (%(id)s, SELECT coalesce(max(metanumber.id), %(coalesce)s) FROM metanumber)

[sqlalchemy] Re: max/coalesce bug in 0.4?

2007-09-06 Thread Michael Bayer
OK that one is fixed in r3467. On Sep 6, 2007, at 12:02 PM, Koen Bok wrote: Tried that, but it just places the select statement within the insert statement without brackets: 2007-09-06 18:00:57,603 INFO sqlalchemy.engine.base.Engine.0x..90 INSERT INTO request (id, metanumberstate) VALUES

[sqlalchemy] datetime objects unique by date(disregarding time)

2007-09-06 Thread Pedro Algarvio, aka, s0undt3ch
How could one get only the unique dates from a datetime column, disregarding the time part of the datetime object? I know I can do: s = model.sqla.select([model.channel_events.c.stamp], model.channel_events.c.channel_participation_id == 5) results = model.Session.execute(s).fetchall() for

[sqlalchemy] Re: [patch] max() arg is an empty sequence while trying to reflect bugzilla table

2007-09-06 Thread jason kirtland
Marcin wrote: Seems he already did this ;-) And he also improved my patch, in the meantime I discovered that while my patch was sufficient to avoid the failure, internally enum values were not correctly extracted (noticed this while inspecting in the debugger, not sure whether it is of any

[sqlalchemy] Re: datetime objects unique by date(disregarding time)

2007-09-06 Thread Michael Bayer
you can probably select on DISTINCT trunc(day, somedate) SA would do this like select([distinct(func.trunc(day, mytable.c.datecol))]) On Sep 6, 2007, at 1:37 PM, Pedro Algarvio, aka, s0undt3ch wrote: How could one get only the unique dates from a datetime column, disregarding the

[sqlalchemy] sqlalchemy.select() and tablename.select() why are they different?

2007-09-06 Thread Lukasz Szybalski
Hello, So it seems to me there are two select function that I can use but they are different First: s=Users.select(Users.c.LASTNAME=='Smith') but when you want to select only two columns via : s=Users.select([Users.c.LASTNAME, Users.c.FIRSTNAME], Users.c.LASTNAME =='Smith') you get an error :

[sqlalchemy] Re: datetime objects unique by date(disregarding time)

2007-09-06 Thread Mike Orr
On 9/6/07, Pedro Algarvio, aka, s0undt3ch [EMAIL PROTECTED] wrote: How could one get only the unique dates from a datetime column, disregarding the time part of the datetime object? MySQL has a DATE() function that chops off the time part. I don't know if Postgres has the same. import

[sqlalchemy] Re: datetime objects unique by date(disregarding time)

2007-09-06 Thread jason kirtland
Some other postgres-friendly options from the IRC channel: select([func.date(model.channel_events.c.stamp)], distinct=True) or select([cast(model.channel_events.c.stamp, Date)], distinct=True) The latter should be portable anywhere, I think. Not sure about the first beyond the 3 usual open

[sqlalchemy] Re: sqlalchemy.select() and tablename.select() why are they different?

2007-09-06 Thread sdobrev
On Thursday 06 September 2007 23:03:35 Lukasz Szybalski wrote: Hello, So it seems to me there are two select function that I can use but they are different First: s=Users.select(Users.c.LASTNAME=='Smith') but when you want to select only two columns via : s=Users.select([Users.c.LASTNAME,

[sqlalchemy] bitemporal mixin recipe in dbcook

2007-09-06 Thread sdobrev
hi. For those interested, i've put a bitemporal mixin class under dbcook/misc/timed2/. It handles Objects with multiple versions (history), disabled/enabled state, and stays sane with same-timestamp-versions. The available queries are: - get_time_clause( times): return the clause

[sqlalchemy] Re: sqlalchemy.select() and tablename.select() why are they different?

2007-09-06 Thread Lukasz Szybalski
On 9/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Thursday 06 September 2007 23:03:35 Lukasz Szybalski wrote: Hello, So it seems to me there are two select function that I can use but they are different First: s=Users.select(Users.c.LASTNAME=='Smith') but when you want to

[sqlalchemy] Re: sqlalchemy.select() and tablename.select() why are they different?

2007-09-06 Thread Michael Bayer
On Sep 6, 2007, at 11:28 PM, Lukasz Szybalski wrote: Otherwise questions arise: which one do i do filter(), filter_by(), query() select() select_by() Is order_by a passed in parameter or function of a filter() or query() or is it ? Why do I have to specify all()? Shouldn't that be a

[sqlalchemy] Re: Elixir performance

2007-09-06 Thread EricHolmberg
I am quite surprised at the results. I would have thought ActiveMapper/TurboEntity would only be marginally slower than plain SQLAlchemy. And again, I'm surprised that SA is faster than MySQLdb. How does that work out? I though SA used MySQLdb??? Your use of query cache and best of three