sqlalchemy Engine


Example

The engine is used to connect to different databases using a connection URL:

from sqlalchemy import create_engine

engine = create_engine('postgresql://user:pass@localhost/test')

Note, however, that the engine does not actually establish a connection until it is first used.

The engine automatically creates a connection pool, but opens new connections lazily (i.e. SQLAlchemy won't open 5 connections if you only ask for one).