If I had time to respond yesterday, I would have said the same thing as
Simon.
Your database model leverages two separate parts of SQLAlchemy:
* SqlAlchemy ORM (Left side of the docs https://docs.sqlalchemy.org/en/13/ )
* SqlAlchemy Core (Right side of the docs https://docs.sqlalchemy.org/en/13/
[image: Capture.PNG]
In regards to your question..I want to remove the whole relationship for
example.. the whole first row as shown in the picture:
On Friday, May 29, 2020 at 10:21:44 PM UTC+1, Mo Hus wrote:
>
> Hey Simon , permissions has only relationship with permission_contract and
> cont
Hey Simon , permissions has only relationship with permission_contract and
contract only has relationship with permission_contract ...I want to be
able to delete the relationship from permission_contract ...
For example, in my permissions_contract, I may have permission_id = 1 which
is the id ta
It looks like you've got a many-to-many relationship between Contract and
Permission, and you want to remove a Permission from a Contract (or vice
versa). Is that right?
If so, you can do something like this:
contract =
permission =
contract.permissions.remove(permission)
https://docs.sqlalch
Hey Jonathan, any luck? thanks
On Thursday, May 28, 2020 at 4:15:38 PM UTC+1, Mo Hus wrote:
>
> [image: Capture.PNG]
>
> permission_id and contract_id have a relationship in the database
>
> How can i using remove a entry for example.. if permission_id = 2 and
> contract_id = 2 exists in the same
contract entity:
from api.extensions import db
from sqlalchemy.sql import expression
contracts_users = db.Table("contracts_users",
db.Column("contract_id"
, db.Integer, db.ForeignKey(
"contracts.id"), primary_key=True),
What is the code for PermissionEntity, ContractEntity, and the joining
table?
it will look like this
https://docs.sqlalchemy.org/en/13/orm/basic_relationships.html#one-to-many
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code
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 contra
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 Va
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
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://s
permission_contract:
[image: Capture.PNG]
permissions:
[image: Capture2.PNG]
contracts:
[image: Capture3.PNG]
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiabl
can you share your schema for these 3 tables?
--
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
Thanks for the response...
I have one table for permissions which has 'PermissionEntity' and another
table for contract which has 'ContractsEntity' .. the table I am currently
trying to remove my entry from is another table called permission_contract
which is shown below:
[image: Capture.PNG
`.get()` returns the corresponding row/object based on the primary key
https://docs.sqlalchemy.org/en/13/orm/query.html?highlight=get#sqlalchemy.orm.query.Query.get
assuming `PermissionEntity` has a primary key of (permission_id,
contact_id), the syntax from the examples would be:
some_object
15 matches
Mail list logo