the stack trace would show you where it's going wrong. Are you calling first() on the query? that applies limit(). Stack trace will show this. Can't apply limit() to a textual query because the text is already written.
On Thu, May 16, 2019 at 10:16 AM Xander Cage <[email protected]> wrote: > > hi all. > > got this error while playing around whith flask-admin and trying to fire a > sql query. > > class AixEditForm(ModelView): > def get_query(self): > stmt = text("select `n`.`id` AS `NODE_ID`,`n`.`name` AS `NODE`," > "max(if((`a`.`name` = 'LOCATION'),`e`.`value`,NULL)) AS > `LOCATION`," > "max(if((`a`.`name` = 'IS_CLUSTER'),`e`.`value`,NULL)) AS > `IS_CLUSTER`," > "max(if((`a`.`name` = 'MAN_SYS_NAME'),`e`.`value`,NULL)) > AS `MAN_SYS_NAME`," > "max(if((`a`.`name` = 'OS_LEVEL'),`e`.`value`,NULL)) AS > `OS_LEVEL`," > "max(if((`a`.`name` = 'IS_LPM'),`e`.`value`,NULL)) AS > `IS_LPM`," > "max(if((`a`.`name` = 'CPU_VALUE'),`e`.`value`,NULL)) AS > `CPU_VALUE`," > "max(if((`a`.`name` = 'CLUSTER_RGS'),`e`.`value`,NULL)) > AS `CLUSTER_RGS`," > "max(if((`a`.`name` = 'HA_LEVEL'),`e`.`value`,NULL)) AS > `HA_LEVEL`," > "max(if((`a`.`name` = 'CLUSTER_NODES'),`e`.`value`,NULL)) > AS `CLUSTER_NODES`," > "max(if((`a`.`name` = 'CLUSTER_NAME'),`e`.`value`,NULL)) > AS `CLUSTER_NAME`," > "max(if((`a`.`name` = 'CPU_POOL'),`e`.`value`,NULL)) AS > `CPU_POOL`," > "max(if((`a`.`name` = 'AME_FACTOR'),`e`.`value`,NULL)) AS > `AME_FACTOR`," > "max(if((`a`.`name` = 'SYS_PROFILE'),`e`.`value`,NULL)) > AS `SYS_PROFILE`," > "max(if((`a`.`name` = 'INFO_MAIL'),`e`.`value`,NULL)) AS > `INFO_MAIL`," > "max(if((`a`.`name` = 'HOSTNAME'),`e`.`value`,NULL)) AS > `HOSTNAME`," > "max(if((`a`.`name` = 'OS_TYPE'),`e`.`value`,NULL)) AS > `OS_TYPE`," > "max(if((`a`.`name` = 'UPTIME'),`e`.`value`,NULL)) AS > `UPTIME`," > "max(if((`a`.`name` = 'IP'),`e`.`value`,NULL)) AS `IP`," > "max(if((`a`.`name` = 'IP_LONG'),`e`.`value`,NULL)) AS > `IP_LONG`," > "max(if((`a`.`name` = > 'CLUSTER_NODENAME'),`e`.`value`,NULL)) AS `CLUSTER_NODENAME`," > "max(if((`a`.`name` = > 'RG_SERVICE_IP_LONG'),`e`.`value`,NULL)) AS `RG_SERVICE_IP_LONG`" > "from ((`entries` `e` left join `nodes` `n` on((`n`.`id` > = `e`.`node_id`)))" > "left join `attribs` `a` on((`a`.`id` = > `e`.`attrib_id`)))" > "where (`a`.`parent` = 'NODE') group by `n`.`name` > order by `n`.`id`") > return self.session.query().from_statement(stmt) > > > sqlalchemy.exc.InvalidRequestError: Query.limit() being called on a Query > with an existing full statement - can't apply criterion. > > an idea what might be the problem here..i am clueless. > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sqlalchemy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sqlalchemy/62dc9635-d617-4e80-9376-767bd0d7c559%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sqlalchemy. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CA%2BRjkXHB%3DV%3D3kFO%3DZYbrPw6-rAtfg5CYMt%2B6p41TExDdXE7b3Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
