0

I have this table in my database (using Posgresql and Sqlalchemy) called "participants". In my models.py I want to access the participant's records. Since participants is not in my models.py and resides as a table in my db, when I do query = db.session.query('participants').order_by('name').all() I get an error:

ProgrammingError: (ProgrammingError) column "participants" does not exist
LINE 1: SELECT participants ORDER BY name
           ^

What can I do to retrieve this information?

user2899444
  • 313
  • 1
  • 3
  • 15

1 Answers1

0

Like the comment on the original post, did something like:

query = db.engine.execute('select * from participants order by name') This doesn't give it in the same format as the query so I could use it for what I needed (a dictionary output, and a format for web), so I did:

partner_list = []
for record in query:
    record_dict = dict(record)
    partner_list.append(record_dict)
user2899444
  • 313
  • 1
  • 3
  • 15