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")
>         )
> 
> We tried this route but are now getting this error
> 
>   "errors": [
>     {
>       "message": "'Select' object has no attribute 'statement'",
>       "locations": [
>         {
>           "line": 2,
>           "column": 3
>         }
>       ],

While there is no stack trace that would illustrate the line of code that is 
actually making this mistake and this is not illustrated in the line of code 
indicated above, it looks like you are attempting to call upon an attribute 
named .statement, which is something that's on Query, but not on select(), so 
if you have a select() object, you would not want to call .statement first.


-- 
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 received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/6a8a3b62-3340-4da0-839d-5c606ef4d9a7%40app.fastmail.com.

Reply via email to