[sqlalchemy] Re: SA 0.3.x: performance issues
instance changes get picked up. if you want the more simplistic comparison method (i.e. using is), set up your PickleType with the flag mutable=False. You meant like this? Column('content', PickleType, mutable=False) thanks sanjay --~--~-~--~~~---~--~~ 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] Selection criteria in a property(one-to-many) of a mapped object
Might be a novice question... Say I have a business object Website, mapped using assign_mapper, having a property(relation to Page object) pages. Needing suggestion on what is a best way to fetch selective pages for a particular website. E.g. website = Website.get(1) # website.pages is a list refering to all pages of an website website.pages(where page_id = 1) # what is the ideal way to do this website.pages(where created_at 21-DEC-2006) # and this pages being a python list, searching for thing iteratively could do the job, but would involve many database fetches. thank sanjay --~--~-~--~~~---~--~~ 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: ArgumentError: Property 'scientific_name' specified with secondary join condition but no secondary argument
what the message is attempting to say, it is invalid to specify the secondaryjoin keyword argument without also specifying the secondary keyword argument, which points to the association table. --~--~-~--~~~---~--~~ 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: Selection criteria in a property(one-to-many) of a mapped object
if you want to query pages, then just query for the Page class explicitly: session.query(Page).select(criterion) the relations on a parent class are not used for selective querying. if there is a particular filtered view you will need often, you might also want to add special properties to the Website class: class Website(object): filtered_pages = property(lambda self:[p for p in self.pages where p.someproperty==somecriterion]) --~--~-~--~~~---~--~~ 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] sqlalchemy limiting
At startup of a zope application I am mapping the complete resultset for all users. Now I would like to restrict the resultset depending on the logged user before showing in table view because it takes a long time in table view when having 1 rows mapped. How is it possible to restrict on the first 20 entries of a user annotation: creator is the user id property mapped object_session = get_session() query = object_session.query( app_model.PurchaseRequisition ) return query.select_by_creator(self.request.AUTHENTICATED_USER.getUserName()) does not work return query.select(app_model.PurchaseRequisition.creator.login == self.request.AUTHENTICATED_USER.getUserName()) does not work when I use select(app_schema.UserTable.c.login == loginname,limit=limit,offset=offset) it returns the whole set of users also dont know how to combine limit and offset with this Dennis purchaseRequisition_mapper = bind_mapper( app_model.PurchaseRequisition, app_schema.PurchaseRequisitionTable, properties={ 'purchasingClass' : relation(purchasingClass_mapper, lazy=True), 'paymentMethod' : relation(paymentMethod_mapper, lazy=True), 'project' : relation(app_model.Project, primaryjoin= app_schema.PurchaseRequisitionTable.c.pr_project_ID==app_schema.ProjectTable.c.pr_project_ID, foreignkey = app_schema.PurchaseRequisitionTable.c.pr_project_ID), # 'item' : relation( app_model.Item, cascade=all, delete-orphan), #all operations of parent also auf child, delete non connected items 'items' : relation(app_model.Item, cascade=all, delete-orphan #primaryjoin= app_schema.PurchaseRequisitionTable.c.pr_PurchaseRequisition_ID==app_schema.ItemTable.c.pr_PurchaseRequisition_ID ), 'shippingMethod' : relation(shippingMethod_mapper, lazy=True), 'supplier' : relation(supplier_mapper, lazy=True), 'workflowState' : relation(workflowState_mapper, lazy=True), 'requestor' : relation(app_model.CELLSUser, primaryjoin= app_schema.PurchaseRequisitionTable.c.CELLS_user_ID_requestor==app_model.CELLSUser.c.CELLS_user_ID, lazy=True), 'creator' : relation(app_model.CELLSUser, primaryjoin= app_schema.PurchaseRequisitionTable.c.CELLS_user_ID_creator==app_model.CELLSUser.c.CELLS_user_ID, lazy=True ) # 'item': # relation(app_model.Item, # primaryjoin= app_schema.PurchaseRequisitionTable.c.pr_PurchaseRequisition_ID==app_model.Item.c.pr_item_ID, lazy=True # ) } ) --~--~-~--~~~---~--~~ 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: SA 0.3.x: performance issues
Sanjay wrote: instance changes get picked up. if you want the more simplistic comparison method (i.e. using is), set up your PickleType with the flag mutable=False. You meant like this? Column('content', PickleType, mutable=False) like this Column('content', PickleType(mutable=False)) --~--~-~--~~~---~--~~ 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: German SQLAlchemy article published
oreilly are you listening ? :) --~--~-~--~~~---~--~~ 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: Data of association table not getting flushed while multiple changes are done
i will grant that this behavior is sub-optimal, and also that its in conflict with the docs - I have just updated the docs on the site to represent this current behavior: http://www.sqlalchemy.org/docs/unitofwork.myt#unitofwork_changed im not exactly sure of a clean way to restore the 0.2 behavior, the only option seems to be a __del__ handler on the identity map weakvaluedictionary that scans garbage-collecting objects for changes and adds them to a persistent collection...but in my experience anytime you start working with __del__ the stability of the application plummets (due to its asynchronous nature...) --~--~-~--~~~---~--~~ 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: sqlalchemy limiting
http://www.sqlalchemy.org/docs/plugins.myt#plugins_selectresults On 12/5/06, dischdennis [EMAIL PROTECTED] wrote: What exactly is the SelectResults extension and where can I get it? -- Jonathan Ellis http://spyced.blogspot.com --~--~-~--~~~---~--~~ 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: columns inheritance
On 12/4/06, ml [EMAIL PROTECTED] wrote: Hi! I'm looking for something like Postgresql's CREATE TABLE a ... LIKE b. Is there any similar construction in SA? I created a simple function def inherit_table(name, table, *args, **kwargs): args = list(args) for c in table.columns: args.append(c.copy()) for c in table.constraints: args.append(c.copy()) return Table(name, table._metadata, *args, **kwargs) but I is it clean? Other than calling this inherit_table when it doesn't really have much to do with inheritance (either the pg INHERITS or class heirarchies), I think this is as good as you're going to get. -- Jonathan Ellis http://spyced.blogspot.com --~--~-~--~~~---~--~~ 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: Using pickle to save reflected metadata
you probably want to use toMetadata() on them with a plain MetaData object so that the pickled stream does not contain any references to engines. then on the way back in you would call toMetadata() again with your BoundMetaData (or Dynamic, whichever you are using). if anything itll be a great test for the toMetadata() method which doesnt have a lot of testing. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---