Skip to content
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

Unable to update column to null. #501

Closed
ivanbolcina opened this issue Mar 14, 2024 · 0 comments
Closed

Unable to update column to null. #501

ivanbolcina opened this issue Mar 14, 2024 · 0 comments
Labels
done done enhancement New feature or request

Comments

@ivanbolcina
Copy link

ivanbolcina commented Mar 14, 2024

If using impl_update and updating some column to null, and that column currently has some value in database, then impl_update simply ignores this value.

so it is not possible to do this with impl_update:

update TABLE1 set COLUMN1='test', COLUMN2=NULL where ID=10

The problem is in this line

#[$crate::py_sql("update ${table_name} set
trim ',':
for k,v in table:
if k == column || v== null:
continue:
${k}=#{v},
",$sql_where)]

Please provide an option to update all columns to impl_update macro or provide another macro that does this or a macro that receives whole update statement.

@zhuxiujia zhuxiujia added the enhancement New feature or request label Mar 14, 2024
zhuxiujia added a commit that referenced this issue Mar 14, 2024
@zhuxiujia zhuxiujia added the done done label Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done done enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants