I'm working on a database-centric project with a fellow programmer. We have the following code for retrieving information from our database:
# create connection to database
engine = create_engine(URL(**DATABASE))
Session = sessionmaker(bind=engine)
session = Session()
# construct query
query = session.query(MediaText.line_number, MediaText.start_time_stamp, MediaText.end_time_stamp).\
filter(MediaText.oclc_id == oclcId)
# get info about first line to snapshot
line_to_snapshot = query.fetchone()
When I try to run the code, I get the following error:
AttributeError: 'Query' object has no attribute 'fetchone'
What's confusing is that my partner can run the code just fine. We're both running Python 3.4 and have version 1.0.9 of the SQLAlchemy library on our systems. Does anyone know what could be going wrong here?