Giter Club home page Giter Club logo

Comments (6)

Alvalunasan avatar Alvalunasan commented on June 26, 2024 1

Example of an incorrect deletion on version 3.4.2
table lab.DutyRoaster: (lab.User as foreign key many times)

%{
duty_roaster_date:  date       # date from which this assignment is valid.
----- 
(monday_duty)    -> lab.User(user_id)
(tuesday_duty)   -> lab.User(user_id)
(wednesday_duty) -> lab.User(user_id)
.
.
%}

testtech_del1 is a reference only for record 2 {'2021-03-11'}

lab.DutyRoaster

    DUTY_ROASTER_DATE       monday_duty         tuesday_duty        wednesday_duty      ...   
    _________________    _________________    _________________    _________________    ...

     {'2021-03-10'}      {'jrw10'        }    {'baptista'     }    {'jrw10'        }    ...
     {'2021-03-11'}      {'testtech_del1'}    {'testtech_del2'}    {'testtech_del1'}    ...

We try to delete that user it tries to delete all records from duty_roaster :

key.user_id = 'testtech_del1'
del(lab.User & key)

ABOUT TO DELETE:
       1 tuples from `u19_lab`.`user` (manual)
       2 tuples from `u19_lab`.`duty_roaster` (manual)

from datajoint-matlab.

kabilar avatar kabilar commented on June 26, 2024

@kabilar @Alvalunasan

from datajoint-matlab.

Alvalunasan avatar Alvalunasan commented on June 26, 2024

Do we have any updates on this ?
Our team here in Princeton has been facing this issue a lot now.
Thanks

from datajoint-matlab.

kabilar avatar kabilar commented on June 26, 2024

Hi @Alvalunasan, thanks for the report. After discussion with @guzman-raphael, the team will be able to return to this issue within 2-3 weeks.

from datajoint-matlab.

zfj1 avatar zfj1 commented on June 26, 2024

Just commenting here since this hasn't had any traction in a while. I believe this issue can be resolved with an edit to a single line of code, as in 938626c. This probably arose in the most recent release because of weak typing in MATLAB and testing against a table with only one foreign key. I haven't checked that the rest of the logic there is sound, but if you read the comments it's obvious this is what they were going for. So as a workaround before this gets formally addressed you should just be able to edit that line in your datajoint installation.

from datajoint-matlab.

kabilar avatar kabilar commented on June 26, 2024

Thanks @Alvalunasan. I will adapt your example for a test case.

Schema diagram

image

Table definitions

lab.User

%{
user_id: varchar(32)
%}

classdef User < dj.Manual
end

lab.Duty

%{
duty_date:  date
----- 
(duty_first)    -> lab.User(user_id)
(duty_second)    -> lab.User(user_id)
%}

classdef Duty < dj.Manual
end

Insert table entries

users = [{'user0'
          'user1'
          'user2'}]

insert(lab.User, users)

duty = [{'2020-01-01','user0','user1'},
        {'2020-12-31','user1','user2'}]

insert(lab.Duty, duty)

Table entries

lab.User()

     USER_ID 
    _________

    {'user0'}
    {'user1'}
    {'user2'}
lab.Duty()

      DUTY_DATE       duty_first    duty_second
    ______________    __________    ___________

    {'2020-01-01'}    {'user0'}      {'user1'} 
    {'2020-12-31'}    {'user1'}      {'user2'} 

Test case 1 with DataJoint MATLAB 3.4.2

Versions

MATLAB R2020b
DataJoint MATLAB 3.4.2
mym 2.8.2

  • Deleting user0 in lab.User, deletes all entries in lab.Duty table.
key.user_id = 'user0'
del(lab.User & key)

ABOUT TO DELETE:
       1 tuples from `kabilar_lab`.`user` (manual)
       2 tuples from `kabilar_lab`.`duty` (manual)

Proceed to delete? (yes/no) > yes
Deleting from lab.Duty
Deleting from lab.User
committed


lab.Duty()
0 tuples

Test case 2 with DataJoint MATLAB 3.4.3

Versions

MATLAB R2020b
DataJoint MATLAB 3.4.3
mym 2.8.2

  • Deleting user0 in lab.User, throws an error.
key.user_id = 'user0';
del(lab.User & key)

Error using  ~ 
Too many input arguments.

Error in dj.Relvar/del (line 95)
                            if ~fks.aliased

from datajoint-matlab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.