Re: [sqlalchemy] Query object modification

2023-04-13 Thread Mike Bayer
On Thu, Apr 13, 2023, at 4:14 PM, Luis Del Rio IV wrote: > Mike, > > Would this select query be able to get our aggregated data? > > query = > select(func.max(DataModel.value)).select_from(_query.subquery()).group_by( > func.date_format(DataModel.timestamp, "%Y-%m-%d %H") >

Re: [sqlalchemy] Query object modification

2023-04-13 Thread Mike Bayer
On Thu, Apr 13, 2023, at 1:13 PM, Peter Harrison wrote: > Thanks Mike, > > Ideally we'd prefer to find a solution via Graphene-SQLAlchemy. Unfortunately > we don't have the luxury of creating our own query when interacting with > Graphene-SQLAlchemy. > > So the key question for us is, can you

Re: [sqlalchemy] Query object modification

2023-04-13 Thread Luis Del Rio IV
Mike, Would this select query be able to get our aggregated data? query = select(func.max(DataModel.value)).select_from(_query .subquery()).group_by( func.date_format(DataModel.timestamp, "%Y-%m-%d %H") ) We tried this route but are now getting this error "errors":

Re: [sqlalchemy] Query object modification

2023-04-13 Thread Peter Harrison
Thanks Mike, Ideally we'd prefer to find a solution via Graphene-SQLAlchemy. Unfortunately we don't have the luxury of creating our own query when interacting with Graphene-SQLAlchemy. So the key question for us is, can you modify an existing sqlalchemy.orm.query.Query object to insert a "func

Re: [sqlalchemy] Query object modification

2023-04-12 Thread Mike Bayer
On Wed, Apr 12, 2023, at 5:21 PM, Luis Del Rio IV wrote: > I am currently using the following sqlalchemy code, > > _query = super().get_query(model, info, sort, **args) > query = _query.group_by( > func.date_format(DataModel.timestamp, "%Y-%m-%d %H") > ) >

[sqlalchemy] Query object modification

2023-04-12 Thread Luis Del Rio IV
I am currently using the following sqlalchemy code, _query = super().get_query(model, info, sort, **args) query = _query.group_by( func.date_format(DataModel.timestamp, "%Y-%m-%d %H") ) return query I am trying to aggregate the the max value of a field

[sqlalchemy] Query object over sqlite3 returning Nones

2011-11-18 Thread Yang Zhang
I'm using sqlalchemy 0.6.6 and sqlite 3.6.22 on Python 2.6. When I do: In [1]: for i in ses.query(UserSnapshot): ...: print i ...: if i is None: break ...: I see: ... None My schema: class User(Base): __tablename

[sqlalchemy] Query Object

2010-03-08 Thread Paulo Aquino
Are there performance difference between the following line of codes. a. for instance in Query: -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, sen

[sqlalchemy] Query object behavior for methods all() and one()

2008-01-14 Thread Adrian
I am a bit confused by the behavior for the methods all() and one() if the Query would return an empty result set. In the case of all() it returns an empty list whereas one() will throw an exception (sqlalchemy.exceptions.InvalidRequestError). I am sure there was a reason to implement as it is now