Who connects to the Sqlalchemy database?

Asked

Viewed 37 times

0

I have an app that uses Sqlalchemy’s ORM, but I’m confused about this connection.

It is Sqlalchemy or the connection driver (in my case psycopg2) that actually connects to the database?

  • Sqlalchemy makes the connection using the create_engine. To import the method use from sqlalchemy import create_engine.

  • 1

    Sqlalchemy does not actually make the connection, and is an abstraction layer over relational databases that maps tables into objects. To do this it uses a Dialect class that is a shell over the driver, in your case the Postgresql(psycopg2) driver. If you look at the source of the Sqlalchemy you will see that some DBMS connection drivers are included for those that are not included in the package is provided a ODBC interface.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.