gramex icon indicating copy to clipboard operation
gramex copied to clipboard

Cannot update multiple rows with gramex.data.update

Open jaidevd opened this issue 5 years ago • 5 comments

Is something not working as expected? gramex.data.update does not parse args correctly.

Steps to reproduce. Suppose there's a file.csv containing:

id, val
1, x
2, y
3, z

then the following:

gramex.data.update('file.csv', id="id", args={'id': [2, 3], 'val': ['a', 'b']})

converts it into:

id, val
1, x
2, a
3, a

Expected behavior It should update rows 2 and 3 to a and b respectively.

Your environment:

  • Gramex version: master branch as of this bug report.

jaidevd avatar Oct 15 '20 03:10 jaidevd

I'll explore this. I forgot what the intended behavior is, but the update should be able to change multiple rows as described.

Will plan for the Nov release.

sanand0 avatar Oct 15 '20 04:10 sanand0

This feature has slipped by a month and will be planned for the January release

sanand0 avatar Nov 01 '20 15:11 sanand0

I am still behind on this feature, and it's at risk for 1.67.

sanand0 avatar Dec 30 '20 04:12 sanand0

@sanand0 @bhatsandeep When are we planning to fix this? This is blocking https://gramenertech.atlassian.net/browse/GRAMEX-15

Specifically, from the user management component of the admin2 app, editing attributes of multiple users at a time doesn't work.The last value overwrites the whole table.

jaidevd avatar Sep 28 '21 05:09 jaidevd

@jaidevd -- the places to change are in data.py

  • _filter_frame: under elif source == 'update'
  • _filter_db: under elif source == 'update'
  • _update_mongodb

Could you see if you could send a PR?

sanand0 avatar Sep 28 '21 07:09 sanand0