-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GRAMEX-97 ⁃ ENH: Update multiple rows in files and DBs with data.update #456
base: master
Are you sure you want to change the base?
Conversation
|
||
names = ['Humphrey Bogart', 'James Stewart', 'Audrey Hepburn'] | ||
categories = ['Stars', 'Thespians', 'Heartthrobs'] | ||
ratings = [1, 0.99, 1.11] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test case where
ratings
has only 2 values [1, 0.99] and the third is missing. Audrey's rating should not get updated, but her categories should be.names
has only 2 values -- in which case, the 3rd category and rating are ignored
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sanand0 This works for files, but for sqlalchemy, to deal with uneven args, we might have to do column-wise update queries. Is this acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaidevd -- yes, column-wise update queries are fine. I don't anticipate this to be used often and we can optimize later
df = gramex.data.filter(temp_db, args={'name': names}, table='actors') | ||
self.assertEqual(df['category'].tolist(), categories) | ||
self.assertEqual(df['rating'].tolist(), ratings) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add test cases for MySQL, PostgreSQL.
Closes #312
┆Issue is synchronized with this Jira Bug