keith cascio wrote: > Hi. I use declarative orm with session. With my current > configuration, SQLAlchemy refreshes more often than I'd like. In > other words, when I look at the echo log, I see more SELECT statements > than I'd like. It issues a SELECT when I read an attribute, but I > don't want it to do that. What is the best way to suppress these > automatic refreshes?
nothing ever "refreshes" automatically. only things that have been "expired", or were never loaded in the first place, are loaded when requested. to reduce expirations, read http://www.sqlalchemy.org/docs/session.html#committing . Also, if applicable, consider using fewer database-level defaults to populate columns on flush - these values are necessarily read in when you request to see them. To increase what's loaded in a single query is a more elaborate topic which involves the specifics of the mappings you are using. Usually "eager loading" is the first place to start. If you're using joined table inheritance, read the mapper docs on configuring "with polymorphic". If your loads are specific to many-to-one relationships, use 0.6beta2. Fewer loads take place in the latest version. > > Thanks, > Keith > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.