I think my problem is more basic I have the following tables
CREATE TABLE `pr_PurchaseRequisition` ( `pr_PurchaseRequisition_ID` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `pr_paymentMethod_ID` INTEGER UNSIGNED NULL, `CELLS_user_ID_creator` INTEGER UNSIGNED NOT NULL DEFAULT '4', `CELLS_user_ID_requestor` INTEGER UNSIGNED NOT NULL, `pr_shippingMethod_ID` INTEGER UNSIGNED NULL, `pr_purchasingClass_ID` INTEGER UNSIGNED NOT NULL, `pr_workflowState_ID` INTEGER UNSIGNED NOT NULL DEFAULT '1', `pr_supplier_ID` INTEGER UNSIGNED NOT NULL, `description` VARCHAR(45) BINARY NOT NULL, `creationDate` DATE NULL, `deliveryDate` DATE NOT NULL, `pr_approvedSupplierID` INTEGER UNSIGNED ZEROFILL NULL, `pr_project_ID` INTEGER UNSIGNED NULL, `isDeleted` BOOL NULL DEFAULT '0', PRIMARY KEY(`pr_PurchaseRequisition_ID`), INDEX `pr_PurchaseRequisition_FKIndex3`(`CELLS_user_ID_requestor`), INDEX `pr_PurchaseRequisition_FKIndex4`(`pr_paymentMethod_ID`), INDEX `pr_PurchaseRequisition_FKIndex6`(`pr_supplier_ID`), INDEX `pr_PurchaseRequisition_FKIndex12`(`pr_purchasingClass_ID`), INDEX `pr_PurchaseRequisition_FKIndex7`(`pr_shippingMethod_ID`), INDEX `pr_PurchaseRequisition_FKIndex8`(`pr_workflowState_ID`), INDEX `pr_PurchaseRequisition_FKIndex77`(`CELLS_user_ID_creator`) ) TYPE=InnoDB; CREATE TABLE `CELLS_user` ( `CELLS_user_ID` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `pr_workflowRole_ID` INTEGER UNSIGNED NOT NULL, `CELLS_section_ID` INTEGER UNSIGNED NOT NULL, `login` VARCHAR(20) NULL, `email` VARCHAR(45) NULL, `lastName` VARCHAR(45) NULL, `firstName` VARCHAR(45) NULL, PRIMARY KEY(`CELLS_user_ID`), INDEX `CELLS_User_FKIndex2`(`CELLS_section_ID`), INDEX `CELLS_User_FKIndex3`(`pr_workflowRole_ID`) ) TYPE=InnoDB; The mapping: purchaseRequisition_mapper = bind_mapper( app_model.PurchaseRequisition, app_schema.PurchaseRequisitionTable, properties={ '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 ) } ) query = session.query( app_model.PurchaseRequisition ) return query.select_by(login = "dschulz") global name 'login' is not defined how to filter the users out of the mapped objects? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---