Thanks a lot for the explanation, it's all clear now!
On 15 May 2017 at 18:56, mike bayer wrote:
>
>
> On 05/15/2017 11:56 AM, Zsolt Ero wrote:
>>
>> I might not be understanding something, but for me there are two
>> different concepts here:
>>
>> map_obj =
On 05/15/2017 11:56 AM, Zsolt Ero wrote:
I might not be understanding something, but for me there are two
different concepts here:
map_obj = dbsession.query(Map).get(id_)
is an object in memory, loaded with a long SELECT statement, allowing
us to get and set different attributes and the
I might not be understanding something, but for me there are two
different concepts here:
map_obj = dbsession.query(Map).get(id_)
is an object in memory, loaded with a long SELECT statement, allowing
us to get and set different attributes and the session / transaction
manager commits the
On 05/15/2017 10:54 AM, Zsolt Ero wrote:
Thanks, it is all clear now. Just out of interest, what is the point
of synchronize_session='fetch'?
that will do a SELECT and get the new value back and update your ORM
object in memory. Set synchronize_session=False if you don't care.
For me
On Monday, May 15, 2017 at 9:58:57 AM UTC-4, Mike Bayer wrote:
>
> I'd be curious to see under what scenarios being able to set one element
> of the JSON
> vs. UPDATEing the whole thing is a performance advantage significant
> compared to the usual overhead of the ORM flush process; that is,
Thanks, it is all clear now. Just out of interest, what is the point
of synchronize_session='fetch'?
For me all it does is a simple SELECT maps.id AS maps_id FROM maps
WHERE maps.id = %(id_1)s
All I get as a return value is 0: not successful (probably id didn't
exist), while 1: successful. It is
On 05/15/2017 10:31 AM, Zsolt Ero wrote:
I'm trying to run your example, but it doesn't work:
from sqlalchemy import func
m = request.dbsession.query(models.Map).get(3)
m.screenshots = func.jsonb_set(m.screenshots, '{key}', '"value"')
request.dbsession.flush()
It ends up in a
On 05/15/2017 10:18 AM, Zsolt Ero wrote:
Thanks for the answer. My use case is the following:
I have an object (map_obj), which has screenshots in two sizes. I'm
using JSONB columns to store the screenshot filenames.
Now, the two screenshot sizes are generated in parallel. The code is
like
I'm trying to run your example, but it doesn't work:
from sqlalchemy import func
m = request.dbsession.query(models.Map).get(3)
m.screenshots = func.jsonb_set(m.screenshots, '{key}', '"value"')
request.dbsession.flush()
It ends up in a (psycopg2.ProgrammingError) can't adapt type 'dict'.
Also,
Thanks for the answer. My use case is the following:
I have an object (map_obj), which has screenshots in two sizes. I'm
using JSONB columns to store the screenshot filenames.
Now, the two screenshot sizes are generated in parallel. The code is
like the following:
map_obj = query(...by id...)
On 05/15/2017 09:32 AM, Zsolt Ero wrote:
In PostgreSQL 9.5+ it is finally possible to modify a single key inside
a JSONB column. Usage is something like this:
update maps set screenshots=jsonb_set(screenshots, '{key}', '"value"')
where id = 10688
Is it possible to write this query using
In PostgreSQL 9.5+ it is finally possible to modify a single key inside a
JSONB column. Usage is something like this:
update maps set screenshots=jsonb_set(screenshots, '{key}', '"value"')
where id = 10688
Is it possible to write this query using the ORM somehow? If not, please
take it as a
12 matches
Mail list logo