[QUESTION] Update json field
See original GitHub issueI have a json field structured like this:
[{"fecha": "31-10-2020 16:00", "doctor": "5d2a1c29-21b9-4a02-846c-171ba65ba0ea", "paciente": {"code": "a4723719-fbd4-4d16-9470-97ea93c3c5dd", "conv": "sebastian muñoz"}}]
Is there a way of update a single attribute of the json field ?..I mean without making a query and extracting the attributes.
return await some_pydantic.from_queryset_single(SomeModel.get(id=id)) <—Not this
something like this…obviously field and attr are examples return await some_pydantic.from_queryset_single(SomeModel.update(id=id).field(jsonField).attr(fecha=‘New Date’))
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Updating JSON Data in PostgreSQL - Aaron Bos
Updating JSON Data in PostgreSQL. If you're storing JSON data in Postgres, you'll eventually need to update it. In this post, we'll talk ......
Read more >How do I modify fields inside the new PostgreSQL JSON ...
@Andrew, you'd use to_jsonb(substring(column_name, 1, 2)) to convert the column value to jsonb. So, update objects set body=jsonb_set(body, '{name}', to_jsonb( ...
Read more >postgresql 13 - how to update a property value of a jsonb field?
There are two ways to accomplish this: Simply concatenating the new key/value pair: update the_table set attr = attr || '{"is_default": ...
Read more >Update Json field via Nifi - Cloudera Community - 321075
Support Questions · 1. Add a new property(keyword_value) in ExtractText and value/expression should be below · 2. Remove space,double quotes from ...
Read more >How to ask for each field for update in json file. - CodeProject
I'll update. The problem is when I enter some input for change suppose I change the city name then instead of storing the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OK, this is postgres example:
And the sql is
Ok…I get it. But still is really confusing implement this in tortoise…Could you please add an example ? https://www.postgresql.org/docs/12/functions-json.html
Thank you for your time and predisposition.