Skip to content

PyClient: Deleting records from an inherited table fails to delete these records from the parent table #6546

Description

@willemijn-oudijk

Have you checked if this issue already exists?

  • yes

Molgenis EMX2 version

Software version: 13.171.0. Database version: 33.

Description

When I try to delete records from an inherited table with the pyclient, the records are deleted in the subtable, but not in the parent table. When I try to do the same thing with the UI functionality, the record is deleted from both the parent and the sub table.

Reproduction steps

  1. Go to 'https://emx2.dev.molgenis.org'
  2. Create a new empty schema called pet store delete issue with the profile pet store and include demo data.
  3. Upload the following archive. This adds a table Small pets to the pet store, this table extends Category. The Small pets table includes two rows: Cats (small) and Dogs (small). These records are also present in the parent table Category.

pet store delete issue1785229295558.zip

  1. Create a new script with the following code:
from molgenis_emx2_pyclient import Client
import pandas as pd
import os

MOLGENIS_TOKEN = os.environ['MOLGENIS_TOKEN']
client = Client(url='http://localhost:8080', token=MOLGENIS_TOKEN)

small_pets = client.get(table='Small pets', as_df=True, schema='pet store delete issue')

client.delete_records(schema='pet store', table='Small pets', data=small_pets)

print(f"Deleted {list(small_pets['name'])}")
  1. Run the script
  2. See that the entries are deleted from the Small pets table but not the Category table.

Expected behaviour

I expected the entries to be deleted from both the inherited table, as well as the parent table, as it does when using the UI functionality.

System configuration

  • Device:
  • Operating system:
  • Browser:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions