Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return MySQL data as dictionaries to avoid confusion #18

Open
vilhelmprytz opened this issue Dec 11, 2019 · 1 comment
Open

Return MySQL data as dictionaries to avoid confusion #18

vilhelmprytz opened this issue Dec 11, 2019 · 1 comment
Labels
enhancement New feature or request not prioritize Not to prioritize

Comments

@vilhelmprytz
Copy link
Member

Queries in the current setup returns lists, which can make it confusing concerning which key is which. Using dictionaries, we can avoid confusion during coding (refactoring, doesn't necessarily change anything for the end user).

Right now, querying for the class of a student looks like this.

result = sql_query("SELECT * FROM students WHERE id=0")

print(result[0][4])

The first [0] is the element of the "search query" (which in this case should only consist of one element, as the id should always be unique) and the second [4] refers to the fourth column, which in this case is the class of the student row.

See this StackOverflow question for more information on how to do this.

@fredrikberzins fredrikberzins added the wontfix This will not be worked on label Dec 11, 2019
@vilhelmprytz
Copy link
Member Author

Too much of main codebase is based on using tuples. We've decided to not fix this until we're finished with a "stable" initial release.

@vilhelmprytz vilhelmprytz self-assigned this Dec 11, 2019
vilhelmprytz added a commit that referenced this issue Dec 18, 2019
@vilhelmprytz vilhelmprytz added enhancement New feature or request not prioritize Not to prioritize and removed wontfix This will not be worked on labels Jan 8, 2020
@vilhelmprytz vilhelmprytz removed their assignment Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request not prioritize Not to prioritize
Projects
None yet
Development

No branches or pull requests

2 participants