Re: [sqlalchemy] Index on nested JSONB field

2019-03-21 Thread Scheck David
@mike, a real thank you for your patience. I'm sorry I was lost for a while, I understood what you said and it's what I'm doing now. Thanks for the tips and sorry for your time Le jeu. 21 mars 2019 à 17:17, Scheck David a écrit : > CREATE INDEX img_createdby_uri_index ON image ((image_metadata -

Re: [sqlalchemy] Index on nested JSONB field

2019-03-21 Thread Mike Bayer
just to confirm, run this inside of any execute() callable, eg. in alembic: op.execute("CREATE INDEX img_createdby_uri_index ON image ((image_metadata -> 'systemfields' -> 'created_by' ->> 'uri'))") with an engine with engine.connect() as conn: conn.execute("CREATE INDEX img_createdby_uri_ind

Re: [sqlalchemy] Index on nested JSONB field

2019-03-21 Thread Scheck David
CREATE INDEX img_createdby_uri_index ON image ((image_metadata -> 'systemfields' -> 'created_by' ->> 'uri')); that's what I want. thank you Le jeu. 21 mars 2019 à 14:25, Mike Bayer a écrit : > (noting again, you need the CREATE INDEX statement that PG wants. > SQLAlchemy part is only a bonus wh

Re: [sqlalchemy] Index on nested JSONB field

2019-03-21 Thread Mike Bayer
(noting again, you need the CREATE INDEX statement that PG wants. SQLAlchemy part is only a bonus which isn't strictly needed here). On Thu, Mar 21, 2019 at 9:24 AM Mike Bayer wrote: > can you go onto some Postgresql forums and ask there? this is a > Postgresql-specific issue. > > On Thu, Mar 2

Re: [sqlalchemy] Index on nested JSONB field

2019-03-21 Thread Mike Bayer
can you go onto some Postgresql forums and ask there? this is a Postgresql-specific issue. On Thu, Mar 21, 2019 at 8:44 AM Scheck David wrote: > In fact it's a function in postgresql which catch all urls and store it in > a field. but it's not what I'm searching for. I just have to create an >

Re: [sqlalchemy] Index on nested JSONB field

2019-03-21 Thread Scheck David
In fact it's a function in postgresql which catch all urls and store it in a field. but it's not what I'm searching for. I just have to create an index gin and I still don't know how to. I'm just stuck because I don't understand how to create index on a nested field. op.create_index('ix_law_search

Re: [sqlalchemy] Index on nested JSONB field

2019-03-21 Thread Mike Bayer
I hardly understand what that does but if it floats your boat, get on board ( I guess?) On Thu, Mar 21, 2019 at 4:35 AM Scheck David wrote: > I found this which could make the work. because it seems that it index all > in one field and this will improve my performances. what do you think? > > ht

Re: [sqlalchemy] Index on nested JSONB field

2019-03-21 Thread Scheck David
the only problems is when I'll query with SQLAlchemy with a field like : "uri,uri,uri" is there a simple query to extract this uri ? like a contains ? Le jeu. 21 mars 2019 à 09:35, Scheck David a écrit : > I found this which could make the work. because it seems that it index all > in one field

Re: [sqlalchemy] Index on nested JSONB field

2019-03-21 Thread Scheck David
I found this which could make the work. because it seems that it index all in one field and this will improve my performances. what do you think? https://stackoverflow.com/questions/40106609/indexing-nested-json-with-postgres I think this could do the trick Le mer. 20 mars 2019 à 17:03, Mike Baye

Re: [sqlalchemy] Index on nested JSONB field

2019-03-20 Thread Mike Bayer
On Wed, Mar 20, 2019 at 11:04 AM david scheck wrote: > > Hi everyone, > > I'm trying to implement a nested JSONB index on a nested field in the json > file. I searched through internet and came at the conclusion that I had to > create it manually. > > so that's where I am. > > op.create_index('i

[sqlalchemy] Index on nested JSONB field

2019-03-20 Thread david scheck
Hi everyone, I'm trying to implement a nested JSONB index on a nested field in the json file. I searched through internet and came at the conclusion that I had to create it manually. so that's where I am. op.create_index('ix_law_search_vector', 'law', ['search_vector'], unique=False, postgre