Embed SSH tunnel usage and reuse existing connections
This is way outside the scope of Peewee. Depending on the database driver you are using, you may want to discuss with them, but I doubt you'll have any luck there either. Why you would ever want to pipe a db connection over SSH is a whole other question.

You can use the connection pool, which keeps connections open and recycles them -- this may be the best option for you. http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#pool Thank you for the reply, I though this would actually matter for the project, but I'll try my luck with the mylsq driver we use.

> Why you would ever want to pipe a db connection over SSH is a whole other question.
Would you suggest an alternative to avoid exposing the database and still allow peewee to connect? > Would you suggest an alternative to avoid exposing the database and still allow peewee to connect?

Presumably your application server and database server would be on a LAN and only the application server would be exposed to the internet? I've never, in my career, found it necessary to expose a database server to the public internet.
Because of environment constraints, and peewee lazy loading of DB properties, when using an SSH tunnel  library like 
`from sshtunnel import SSHTunnelForwarder `
I am getting rejected by the SSH server because it establishes a connection every request.

It's really hard to integrate Peewee with the SSH tunnel without running into the SSH server getting spammed with connection opening doing one request and closing.

It would improve reliability to allow peewee itself to manage it's SSH tunnels.
Or maybe there is a best practice when dealing with secure environments that I missed.
