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 10000 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 [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
-~----------~----~----~----~------~----~------~--~---