Engine
To connect a database, use create_engine() from sqlalchemy. The create_engine() function produce an engine object based on a URL. The URLs follow RFC-1738.
>>>engine = create_engine(dialect+driver://username:password@host:port/database)
|
The above engine creates a Dialect object tailored towards the database and creates a Pool object which establish a DBAPI connection. However, it's first still not yet established until Engine.connect() method is called or an operation which is dependent on this method such as Engine.execute() is invoked.
No comments:
Post a Comment