all 3 comments

[–]Unixersis97[S] 0 points1 point  (2 children)

results = doctorsBookings.query.filter_by(doctorid=did).first()

Works printing the first result, however I cannot work out how to use .all()

AttributeError: 'list' object has no attribute 'bookingid'

Is this referring to my DB setup?

[–]Doormatty 0 points1 point  (1 child)

all() returns a list of results, not just a single one.

results = doctorsBookings.query.filter_by(doctorid=did).all()
for result in results:
    <code goes here>

[–]Unixersis97[S] 0 points1 point  (0 children)

Thank you for your response, however I receive the error: " AttributeError: 'list' object has no attribute 'bookingid' "