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
Thanks for the answer Mike, I'll use your advice. It was indeed a problem
of wrong database config. Thanks for the answer.
Le mar. 26 mars 2019 à 19:29, Piyush Nalawade a
écrit :
> Big thanks. Learned something new.
>
> On Tue, Mar 26, 2019, 11:24 PM Jonathan Vanasco
> wrote:
>
>>
>>
>> On
Hi everyone,
I try to update an attribute but it appears that it doesn't save. Would you
know why ? it's very strange because the print is good. but when I query
again this uri_reference it finds Nonetype.
here is the command :
```
@contextlib.contextmanager
def db_session(settings):
ss.uri_ref = :uri ORDER BY ss.id LIMIT 5'
result = self.session.execute(text(sql).params(uri=uri))
return result
Le mer. 27 mars 2019 à 16:04, Scheck David a écrit :
> Hi everyone,
>
> I try to update an attribute but it appears that it doesn't save. Would
> you know why
Hi,
I've a simple query as this :
def count_references(self, uri):
sql = 'SELECT count(*) FROM (SELECT image.id,
json_array_elements(image.uri_reference)::text as uri_ref FROM image) ss
WHERE ss.uri_ref = \'\"{0}\"\''.format(uri)
result = self.session.execute(text(sql))
I
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 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.
Ok solved it in postgresql thanks
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You
@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_metad
rt 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 21, 2019 at 8:44 AM Scheck David wro
I really don't know why this query returns me this .. totally mysterious
Le jeudi 16 mai 2019 16:27:50 UTC+2, Scheck David a écrit :
>
> I finished by a query like that :
>
>
> last_statuses = aliased(statussen_table_name,
> self.session.query(getattr(statussen_table
Hi,
I have to perform a query who filter in the last relations created an
attribute, but I don't know how to do. I checked the doc and I don't get it
class Statustype(Base):
__tablename__ = 'statustypes'
id = Column(Integer, nullable=False, primary_key=True)
naam =
I think I'm near but I can't finish :
for all the structure : https://dpaste.de/fek5#L
and here my query :
self.session.query(Object).outerjoin(ObjectStatus).outerjoin(Status)\
.group_by(Object).with_entities(Object,
func.max(Status.datum).label("status_datum")).subquery()
> Hi -
>
> I was hoping someone could jump in on this.
>
> do you know the SQL that you want to emit? E.g. plain SQL string. I
> can help you do that part.
>
>
> On Mon, May 13, 2019 at 9:11 AM Scheck David wrote:
> >
> > I think I'm near but I can't finish :
&g
nt models. For complicated SQL logic I think this
> is a good practice in general.
>
> You current question seems like a general SQL question rather than
> something specific to SQL Alchemy. After you've the SQL, we could discuss
> the reverse engineering.
>
> On Mon, May 1
>
>
> Here is the sql generated for this query : https://dpaste.de/bJsc
Le lundi 13 mai 2019 17:46:29 UTC+2, Mike Bayer a écrit :
>
>
>
> On Mon, May 13, 2019 at 10:37 AM Scheck David > wrote:
>
>> the problem is that I can't use SQL for this becaus
>
> Here is my sql for this case
>
SELECT DISTINCT erfgoed.id as id,
statussen.statustype_id as statype_id,
statussen.datum as datum,
erfgoed.naam as naam
FROM erfgoedobjecten as erfgoed
JOIN erfgoedobjecten_statussen as erfgoedobjectstatus
ON erfgoed.id = erfgoedobjectstatus.erfgoedobject_id
Ok I just identified the issue. It seems that there is a conflict between 2
subqueries :
in my model.I have this :
statussen = relationship(
"PersoonStatus",
order_by="desc(PersoonStatus.status_datum)",
backref='persoon',
cascade='all, delete, delete-orphan',
I did this :
1. self.session.query(Object)\
2. .join(Object.statussen)\
3. .filter(Status.id == self.session.query(Status).order_by(desc(Status.
datum)).first().id)\
4. .filter(Statustype.id > 50).all()
but I still don"t get it
--
SQLAlchemy -
The Python SQL Toolkit and
I finished by a query like that :
last_statuses = aliased(statussen_table_name,
self.session.query(getattr(statussen_table_name, object_name),
I finished by a query like that :
last_statuses = aliased(statussen_table_name,
self.session.query(getattr(statussen_table_name, object_name),
For a full state of what I have
https://dpaste.de/vV8k
the goal is to convert the sql query to SQLAlchemy.
Thanks in advance for any help
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal,
Here is the last version of my sql query:
https://dpaste.de/8UhP
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve
I'm near the result of sql:
https://dpaste.de/1XYa#
Le lundi 13 mai 2019 17:46:29 UTC+2, Mike Bayer a écrit :
>
>
>
> On Mon, May 13, 2019 at 10:37 AM Scheck David > wrote:
>
>> the problem is that I can't use SQL for this because this is a mixins
>> that I u
In fact this I will use as a method on a datamanager use for different
objects. In this sql the object is erfgoedobjecten but it will change.
Le mar. 14 mai 2019 à 18:06, Jonathan Vanasco a
écrit :
>
>
> On Tuesday, May 14, 2019 at 10:29:58 AM UTC-4, Scheck David wrote:
>&
25 matches
Mail list logo