Hello *,

(Using SQLAlchemy 0.6.8, but planning to move to 0.7 soon)

I am trying to build queries dynamically and I have to add joins on the
primary table to be able to create my where-clauses.

To add the join clause on my instance of Select, I found this
discussion:

http://thread.gmane.org/gmane.comp.python.sqlalchemy.user/5910/focus=5917

Now I need to retain the original Select untouched (as it can be used to
derive other Select instances). I found out that all the interesting
methods on Select deliver a new copy using the @_generative decorator.

For append_from, there does not seem to be a generative equivalent.
Therefore I want to roll it manually, but I don't really want to call
the private _generate method.

Therefore I am wondering if there is a canonical way to copy an instance
of Select. It seems that pickling is supported (__getstate__ and
__setstate__ are provided).

However, the class 'sqlalchemy.sql.expression._SelectBaseMixin overrides
_generate to "to also clear out exported collections". However, the
__getstate__ implementation comes from ClauseElement.


My question: Is it supported to do

from copy import copy
new_select = copy(old_select)

where old_select is an instance of Select? Are there any plans to add a
generative way to extend the froms of a Select? ;-)


Thanks and Greetings, Torsten

-- 
DYNAmore Gesellschaft fuer Ingenieurdienstleistungen mbH
Torsten Landschoff

Office Dresden
Tel: +49-(0)351-4519587
Fax: +49-(0)351-4519561

mailto:[email protected]
http://www.dynamore.de

Registration court: Mannheim, HRB: 109659, based in Karlsruhe,
Managing director:  Prof. Dr. K. Schweizerhof, Dipl.-Math. U. Franz

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.

Reply via email to