I'm downloading some data from a SQL Server database through a library that leverages pymssql in the back-end. The result of a curson.execute("""<QUERY BODY>""") is a sqlalchemy.engine.result.ResultProxy object. How can I check if the result of the query was empty, so there are no rows?
cur = ff.sql.create_engine(server=dw.address, db=dw.BI_DW, login=":".join([os.environ["SQL_USER"], os.environ["SQL_PASSWD"]])) for n in range(100): result = cur.execute("""QUERY BODY;""") if result: break Unfortunately, result will never be None even when no rows were returned by the SQL query.
What's the best way to check for that?
COUNT(*)in your query?