Check the that SQLAlchemy ResultProxy returns rows before fetching rows
- [X] closes #40205 
- [ ] tests added / passed
- [X] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [X] whatsnew entry