# README

Patterns that can be used in our [flask-eb boilerplate](https://github.com/theorchard/cookiecutter-flask-eb).

## Sqlalchemy pool size recommendations

In general it's reasonable to set the pool size at least to the number of threads used by the microservice to process requests

```text
pool size >= number of threads
```

For example, if our microservice is driven by uwsgi and its settings are

```text
UWSGI_NUM_PROCESSES='1'
UWSGI_NUM_THREADS='15'
```

using [snowflake-connector-sqlalchemy](https://github.com/theorchard/snowflake-connector-sqlalchemy) we would want to initialize our pool with a call like:

```python
from snowflake_connector.snowflake_conn import set_default_sessionmaker

set_default_sessionmaker(
    pool_size=15                      # number of connections kept open
)
```

More information about sqlalchemy can be found [here](sqlalchemy.md)

