Re: [sqlalchemy] Performance: orm vs sql

2010-08-18 Thread Michael Bayer
On Aug 18, 2010, at 4:16 PM, Michael Hipp wrote: > The little diddly below is comparing performance of orm access vs sql > expression language. > > When I run it with number=1 I get a 5.8x advantage for sql. When I run it 10 > times I get a 2.7x advantage. The actual numbers are, respectively:

Re: [sqlalchemy] Re: INSERT…RETURNING being issued wrongly

2010-08-18 Thread Michael Bayer
On Aug 18, 2010, at 12:29 PM, Oliver Beattie wrote: > On Aug 18, 3:39 pm, Michael Bayer wrote: >> Sent from my iPhone >> >> On Aug 18, 2010, at 8:27 AM, Oliver Beattie wrote: >> >> >> >> >> >>> I'm not entirely sure why this is happening… it seems to work for me >>> in nearly all other ci

Re: [sqlalchemy] Performance: orm vs sql

2010-08-18 Thread Alexandre Conrad
Hello Michael, 2010/8/18 Michael Hipp : > > Is this a typical/expected difference in performance between the two query > methods? > Yes. This is expected. When you use the ORM, SQLAlchemy has to instantiate Python objects and populate each property from the result set (and maybe more objects fr

[sqlalchemy] Re: Performance: orm vs sql

2010-08-18 Thread Michael Hipp
I should have added that this is running across a 100M LAN to an Ubuntu server running PostgreSQL 8.4.4. The client is a Win7 system on Python 2.6.5. SA is version 0.6.3. Michael On 8/18/2010 3:16 PM, Michael Hipp wrote: The little diddly below is comparing performance of orm access vs sql e

[sqlalchemy] Performance: orm vs sql

2010-08-18 Thread Michael Hipp
The little diddly below is comparing performance of orm access vs sql expression language. When I run it with number=1 I get a 5.8x advantage for sql. When I run it 10 times I get a 2.7x advantage. The actual numbers are, respectively: 1.47375132 0.25630808 5.45569524 1.96911144 Is this a t

[sqlalchemy] Re: dictionary-like objects for ORM

2010-08-18 Thread yota
I start to understand how the mapper works, so I can refine my example (everything is fictional, just a textbook example) Let's say I moreover want to manage playlists with in a table as such as PLAYLIST_TABLE ( playlist_ident * , track_ident ) now, in fact, I don't need to store any information

[sqlalchemy] Which columns changing during orm commit?

2010-08-18 Thread Michael Hipp
SQLAlchemy seems pretty smart about updating only the changed columns in an orm object... If I have an orm object. Something changes one of the columns. Just before I commit() the session, is there a way to tell which columns will be updated vs those that are unchanged? Any way to ascertain

[sqlalchemy] Re: INSERT…RETURNING being issued wro ngly

2010-08-18 Thread Oliver Beattie
On Aug 18, 3:39 pm, Michael Bayer wrote: > Sent from my iPhone > > On Aug 18, 2010, at 8:27 AM, Oliver Beattie wrote: > > > > > > > I'm not entirely sure why this is happening… it seems to work for me > > in nearly all other circumstances so I'm a bit stumped. Basically, I > > have a declarative

Re: [sqlalchemy] How to get read-only objects from database?

2010-08-18 Thread Conor
On 08/18/2010 10:27 AM, Alvaro Reinoso wrote: > Hello, > > I'd like to query the database and get read-only objects with session > object. I need to save the objects in my server and use them through > the user session. If I use a object outside of the function that calls > the database, I get this

[sqlalchemy] sqlalchemy-migrate examples

2010-08-18 Thread Chris Withers
Hi All, Does anyone have any good examples of migration scripts? The documentation is surprisingly sparse.. Of course, an alernative which doesn't do any abusive monkey patching or have any annoying * imports would be handy. Michael, how's Alembic coming? Chris -- You received this message b

[sqlalchemy] How to get read-only objects from database?

2010-08-18 Thread Alvaro Reinoso
Hello, I'd like to query the database and get read-only objects with session object. I need to save the objects in my server and use them through the user session. If I use a object outside of the function that calls the database, I get this error: "DetachedInstanceError: Parent instance is not b

[sqlalchemy] Re: dictionary-like objects for ORM

2010-08-18 Thread yota
Thank you very much for the source, I also learned the term of vertical paradigm and stumble upon the dictlike.py example in the sqlalchemy source ... even if yours remains simpler On Aug 18, 5:05 pm, Conor wrote: > On 08/17/2010 11:32 AM, yota wrote: > > > > > Hello, > > > sqlalchemy seems to

Re: [sqlalchemy] dictionary-like objects for ORM

2010-08-18 Thread Conor
On 08/17/2010 11:32 AM, yota wrote: > Hello, > > sqlalchemy seems to be the proper tool for my needs but I can't figure > out how to design my project or set the ORM properly. > > Let's say, I build a music database, storing tracks and their > associated metadata in an sql-like database defined as

Re: [sqlalchemy] SqlAlchemy logging FAQ

2010-08-18 Thread Kent Bower
Ah. Then the problem is in turbogears (which creates a default .ini file with): #echo shouldn't be used together with the logging module. sqlalchemy.echo = false sqlalchemy.echo_pool = false sqlalchemy.pool_recycle = 3600 ...logging sections... ===

Re: [sqlalchemy] Re: Eager/joined loading of JTI models

2010-08-18 Thread Michael Bayer
On Aug 17, 2010, at 5:05 PM, flzz wrote: > Thanks this did the trick, I agree, an option in relationship to > define how this behaves would be nice. its a long term TODO. > > Cheers > Etrik > > On Aug 17, 3:27 pm, Conor wrote: >> On 08/17/2010 11:21 AM, flzz wrote: >> >> >> >> >> >>

Re: [sqlalchemy] SqlAlchemy logging FAQ

2010-08-18 Thread Michael Bayer
On Aug 17, 2010, at 11:45 AM, Kent wrote: > The logging FAQ states "Therefore, when using Python logging, ensure > all echo flags are set to False at all times, to avoid getting > duplicate log lines." > http://www.sqlalchemy.org/docs/dbengine.html#configuring-logging > > Is this no longer corre

Re: [sqlalchemy] INSERT…RETURNING being issued wro ngly

2010-08-18 Thread Michael Bayer
Sent from my iPhone On Aug 18, 2010, at 8:27 AM, Oliver Beattie wrote: > I'm not entirely sure why this is happening… it seems to work for me > in nearly all other circumstances so I'm a bit stumped. Basically, I > have a declarative table which has a character field as its primary > key (it's

Re: [sqlalchemy] Re: Self-referential, one-to-one, reflexive mappings

2010-08-18 Thread Ross Vandegrift
On Tue, Aug 17, 2010 at 07:32:41PM -0700, Enrico wrote: > Micahael gave me this advice: > http://groups.google.com/group/sqlalchemy/browse_thread/thread/df6e451855d13a60/386232232434ff92?lnk=gst&q=enrico#386232232434ff92 > in which there are two backrefs and I think it's declarative whereas > yours

[sqlalchemy] dictionary-like objects for ORM

2010-08-18 Thread yota
Hello, sqlalchemy seems to be the proper tool for my needs but I can't figure out how to design my project or set the ORM properly. Let's say, I build a music database, storing tracks and their associated metadata in an sql-like database defined as such : TRACK_TABLE ( ident *, url , duration )

Re: [sqlalchemy] Locked file when trying to copy

2010-08-18 Thread Jeroen Dierckx
Thanks a lot Lance, that did the trick. best regards, jeroen On Mon, Aug 16, 2010 at 10:18 PM, Lance Edgar wrote: > See > http://groups.google.com/group/sqlalchemy/browse_thread/thread/aa9c753384532e6c/8d070ff7208494b1 > > The solution though I believe is just: > > from sqlalchemy import create_

[sqlalchemy] Re: Set-returning functions

2010-08-18 Thread bekozi
Thanks! Will try to get this working. I am using GeoAlchemy quite extensively but these more obscure functions and types are not supported... On Aug 16, 9:14 pm, Michael Bayer wrote: > On Aug 16, 2010, at 11:21 AM, bekozi wrote: > > > Is it possible to work with set-returning functions in SQLAlc

[sqlalchemy] Re: INSERT…RETURNING being issued wro ngly

2010-08-18 Thread Oliver Beattie
I'm using Postgres On Aug 18, 1:27 pm, Oliver Beattie wrote: > I'm not entirely sure why this is happening… it seems to work for me > in nearly all other circumstances so I'm a bit stumped. Basically, I > have a declarative table which has a character field as its primary > key (it's not an ID wh

[sqlalchemy] INSERT…RETURNING being issued wrongly

2010-08-18 Thread Oliver Beattie
I'm not entirely sure why this is happening… it seems to work for me in nearly all other circumstances so I'm a bit stumped. Basically, I have a declarative table which has a character field as its primary key (it's not an ID which can be returned by the server), yet SQLAlchemy is issuing an INSERT

[sqlalchemy] Re: INSERT…RETURNING being issued wro ngly

2010-08-18 Thread Oliver Beattie
I'm using Postgres, by the way. On Aug 18, 1:27 pm, Oliver Beattie wrote: > I'm not entirely sure why this is happening… it seems to work for me > in nearly all other circumstances so I'm a bit stumped. Basically, I > have a declarative table which has a character field as its primary > key (it's