I'm just not getting it: Want: select max(id) from table;
attempt (latest): from sqlalchemy import * from sqlalchemy.engine import reflection from sqlalchemy import schema from sqlalchemy import exc from psycopg2 import * import re import time import os targethost = "192.168.181.204" targetdb = "postgresql://user:pword@"+ targethost +"/whatever" eng2 = create_engine(targetdb) con2 = eng2.connect() meta2 = MetaData() meta2.reflect(bind=eng2) insp2 = inspect(eng2) dst_tab = meta2.tables["tab1"] q3 = dst_tab.select([func.max(dst_tab.c.id)]) maxphoneid = con2.execute(q3).scalar() I get: sqlalchemy.exc.ArgumentError: SQL expression object or string expected, got object of type <type 'list'> instead without the brackets in the select call, I get: sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) argument of WHERE must be type boolean, not type integer LINE 3: WHERE max(phone.id) There's gotta be a way! Any ideas? murf -- 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. For more options, visit https://groups.google.com/d/optout.
