examples/sqla/orm_logging.py
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
from orm_create_db import Base, Genre, Movie, Person, Cast

import logging

logging.basicConfig()
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)

logger = logging.getLogger('demo')
logger.setLevel(logging.INFO)

dbname = 'imdb.db'
engine = create_engine('sqlite:///' + dbname)

Base.metadata.bind = engine

session = Session(engine)


logger.info("Selecting all")
movies = session.query(Movie).all()
for m in movies:
    logger.info("------------")
    #print(m.title, "-", m.genre_id)
    print(m.title, "-", m.genre.name)