awswrangler.db.get_engine

awswrangler.db.get_engine(db_type: str, host: str, port: int, database: str, user: str, password: str) → sqlalchemy.engine.base.Engine

Return a SQLAlchemy Engine from the given arguments.

Only Redshift, PostgreSQL and MySQL are supported.

Parameters
  • db_type (str) – Database type: “redshift”, “mysql” or “postgresql”.

  • host (str) – Host address.

  • port (str) – Port number.

  • database (str) – Database name.

  • user (str) – Username.

  • password (str) – Password.

Returns

SQLAlchemy Engine.

Return type

sqlalchemy.engine.Engine

Examples

>>> import awswrangler as wr
>>> engine = wr.db.get_engine(
...     db_type="postgresql",
...     host="...",
...     port=1234,
...     database="...",
...     user="...",
...     password="..."
... )