[sqlalchemy] Re: dynamic relation filtering

2009-02-25 Thread az

thequery().with_polymorphic( list of classes ) ?

On Wednesday 25 February 2009 15:43:54 Vladimir Iliev wrote:
 hi,

 how can i filter dynamic relation's query to instances of a given
 class, including the subclasses ?

 i tried something like

 part.documents.filter(Part.documents.of_type(CADDocument))

 but i'm getting

 ArgumentError: filter() argument must be of type
 sqlalchemy.sql.ClauseElement or string

 thanks in advance



--~--~-~--~~~---~--~~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: dynamic relation filtering

2009-02-25 Thread Vladimir Iliev

InvalidRequestError: Query.with_polymorphic() being called on a Query 
with existing criterion


a...@svilendobrev.com написа:
 thequery().with_polymorphic( list of classes ) ?
 
 On Wednesday 25 February 2009 15:43:54 Vladimir Iliev wrote:
 hi,

 how can i filter dynamic relation's query to instances of a given
 class, including the subclasses ?

 i tried something like

 part.documents.filter(Part.documents.of_type(CADDocument))

 but i'm getting

 ArgumentError: filter() argument must be of type
 sqlalchemy.sql.ClauseElement or string

 thanks in advance


 
  
 


--~--~-~--~~~---~--~~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: dynamic relation filtering

2009-02-25 Thread Michael Bayer

with_polymorphic() needs to be called first.

On Feb 25, 2009, at 9:54 AM, Vladimir Iliev wrote:


 InvalidRequestError: Query.with_polymorphic() being called on a Query
 with existing criterion


 a...@svilendobrev.com написа:
 thequery().with_polymorphic( list of classes ) ?

 On Wednesday 25 February 2009 15:43:54 Vladimir Iliev wrote:
 hi,

 how can i filter dynamic relation's query to instances of a given
 class, including the subclasses ?

 i tried something like

 part.documents.filter(Part.documents.of_type(CADDocument))

 but i'm getting

 ArgumentError: filter() argument must be of type
 sqlalchemy.sql.ClauseElement or string

 thanks in advance







 


--~--~-~--~~~---~--~~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: dynamic relation filtering

2009-02-25 Thread Vladimir Iliev

so it's not possible to reuse relation's query definition ?

Michael Bayer написа:
 with_polymorphic() needs to be called first.
 
 On Feb 25, 2009, at 9:54 AM, Vladimir Iliev wrote:
 
 InvalidRequestError: Query.with_polymorphic() being called on a Query
 with existing criterion


 a...@svilendobrev.com написа:
 thequery().with_polymorphic( list of classes ) ?

 On Wednesday 25 February 2009 15:43:54 Vladimir Iliev wrote:
 hi,

 how can i filter dynamic relation's query to instances of a given
 class, including the subclasses ?

 i tried something like

 part.documents.filter(Part.documents.of_type(CADDocument))

 but i'm getting

 ArgumentError: filter() argument must be of type
 sqlalchemy.sql.ClauseElement or string

 thanks in advance



 
 
  
 


--~--~-~--~~~---~--~~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: dynamic relation filtering

2009-02-25 Thread Michael Bayer

not currently no


On Feb 25, 2009, at 10:46 AM, Vladimir Iliev wrote:


 so it's not possible to reuse relation's query definition ?

 Michael Bayer написа:
 with_polymorphic() needs to be called first.

 On Feb 25, 2009, at 9:54 AM, Vladimir Iliev wrote:

 InvalidRequestError: Query.with_polymorphic() being called on a  
 Query
 with existing criterion


 a...@svilendobrev.com написа:
 thequery().with_polymorphic( list of classes ) ?

 On Wednesday 25 February 2009 15:43:54 Vladimir Iliev wrote:
 hi,

 how can i filter dynamic relation's query to instances of a given
 class, including the subclasses ?

 i tried something like

 part.documents.filter(Part.documents.of_type(CADDocument))

 but i'm getting

 ArgumentError: filter() argument must be of type
 sqlalchemy.sql.ClauseElement or string

 thanks in advance









 


--~--~-~--~~~---~--~~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: dynamic relation filtering

2009-02-25 Thread Michael Bayer

so...workaround, use a new query against the target object and call  
with_parent(), given the parent object.   I didnt realize earlier this  
was with a dynamic relation.   this is something we should try to  
support.   with_polymorphic() is tricky since it implies a potential  
filtering to be applied to all criterion, and in the case of dynamic a  
criterion is already present.


On Feb 25, 2009, at 11:19 AM, Michael Bayer wrote:


 not currently no


 On Feb 25, 2009, at 10:46 AM, Vladimir Iliev wrote:


 so it's not possible to reuse relation's query definition ?

 Michael Bayer написа:
 with_polymorphic() needs to be called first.

 On Feb 25, 2009, at 9:54 AM, Vladimir Iliev wrote:

 InvalidRequestError: Query.with_polymorphic() being called on a
 Query
 with existing criterion


 a...@svilendobrev.com написа:
 thequery().with_polymorphic( list of classes ) ?

 On Wednesday 25 February 2009 15:43:54 Vladimir Iliev wrote:
 hi,

 how can i filter dynamic relation's query to instances of a given
 class, including the subclasses ?

 i tried something like

 part.documents.filter(Part.documents.of_type(CADDocument))

 but i'm getting

 ArgumentError: filter() argument must be of type
 sqlalchemy.sql.ClauseElement or string

 thanks in advance












 


--~--~-~--~~~---~--~~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: dynamic relation filtering

2009-02-25 Thread Vladimir Iliev

ok, thanks

Michael Bayer написа:
 not currently no
 
 
 On Feb 25, 2009, at 10:46 AM, Vladimir Iliev wrote:
 
 so it's not possible to reuse relation's query definition ?

 Michael Bayer написа:
 with_polymorphic() needs to be called first.

 On Feb 25, 2009, at 9:54 AM, Vladimir Iliev wrote:

 InvalidRequestError: Query.with_polymorphic() being called on a  
 Query
 with existing criterion


 a...@svilendobrev.com написа:
 thequery().with_polymorphic( list of classes ) ?

 On Wednesday 25 February 2009 15:43:54 Vladimir Iliev wrote:
 hi,

 how can i filter dynamic relation's query to instances of a given
 class, including the subclasses ?

 i tried something like

 part.documents.filter(Part.documents.of_type(CADDocument))

 but i'm getting

 ArgumentError: filter() argument must be of type
 sqlalchemy.sql.ClauseElement or string

 thanks in advance




 
 
  
 


--~--~-~--~~~---~--~~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: dynamic relation filtering

2009-02-25 Thread Michael Bayer

also if you're using single table inheritance, you should be able to  
get away without needing with_polymorphic to query on subclasses.


On Feb 25, 2009, at 11:41 AM, Vladimir Iliev wrote:


 ok, thanks

 Michael Bayer написа:
 not currently no


 On Feb 25, 2009, at 10:46 AM, Vladimir Iliev wrote:

 so it's not possible to reuse relation's query definition ?

 Michael Bayer написа:
 with_polymorphic() needs to be called first.

 On Feb 25, 2009, at 9:54 AM, Vladimir Iliev wrote:

 InvalidRequestError: Query.with_polymorphic() being called on a
 Query
 with existing criterion


 a...@svilendobrev.com написа:
 thequery().with_polymorphic( list of classes ) ?

 On Wednesday 25 February 2009 15:43:54 Vladimir Iliev wrote:
 hi,

 how can i filter dynamic relation's query to instances of a  
 given
 class, including the subclasses ?

 i tried something like

 part.documents.filter(Part.documents.of_type(CADDocument))

 but i'm getting

 ArgumentError: filter() argument must be of type
 sqlalchemy.sql.ClauseElement or string

 thanks in advance










 


--~--~-~--~~~---~--~~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---