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

Convert raw SQL to ORM #1

Closed
raphattack opened this issue Oct 7, 2019 · 5 comments
Closed

Convert raw SQL to ORM #1

raphattack opened this issue Oct 7, 2019 · 5 comments

Comments

@raphattack
Copy link
Owner

The following queries need to be converted to the ORM equivalent:

@shaibruhis
Copy link

Do you have an ORM already being used for other queries? If not do you have a preference on which ORM is used?

@raphattack
Copy link
Owner Author

SQLAlchemy is already being used. These three queries are the only ones remaining that needs to be converted.

@smfarrelly
Copy link
Contributor

FYI If you're looking to support non postgres dbs I think the insert will need to be refactored to not rely on the postgresql dialect as well.

https://github.com/raphattack/espn-ffb/blob/master/espn_ffb/db/query.py#L9

@smfarrelly
Copy link
Contributor

get_h2h_standings could probably be left as raw sql as I don't see anything there that's database specific. For the others the :: Cast operator is postgres specific I believe, but that could be updated to CAST() which should work more broadly.

smfarrelly added a commit to smfarrelly/espn-ffb that referenced this issue Sep 15, 2020
in order to support more database options.

Related issue: raphattack#1
smfarrelly added a commit to smfarrelly/espn-ffb that referenced this issue Sep 16, 2020
in order to support more database options.

Related issue: raphattack#1

Also:
- Include ties in denominator when calculating
win percentage, average points for, and average points against
- Removes get_standings_overall in favor of get_standings
now accepting an optional year kwarg that defaults to None.
When no year/ None is provided all years are included.
@raphattack
Copy link
Owner Author

Really appreciate the help @smfarrelly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants