January 2019
Beginner
556 pages
14h 19m
English
The SQL expression language component can be used to manipulate data in the database.
To connect to a database, it is necessary to first create an engine object. This is done with the create_engine() function, as follows:
from sqlalchemy import *engine = create_engine( "postgresql+pg8000://car_portal_app@localhost/car_portal", echo=True)
Here, a connection string was used. It has a format dialect[+driver]://user:password@host/dbname. The echo parameter is set to True. This tells SQLAlchemy to log every SQL statement that was executed for debugging purposes. In the preceding example, the pg8000 driver is used to connect to the database (assuming it's also installed with ...
Read now
Unlock full access