FastAPI + sqlalchemy + memsql example setup

Is there an example repo setup with FastAPI + sqlalchemy with pooled connections and async calls that we can poke around?

We are facing some weird “PendingRollBack” exceptions which point to driver/ setup issue.

Our stack is Python 3.9, PyMysql, FastAPI, Singlestore 7.x

Some relevant code:

memsql==3.1.0
mysql-connector==2.2.9
mysqlclient==2.0.3
PyMySQL==1.0.2

def _get_connection_string(self, database_name: str):
        return (
            f"mysql+pymysql://{self._user_name}:{self._user_pass}@"
            f"{self._host_name}:{self._port}/{database_name}?charset=utf8"
        )

engine = create_engine(conn_str, convert_unicode=True, max_overflow=10, pool_size=100, pool_recycle=60, pool_pre_ping=True)

Thanks,
Vick

Hi @vick_eog, welcome to the SingleStore community!

I’m working on pulling some content together to help answer your question. In the meantime, can you please send the full details of the calling code that is failing and the exception that is being thrown?

Hello again, @vick_eog. We have a training course that walks you through building a Python & Flask application that might have some information to help you get past the exception you’re running into. If you haven’t already, please sign up at https://training.singlestore.com/ and you can review the Python & Flask modules there.

Thanks for the training link. I havent seen it yet… as I said, no issues with Flask + Singlestore as such. I am curious about FastAPI + Singlestore. More importantly async.io support.