This is my function but it does not do anything at the moment : def delete_permission_by_contract_id(contract_id, permission_id): # noqa: E501 """Deletes permissions by contract ID
Returns all permissions related to a specific contract. # noqa: E501 :param contract_id: ID of contract to retreive permissions. :type contract_id: int :param permission_id: ID of permission to remove. :type permission_id: int :rtype: List[Permission] """ # result = db.session.query(PermissionEntity).filter(and_([PermissionEntity.contract_id == contract_id, PermissionEntity.permission_id == permission_id]).first() # for i in result: # i.remove() # db.session.commit() # contract = ContractEntity.query.get(contract_id) # if contract: # permissions = [ # Permission.from_dict(contract.__dict__) # for contract in contract.permissions # ] # permission = PermissionEntity.query.get(permission_id) # if vendors: # return vendors # else: # return {"message": "Contract has no vendors"}, 404 # else: # return {"message": "Contract id couldn't be found"}, 404 pass On Thursday, May 28, 2020 at 6:07:05 PM UTC+1, Tanjil Hussain wrote: > > Could you please give me an example. sorry im abit confused and new to > this.. > > On Thursday, May 28, 2020 at 6:02:52 PM UTC+1, Tanjil Hussain wrote: >> >> Hey, what do you mean by this exactly.. sorry im abit confused and new to >> this.. >> >> On Thursday, May 28, 2020 at 5:55:08 PM UTC+1, Jonathan Vanasco wrote: >>> >>> Sorry, I meant the SqlAlchemy schema. I can't attempt to troubleshoot >>> code that I can't see. >>> >> -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/fac851ed-d9d8-4163-a86b-76e2eebd7bd6%40googlegroups.com.