[sqlalchemy] Re: Extension proposal

2008-04-15 Thread Paul Johnston
Hi,

the function so far seems pretty use-case specific.  (only works in
 one direction, is hardcoded to the obj.mapper convention, sort of


Ok, fair enough. It looks like Elixir will accept this, and Jonathan also
made the observation that my approach is one-way. For the time being, I've
updated the usage recipe which should keep Lele and Iain happy for now.

If you do change your mind, my offer to produce a patch with unit tests
stands.

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: Extension proposal

2008-04-14 Thread Michael Bayer
just two seconds ago someone asked about sticking a JSON plugin in  
SQLAlchemy (this looks essentially like JSON to me).is the  
extension proposal something that builds in using MapperExtension ?   
it seems like people are just looking for json-like functions for  
things (which is handy, though not an SA-core kind of feature).


On Apr 14, 2008, at 6:49 AM, Paul Johnston wrote:

 Hi,

 I have a utility function that I keep using again and again in my  
 web apps. It takes a nested hash/list structure, something like:

 data = \
 {
   'id': 123,

   'name': 'Example customer',
   'contacts':
   [
 {'id':12, name='Alice'}

 {'id':23, name='Bob'}
   ]
 }
 And it takes an SQLAlchemy object. It updates the object based on  
 the hash/list, in a deep way, in that it goes down relationships.

 There's an old version of my code here:
 http://www.sqlalchemy.org/trac/wiki/UsageRecipes/ProcHash

 Anyway, I keep using this, so can it be included as an SQLAlchemy  
 extension? If it's accepted, I will do the work to create unit tests  
 for it.

 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: Extension proposal

2008-04-14 Thread Paul Johnston
Hi,

In my case, the data is coming from FormEncode. I guess it could come from
JSON, but that would be JSON client to server, which is not the usual way
round.

The proposal is for a standalone function, I'm thinking you'd do something
like:

from sqlalchemy.ext.proc_hash import proc_hash
...
proc_hash(myobj, mydata)

As this is just plumbing python data structures into database objects, I
think it's fitting to the SA-core goals.

Paul


On Mon, Apr 14, 2008 at 3:00 PM, Michael Bayer [EMAIL PROTECTED]
wrote:

 just two seconds ago someone asked about sticking a JSON plugin in
 SQLAlchemy (this looks essentially like JSON to me).is the extension
 proposal something that builds in using MapperExtension ?  it seems like
 people are just looking for json-like functions for things (which is handy,
 though not an SA-core kind of feature).


--~--~-~--~~~---~--~~
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: Extension proposal

2008-04-14 Thread Michael Bayer


On Apr 14, 2008, at 10:11 AM, Paul Johnston wrote:

 Hi,

 In my case, the data is coming from FormEncode. I guess it could  
 come from JSON, but that would be JSON client to server, which is  
 not the usual way round.

JSON is just an object encoding, in my mind it has no implications  
regarding clients/servers.

 The proposal is for a standalone function, I'm thinking you'd do  
 something like:

 from sqlalchemy.ext.proc_hash import proc_hash
 ...
 proc_hash(myobj, mydata)

 As this is just plumbing python data structures into database  
 objects, I think it's fitting to the SA-core goals.


the function so far seems pretty use-case specific.  (only works in  
one direction, is hardcoded to the obj.mapper convention, sort of  
looks like JSON but isn't, etc.)  Even if it were JSON I dont think  
thats an SA core feature.

--~--~-~--~~~---~--~~
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: Extension proposal

2008-04-14 Thread Lele Gaifax

On Mon, 14 Apr 2008 11:49:40 +0100
Paul Johnston [EMAIL PROTECTED] wrote:

 There's an old version of my code here:
 http://www.sqlalchemy.org/trac/wiki/UsageRecipes/ProcHash

It's an nice function to have around: care to update the version on
the wiki?

ciao, lele.
-- 
nickname: Lele Gaifax| Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas| comincerò ad aver paura di chi mi copia.
[EMAIL PROTECTED] | -- Fortunato Depero, 1929.

--~--~-~--~~~---~--~~
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: Extension proposal

2008-04-14 Thread iain duncan

On Mon, 2008-14-04 at 10:26 -0400, Michael Bayer wrote:
 
 On Apr 14, 2008, at 10:11 AM, Paul Johnston wrote:
 
  Hi,
 
  In my case, the data is coming from FormEncode. I guess it could  
  come from JSON, but that would be JSON client to server, which is  
  not the usual way round.
 
 JSON is just an object encoding, in my mind it has no implications  
 regarding clients/servers.
 
  The proposal is for a standalone function, I'm thinking you'd do  
  something like:
 
  from sqlalchemy.ext.proc_hash import proc_hash
  ...
  proc_hash(myobj, mydata)
 
  As this is just plumbing python data structures into database  
  objects, I think it's fitting to the SA-core goals.
 
 
 the function so far seems pretty use-case specific.  (only works in  
 one direction, is hardcoded to the obj.mapper convention, sort of  
 looks like JSON but isn't, etc.)  Even if it were JSON I dont think  
 thats an SA core feature.

But would still be useful to a lot of folks like me. Would it possibly
be worth having extension-extensions? Like recommended extras or
something that aren't in the SA core? I totally respect keeping the core
lean and maintainable, but maybe a cookbooky section of the site with
extras or something?

just a thought!
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
-~--~~~~--~~--~--~---