[sqlalchemy] Doc bug? 0.3 tutorial not working

2007-11-17 Thread iain duncan

Hi Michael et al. I don't know if this is a versioning conflict or what
not. I know I had done this fine before in the past, so maybe something
changed. Anyway, with sa 0.3.11 and python 2.4.3 and mysql 5.0.22,
following the sa 0.3 tutorial:

from sqlalchemy import *
db = create_engine('mysql://web:[EMAIL PROTECTED]/db_name')
metadata = MetaData()

metadata.bind(db)
TypeError: 'NoneType' object is not callable

However this still works:
metadata = MetaData(db) 

The tutorial still says the two are equivalent, so I guess something's
 fishy?

Thanks
Iain


--~--~-~--~~~---~--~~
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: Doc bug? 0.3 tutorial not working

2007-11-17 Thread Michael Bayer


On Nov 17, 2007, at 4:27 AM, iain duncan wrote:


 Hi Michael et al. I don't know if this is a versioning conflict or  
 what
 not. I know I had done this fine before in the past, so maybe  
 something
 changed. Anyway, with sa 0.3.11 and python 2.4.3 and mysql 5.0.22,
 following the sa 0.3 tutorial:

 from sqlalchemy import *
 db = create_engine('mysql://web:[EMAIL PROTECTED]/db_name')
 metadata = MetaData()

 metadata.bind(db)
 TypeError: 'NoneType' object is not callable

 However this still works:
 metadata = MetaData(db)

 The tutorial still says the two are equivalent, so I guess something's
 fishy?


the correct syntax is metadata.bind = db.Im not seeing  
metadata.bind(db) anywhere ?



--~--~-~--~~~---~--~~
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: Can I remove a Column from the select() result set

2007-11-17 Thread Michael Bayer


On Nov 17, 2007, at 12:26 AM, Matt Culbreth wrote:


 Howdy Group,

 Let's say I have a very simple query:  select person.id, person.name,
 person.age from person

 Can I remove one of the columns, say person.age, from this result
 set and still use the list as a RowProxy?  I'm trying to do it now and
 it's not working.  I'm creating a new list and appending all but the
 last (for example) columns, but it's then missing the RowProxy
 goodness.

 I realize I can do this in the original select, but I'm doing some
 client-side logic here and I need to manipulate the dataset.


well if you use list operations etc. on the RowProxy or ResultProxy  
youll get just a plain list (or dict, depending on what youre doing).

within SA, we use a lot of decorator like approaches, not the python  
@decorator thing but rather another collection class that wraps the  
original RowProxy.

you'd have to illustrate what you're specifically trying to do for us  
to have some suggestions.

--~--~-~--~~~---~--~~
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: Doc bug? 0.3 tutorial not working

2007-11-17 Thread iain duncan


 
  from sqlalchemy import *
  db = create_engine('mysql://web:[EMAIL PROTECTED]/db_name')
  metadata = MetaData()
 
  metadata.bind(db)
  TypeError: 'NoneType' object is not callable
 
  However this still works:
  metadata = MetaData(db)
 
  The tutorial still says the two are equivalent, so I guess something's
  fishy?
 
 
 the correct syntax is metadata.bind = db.Im not seeing  
 metadata.bind(db) anywhere ?

Well that's what I get for trying to stay up as late as my studying
girlfriend. My sincere apologies! :/

Sheepish Iain


--~--~-~--~~~---~--~~
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: Can I remove a Column from the select() result set

2007-11-17 Thread Matt Culbreth

Thanks Michael.

To make a long story short, I'm appending a couple columns onto a
query, running it, and then using those two extra columns for some
client-side logic (involving calculations to be precise).  At the end
of that logic, I need to remove those two extra columns.  I'd like to
be able to do that and keep the RowProxy stuff.

There's a workaround though so it's not a big deal.  I've looked
through the code and it seems I'd be going too far outside of the core
design to keep doing this.


On Nov 17, 11:03 am, Michael Bayer [EMAIL PROTECTED] wrote:
 On Nov 17, 2007, at 12:26 AM, Matt Culbreth wrote:



  Howdy Group,

  Let's say I have a very simple query:  select person.id, person.name,
  person.age from person

  Can I remove one of the columns, say person.age, from this result
  set and still use the list as a RowProxy?  I'm trying to do it now and
  it's not working.  I'm creating a new list and appending all but the
  last (for example) columns, but it's then missing the RowProxy
  goodness.

  I realize I can do this in the original select, but I'm doing some
  client-side logic here and I need to manipulate the dataset.

 well if you use list operations etc. on the RowProxy or ResultProxy  
 youll get just a plain list (or dict, depending on what youre doing).

 within SA, we use a lot of decorator like approaches, not the python  
 @decorator thing but rather another collection class that wraps the  
 original RowProxy.

 you'd have to illustrate what you're specifically trying to do for us  
 to have some suggestions.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---