[sqlalchemy] Re: PROPOSAL: Session

2007-07-30 Thread sdobrev
On Sunday 29 July 2007 23:36:32 Michael Bayer wrote: This would be a new name available in 0.4 which would produce the same Session that we are familiar with, except it would be by default transactional and autoflushing. The create_session() function stays around and does what it always did,

[sqlalchemy] Re: Boolean column in MS SQL

2007-07-30 Thread che
Hi, On 27 Юли, 23:27, Paul Johnston [EMAIL PROTECTED] wrote: Hi, type. Do you have some idea how to preserve entire boolean semantics in mssql? I've not tried this but perhaps comparing to 1 does the trick, e.g. instead of a and not b do (a = 1) and not (b = 1) yes, thanks. this works.

[sqlalchemy] ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1

2007-07-30 Thread Arun Kumar PG
Guys, I am using SA with MySQL. I am trying to update a record by making a call to session.update(obj). In response I am getting ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1 What are the possible reasons for this error? -- Cheers, - A

[sqlalchemy] Re: SQLAlchemy 0.4 MERGED TO TRUNK

2007-07-30 Thread Michael Bayer
ive considered this so if someone is willing to submit a patch that would be great. On Jul 30, 2007, at 1:46 AM, Michael Pearson wrote: Hi, Are there plans to print warnings when deprecated methods are used? I've just spent the morning future-proofing our code against SA 0.4 and would

[sqlalchemy] Re: Having unicode issues with my model's get_by() method

2007-07-30 Thread Michael Bayer
On Jul 30, 2007, at 2:11 AM, yish wrote: Hi, I decided to explore Pylons and was going through the QuickView tutorial when I came across a problem. I am getting the following exception: page = model.Page.get_by(title=u'FrontPage') Traceback (most recent call last): SQLError:

[sqlalchemy] Re: PROPOSAL: Session

2007-07-30 Thread Michael Bayer
On Jul 30, 2007, at 2:55 AM, [EMAIL PROTECTED] wrote: as long as u have both ways (autoflush/noauto, trans/notrans) on same object - flags etc - and the difference is well documented, and the usage patterns of both (or are there 4 combinations) are explained... of course the flags will be

[sqlalchemy] Default value for objects' attributes

2007-07-30 Thread Jonathan Ballet
Hi, we ran into a small problem today, related to default values for table's columns. Here an example : test = Table('test', metadata, Column('id', Integer, primary_key=True), Column('test_value', Boolean, default=False, nullable=False) ) class Test(object):pass test_mapper =

[sqlalchemy] Session Problem

2007-07-30 Thread robertz23
Hi, I'm making a project using TurboGears with SqlAlchemy. The problem that I think I have is when I make some changes to the DB with the webservice I'm making or directly using MySQL shell. What happens next is that sometimes when I refresh the page it shows me the value I had before

[sqlalchemy] Re: Default value for objects' attributes

2007-07-30 Thread Michael Bayer
Cant reproduce. Heres a test script which runs fine for me with PG 8.1: from sqlalchemy import * metadata = MetaData('postgres://scott:[EMAIL PROTECTED]/test') test = Table('test', metadata, Column('id', Integer, primary_key=True), Column('test_value', Boolean, default=False,

[sqlalchemy] Re: Session Problem

2007-07-30 Thread Michael Bayer
On Jul 30, 2007, at 12:34 PM, robertz23 wrote: Hi, I'm making a project using TurboGears with SqlAlchemy. The problem that I think I have is when I make some changes to the DB with the webservice I'm making or directly using MySQL shell. What happens next is that sometimes when I

[sqlalchemy] Re: SQLAlchemy 0.4 MERGED TO TRUNK

2007-07-30 Thread Michael Bayer
On Jul 30, 2007, at 1:22 PM, Jonathan Ellis wrote: I can probably do this tonight. How many people are still using 2.3? Decorator syntax would be nice for this. a lot. no decorators for now. Also it would be nice to not have to remember that I can't use genexps in SA code. it

[sqlalchemy] Re: SQLAlchemy 0.4 MERGED TO TRUNK

2007-07-30 Thread Jonathan Ellis
I can probably do this tonight. How many people are still using 2.3? Decorator syntax would be nice for this. Also it would be nice to not have to remember that I can't use genexps in SA code. But 2.3 is a pretty good base, I don't miss much else from 2.4. :) On 7/30/07, Michael Bayer [EMAIL

[sqlalchemy] Re: Session Problem

2007-07-30 Thread robertz23
Yes, I'm making the flush() when I need to save the data. The problem is when I try to see it, I mean, make like a select, creating the object and accessing its fields. Sometimes, my webservice gives me the value that I had before and sometimes, when I refresh the page several times it changes

[sqlalchemy] Re: Default value for objects' attributes

2007-07-30 Thread sdobrev
your _own_ ctor, or something around mapperExtension? On Monday 30 July 2007 21:26:44 Jonathan Ballet wrote: No, after a flush(), everything is fine. However, I would like to have the default value _before_ flush()-ing. Hmm, after thinking about it a few more minutes, it would be a bit

[sqlalchemy] Re: Session Problem

2007-07-30 Thread robertz23
do you know how can I accomplish this? Regards, Roberto Zapata On Jul 30, 2:03 pm, robertz23 [EMAIL PROTECTED] wrote: Yes, I'm making the flush() when I need to save the data. The problem is when I try to see it, I mean, make like a select, creating the object and accessing its fields.

[sqlalchemy] Re: multiple mapper extensions

2007-07-30 Thread Jonathan LaCour
Michael Bayer wrote: both of your before_update() functions return EXT_PASS. theyll both be called. Well, yeah. I just found it a little bit odd that I had to do this. When I saw EXT_PASS, I didn't think it meant continue along with other mapper extensions. It seems like a bad idea for one

[sqlalchemy] Re: PROPOSAL: Session

2007-07-30 Thread Michael Bayer
On Jul 30, 2007, at 2:14 PM, [EMAIL PROTECTED] wrote: cache. dont know about people, we use it for cache. it's probably wrong but what else can be used for cache? identity_map maybe some cache but i'm not sure about it... then you turn off autoflush and transactional.

[sqlalchemy] Re: Default value for objects' attributes

2007-07-30 Thread Michael Bayer
On Jul 30, 2007, at 2:26 PM, Jonathan Ballet wrote: No, after a flush(), everything is fine. However, I would like to have the default value _before_ flush()-ing. Hmm, after thinking about it a few more minutes, it would be a bit restrictive, since it will work only for 'scalar' values :/

[sqlalchemy] Re: multiple mapper extensions

2007-07-30 Thread Michael Bayer
On Jul 30, 2007, at 3:41 PM, Jonathan LaCour wrote: Michael Bayer wrote: both of your before_update() functions return EXT_PASS. theyll both be called. Well, yeah. I just found it a little bit odd that I had to do this. When I saw EXT_PASS, I didn't think it meant continue along

[sqlalchemy] Re: multiple mapper extensions

2007-07-30 Thread Jonathan LaCour
Michael Bayer wrote: its a model taken from the way event loops usually work; any consumer along the event chain is allowed to say, ive consumed the event and stop further handlers from dealing with it. we can certainly change the names around into something less ridiculous. unfortuantely,

[sqlalchemy] Re: SQLAlchemy 0.4 MERGED TO TRUNK

2007-07-30 Thread Jorge Godoy
Michael Bayer wrote: a lot. no decorators for now. Not even the way we did on TurboGears that mimics the PEAK decorators? This way, people can use @decorator(param) on Python 2.4+ and can use [decorator(param)] on Python 2.3. At the same place (before the method / function declaration).

[sqlalchemy] Re: Session Problem

2007-07-30 Thread Paul Johnston
Hi, This is TurboGears ticket #1419 http://trac.turbogears.org/ticket/1419 A fix is in version 1.0.3.2. Paul robertz23 wrote: Hi, I'm making a project using TurboGears with SqlAlchemy. The problem that I think I have is when I make some changes to the DB with the webservice I'm making

[sqlalchemy] Re: Default value for objects' attributes

2007-07-30 Thread Paul Johnston
Hi, The problem is that creating a new object from class Test doesn't set the default value for attributes : Seems like a good time to bring up a slightly related problem. If you modify an object in a function providing a default value, the object is not flushed (unless you do that

[sqlalchemy] Re: Boolean column in MS SQL

2007-07-30 Thread Paul Johnston
Hi, anyway this seems like bug to me as this will create database- dependence (also AND and OR not working too in MSSQL). i'll try to prepare some general patch to this and send back here (if someone didnot outrun me). Yes, please do. I think you'll find some tweak to MssqlCompiler can