[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, producing a
 regular session which you flush().

 while we have both Session() and create_session() in the trunk now,
 Session() would be what we document going forward.  flags to make
 it act other ways are still available, like
 autoflush/transactional.

 any thoughts ?
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...

will the readonly= flag go in too?

btw is autoflushing meaning that .save always calls .flush, 
instance-per-instance? 
Then how about making sess.save working over list or *args and saving 
them all? (may be another method savemany that just calls save in a 
loop)

And, would this mean that in an autoflushing session calling .flush  
is useless (being called anyway after each .save automaticaly)?
hmm. then just make .flush to issue .commit... (i know about different 
semantics etc, but most people do not want the semantix, they just 
want the data going to db). Maybe even add another method meaning 
either .flush for (trans=0, autoflush=whatever) or .commit for 
(trans=1, autoflush=1), or .flush then .commit for (trans=1, 
autoflush=0).

heh, this transactional Session() will make the antipattern 'just 
one-lng-session' appear somewhat different...

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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.
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).

regards,
stefan


 Paul


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 have found this useful. I may attempt a patch myself, if
 people agree that it'd be a good idea.

 Regards,

 -- 
 Michael Pearson

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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: (ProgrammingError) ERROR:  column frontpage does not
 exist

 SELECT pages.content AS pages_content, pages.title AS pages_title
 FROM pages
 WHERE pages.title = FrontPage ORDER BY pages.title
  LIMIT 1 'SELECT pages.content AS pages_content, pages.title AS
 pages_title \nFROM pages \nWHERE pages.title = %(pages_title)s ORDER
 BY pages.title \n LIMIT 1' {'pages_title': u'FrontPage'}

 It looked to me that the sql query was not being properly generated.
 The FrontPage within the query should be escaped with single quotes,
 e.g:
 SELECT pages.content AS pages_content, pages.title AS pages_title
 FROM pages
 WHERE pages.title = 'FrontPage' ORDER BY pages.title
 LIMIT 1

 After trying the same query with title not defined as unicode i have
 no problems, e,g:
 page = model.Page.get_by(title='FrontPage')
 succeeds perfectly.

 Is this the expected unicode behavior for sqlalchemy?

yes.  we dont quote or escape query arguments, we use bind  
parameters as you can see in %(pages_title)s.Also, to indicate  
that you'd like SQLAlchemy to convert unicode bind parameters to  
strings, for compatibility with database APIs which don't accept  
unicode strings (such as psycopg2),  use the convert_unicode=True  
flag sent to create_engine().



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 documented;  but for that number of users  
who dont like to bother with flags, or are going to write their apps  
such that they say Session(foo=bar, x=y) in hundreds of places  
instead of creating a function, what we're really looking for here is  
what should the default behavior be?the disadvantage SA has  
here, as in many other areas, is that we even *have* a choice in the  
first place.


 will the readonly= flag go in too?

possibly; im not as psyched about this flag and maybe it will be a  
0.4xx thing.


 btw is autoflushing meaning that .save always calls .flush,
 instance-per-instance?
 Then how about making sess.save working over list or *args and saving
 them all? (may be another method savemany that just calls save in a
 loop)

.save() does not call .flush.  flush is called only when a Query is  
executed, or if you call flush() yourself.

save() used to take (*args).  we removed this so in order to create a  
cleaner and more consistent API.  (does list.append() take *args ?)


 And, would this mean that in an autoflushing session calling .flush
 is useless (being called anyway after each .save automaticaly)?

a useless flush looks in the current list of objects, finds  
nothing, and then doesnt do anything.

 hmm. then just make .flush to issue .commit... (i know about different
 semantics etc, but most people do not want the semantix, they just
 want the data going to db).
 Maybe even add another method meaning
 either .flush for (trans=0, autoflush=whatever) or .commit for
 (trans=1, autoflush=1), or .flush then .commit for (trans=1,
 autoflush=0).

thats how it is right now.  you're proposing that the autoflush is  
the default but not the transactional part.


 heh, this transactional Session() will make the antipattern 'just
 one-lng-session' appear somewhat different...


people really need to be closing out their sessions when theyre done,  
*anyway*.   its silly to use your session in a web application, then  
leave it hanging around with all the objects in it for the next  
request.  Even for those people using SessionContext, I would argue  
that they should create a brand new Session at the start of each  
request, and remove it at the end.  it should be viewed as checking  
out a database connection from a connection pool.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 = mapper(Test, test)

metadata is a bound metadata connected on a PostgreSQL (8.1) database.

The problem is that creating a new object from class Test doesn't set
the default value for attributes :
 t = Test()
 print t.test_value
None

(However, the default value is used just before inserting the object
in the database, which is fine).

Is there an easy way to have attributes set to there default values,
instead of None ?

Thanks,
  - Jonathan


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 (Although the DB has the new value).  I've tried to use
close() or clear() methods, but I think sometimes they work sometimes
they don't.  I'm using assign_mapper with a session_context for all my
models.  This is some of  the code:


#CREATE THE OBJECT#
computerObj = Computer().get_by(guid=args.get('guid'))
#Some Code Here#
...
...
...
Then I close or clear the session this way:

computerObj.query().session.close()#or
computerObj.query().session.clear()

But I think I'm doing something wrong.  Could you help me?

Regards,
Roberto Zapata


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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, nullable=False)
)
metadata.create_all()

class Test(object):pass
test_mapper = mapper(Test, test)

t = Test()
sess = create_session()
sess.save(t)
sess.flush()

print t.test_value


did you forget to flush() ?




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 refresh the page it shows me the value I
 had before (Although the DB has the new value).  I've tried to use
 close() or clear() methods, but I think sometimes they work sometimes
 they don't.  I'm using assign_mapper with a session_context for all my
 models.  This is some of  the code:

did you forget to flush()  ? this is required in the current 0.3  
release of SQLAlchemy in order to write the changes to the database.

(looks like the autoflush idea in 0.4 will be a big winner)



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 sure would.  maybe in another 6 months we'll take a poll again.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 PROTECTED] wrote:


 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 have found this useful. I may attempt a patch myself, if
  people agree that it'd be a good idea.
 
  Regards,
 
  --
  Michael Pearson
 
  


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 the value, between the old and new value, that I just saved
in the DB through SqlAlchemy(using flush()).

I think that I need a way to delete from memory this value or the
object, so the next time I call this url, it gives
me the value that is on the DB.

Regards,
Roberto

On Jul 30, 1:37 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 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 refresh the page it shows me the value I
  had before (Although the DB has the new value).  I've tried to use
  close() or clear() methods, but I think sometimes they work sometimes
  they don't.  I'm using assign_mapper with a session_context for all my
  models.  This is some of  the code:

 did you forget to flush()  ? this is required in the current 0.3
 release of SQLAlchemy in order to write the changes to the database.

 (looks like the autoflush idea in 0.4 will be a big winner)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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
 restrictive, since it will work only for 'scalar' values :/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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.

 Sometimes, my webservice gives me the value that I had before and
 sometimes, when I refresh the page several times
 it changes the value, between the old and new value, that I just saved
 in the DB through SqlAlchemy(using flush()).

 I think that I need a way to delete from memory this value or the
 object, so the next time I call this url, it gives
 me the value that is on the DB.

 Regards,
 Roberto

 On Jul 30, 1:37 pm, Michael Bayer [EMAIL PROTECTED] wrote:

  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 refresh the page it shows me the value I
   had before (Although the DB has the new value).  I've tried to use
   close() or clear() methods, but I think sometimes they work sometimes
   they don't.  I'm using assign_mapper with a session_context for all my
   models.  This is some of  the code:

  did you forget to flush()  ? this is required in the current 0.3
  release of SQLAlchemy in order to write the changes to the database.

  (looks like the autoflush idea in 0.4 will be a big winner)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 mapper extension
to be able to inject itself into the front of the extensions list and
then cause all other mapper extensions to not execute by returning
something other than EXT_PASS.

So, I guess it was less of a problem, and more of me raising a point of
confusion and wondering if that part of the API couldn't be smoothed out
a bit :)

--
Jonathan LaCour
http://cleverdevil.org




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 :/

yes, figured that.  The issues with this are that it would not be  
consistently available; it could only work for Python-side defaults,  
and could also only work for defaults that do not require an  
ExecutionContext (i.e. the full set of parameters being passed to the  
INSERT statement).   The usage model with SA, and especially in 0.4,  
is that data can be flushed anytime...no need to wait for some  
special time to flush.  with that model, your defaults are availble  
in all cases the way youd want them.

Also if you really need the False before any flush occurs, you  
might want to define that in the __init__ method of your mapped class  
as well.  If you create an external function called my_table_default 
(), the same function can be placed within your Table def as well as  
your class's __init__ method.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 with  
 other
 mapper extensions.  It seems like a bad idea for one mapper extension
 to be able to inject itself into the front of the extensions list and
 then cause all other mapper extensions to not execute by returning
 something other than EXT_PASS.

 So, I guess it was less of a problem, and more of me raising a  
 point of
 confusion and wondering if that part of the API couldn't be  
 smoothed out
 a bit :)

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,  
changing it so that no return value, or None, does *not* short  
circuit the chain runs a slight risk that someone is actually using  
it that way.  So we might need to change it such that if your  
before_insert returns None, an error is raised, and youre forced to  
return a specific value indicating the next activity...otherwise  
someone's upgrade might silently fail.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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,
 changing it so that no return value, or None, does *not* short
 circuit the chain runs a slight risk that someone is actually using
 it that way.  So we might need to change it such that if your
 before_insert returns None, an error is raised, and youre forced to
 return a specific value indicating the next activity...otherwise
 someone's upgrade might silently fail.

Fair enough, I suppose.  I think I can get over it, for the most part.
It might just be an issue of cognitive dissonance because of the naming
convention or how its described in the documentation.

--
Jonathan LaCour
http://cleverdevil.org

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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). 




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 or directly using MySQL shell.  What happens
next is that sometimes when I refresh the page it shows me the value I
had before (Although the DB has the new value).  I've tried to use
close() or clear() methods, but I think sometimes they work sometimes
they don't.  I'm using assign_mapper with a session_context for all my
models.  This is some of  the code:


#CREATE THE OBJECT#
computerObj = Computer().get_by(guid=args.get('guid'))
#Some Code Here#
...
...
...
Then I close or clear the session this way:

computerObj.query().session.close()#or
computerObj.query().session.clear()

But I think I'm doing something wrong.  Could you help me?

Regards,
Roberto Zapata




  



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 manually). Ideally flushing would detect 
this and cope with it. If defaults were supplied at constructor time, we 
would get that behaviour with no further work.

Paul

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[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 
achieve this.

BTW, AND/OR are not broken generally; I think it's just BIT columns they 
have a problem with.

Paul

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---