[sqlalchemy] Re: setattr and mapped ORM

2009-10-23 Thread laurent FRANCOIS
On Wed, 2009-10-21 at 09:24 -0700, David Gardner wrote: > Using setattr() shouldn't be a problem, however the __dict__ attribute > also has other things in there like _sa_instance_state that I don't > believe you > want to copy to the new item. Try this instead: > > for col in object_mapper(upda

[sqlalchemy] Re: Saved Queries (or text representation of the SQL)

2009-10-23 Thread jeff
Thanks for both ideas. Hmmm when I compile my select( ) statement it still has the %(param_1) parameter format instead of the :param_1 format. That seems to make the execute complain about syntax later on. Must be missing something... Anyway, serializer is easier and zlib compressing helps

[sqlalchemy] Re: Shallow copying

2009-10-23 Thread Mike Conley
On Fri, Oct 23, 2009 at 12:40 PM, Joril wrote: > > Hi everyone! > I'm trying to automatically build a shallow copy of a SA-mapped > object.. At the moment my function is just: > > newobj = src.__class__() > for prop in class_mapper(src.__class__).iterate_properties: >setattr(newobj, prop.key,

[sqlalchemy] Re: Saved Queries (or text representation of the SQL)

2009-10-23 Thread Mike Conley
On Fri, Oct 23, 2009 at 1:47 PM, Michael Bayer wrote: > > Much easier to use serializer. > > > I agree with that. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email

[sqlalchemy] Re: Saved Queries (or text representation of the SQL)

2009-10-23 Thread Michael Bayer
jeff wrote: > > I would like to save a number of these in a database so size is > important (the serialized select() was somewhat large...) using serializer() ? really? if you do a naive dumps() with plain pickle, yes the serialize would be huge. > so I would > like to get the string represen

[sqlalchemy] Re: Saved Queries (or text representation of the SQL)

2009-10-23 Thread Mike Conley
On Fri, Oct 23, 2009 at 12:45 PM, jeff wrote: > > I would like to save a number of these in a database so size is > important (the serialized select() was somewhat large...) so I would > like to get the string representation of the raw SQL directly useable > by sqlalchemy if possible. As I have

[sqlalchemy] Re: David Bolen on SA and Twisted

2009-10-23 Thread David Bolen
Don Dwiggins writes: > Hmmm, Could you elaborate a bit about the "self-contained"? I do have > some cases where I fire off a deferredList with several (independent) > queries in it. Might that be problematic? My guess is that your "independent" comment is essentially the same as my "self-co

[sqlalchemy] Re: Saved Queries (or text representation of the SQL)

2009-10-23 Thread jeff
I would like to save a number of these in a database so size is important (the serialized select() was somewhat large...) so I would like to get the string representation of the raw SQL directly useable by sqlalchemy if possible. As I have in my examples, the str(select) doesn't seem directly us

[sqlalchemy] Shallow copying

2009-10-23 Thread Joril
Hi everyone! I'm trying to automatically build a shallow copy of a SA-mapped object.. At the moment my function is just: newobj = src.__class__() for prop in class_mapper(src.__class__).iterate_properties: setattr(newobj, prop.key, getattr(src, prop.key)) but I'm having troubles with lazy re

[sqlalchemy] Re: own compiler visit_update method

2009-10-23 Thread Michael Bayer
sector119 wrote: > > Hi! > > Is it possible to easily add tables to FROM clause, now I use > following code to append additional table names but it look like a > hack.. > > at PGCompiler.visit_update() I see self.stack.append({'from': set > ([update_stmt.table])}) where and how it's used, may be u

[sqlalchemy] Re: can't import ARRAY from dialects.postgresql

2009-10-23 Thread Michael Bayer
sector119 wrote: > > It's on trunk. > Elso can't import orm from sqlalchemy :/ > > On Oct 23, 6:00 pm, sector119 wrote: >> Is there something wrong with ARRAY type in SA 0.6? no dialects/ >> /__init__.py has ARRAY at __all__ !? ARRAY type is only within postgresql. You'd have to import it from

[sqlalchemy] Re: can't import ARRAY from dialects.postgresql

2009-10-23 Thread sector119
It's on trunk. Elso can't import orm from sqlalchemy :/ On Oct 23, 6:00 pm, sector119 wrote: > Is there something wrong with ARRAY type in SA 0.6? no dialects/ > /__init__.py has ARRAY at __all__ !? --~--~-~--~~~---~--~~ You received this message because you are s

[sqlalchemy] can't import ARRAY from dialects.postgresql

2009-10-23 Thread sector119
Is there something wrong with ARRAY type in SA 0.6? no dialects/ /__init__.py has ARRAY at __all__ !? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy

[sqlalchemy] own compiler visit_update method

2009-10-23 Thread sector119
Hi! Is it possible to easily add tables to FROM clause, now I use following code to append additional table names but it look like a hack.. at PGCompiler.visit_update() I see self.stack.append({'from': set ([update_stmt.table])}) where and how it's used, may be using this I can append some eleme

[sqlalchemy] Re: not expected generated update query values

2009-10-23 Thread sector119
Thanks a lot, Michael! On Oct 23, 4:09 am, Michael Bayer wrote: > On Oct 22, 2009, at 3:26 PM, sector119 wrote: > > > > > Something strange, Michael.. All bindparams are different. Compliller > > should not add to SET all params if values() has bindparam args, no? > > where() have: > >    bindpa

[sqlalchemy] Re: Auto-generated Code?

2009-10-23 Thread Stone Puzzle
I have tried it, it's great, thanks! On Fri, Oct 23, 2009 at 3:19 PM, Tefnet Developers - Tomasz Jezierski < develop...@tefnet.pl> wrote: > > Dnia 2009-10-23, Pt o godzinie 15:00 +0800, Stone Puzzle pisze: > > Is there a way or lib to help us generating python code of all of the > > tables and r

[sqlalchemy] Re: Auto-generated Code?

2009-10-23 Thread Tefnet Developers - Tomasz Jezierski
Dnia 2009-10-23, Pt o godzinie 15:00 +0800, Stone Puzzle pisze: > Is there a way or lib to help us generating python code of all of the > tables and relations automatically from a existing database? > http://turbogears.org/2.1/docs/main/Utilities/sqlautocode.html Tomasz Jezierski Tefnet http:/

[sqlalchemy] Auto-generated Code?

2009-10-23 Thread Stone Puzzle
Is there a way or lib to help us generating python* code *of all of the tables and relations automatically from a existing database? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post