#๐Ÿ”’ How to access value of column of a table in a relationship SQL Alchemy

4 messages ยท Page 1 of 1 (latest)

cursive mirage
#

Hello! I'm creating an app for a school project using Flask and SQL Alchemy, both of which I've never used before, so I apologize if this is has a very obvious answer, though I have searched for one with little success.

The goal for the application is to track the scores of students in teams across a variety of sports. These scores will then be summed to determine a winning team. I've set up tables for students and events, to allow for new students / events to be created. However, I don't know how to properly utilize these relationships and access columns from related tables.

I.e. Bob participates in long jump and scores 4 points. How would I save this to the results table? And then how would I access it with the event ID for long jump or Bob's student ID later? Or in the case of the point totals, how would I find all of the students in the blue team and add their scores from the results table?

Since I've set up a relationship between the tables is there a 'proper' way to access them 'from each other' if that makes sense?

Sorry for the word-wall, any help would be much appreciated!

https://paste.pythondiscord.com/AQJA

harsh meteorBOT
#

@cursive mirage

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

harsh meteorBOT
#

@cursive mirage

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.