def get_actor_id(name): stmt = select([actors.c.actor_id], actors.c.name == name) actor_ids = conn.execute(stmt) if actor_ids: for actor in actor_ids: actor_ids.close() return actor
def get_movies_from_id(actor_id): stmt = select([movies.c.name], and_(actor_id == acts.c.actor_id, acts.c.movie_id == movies.c.movie_id)) results = conn.execute(stmt).fetchall() movie_list = [] for result in results: try: movie_list.append(result[0]) except Exception: pass return movie_list