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

predicted_points ArrayImpl incompatible with postgresql #622

Open
Tdarnell opened this issue Aug 14, 2023 · 1 comment
Open

predicted_points ArrayImpl incompatible with postgresql #622

Tdarnell opened this issue Aug 14, 2023 · 1 comment

Comments

@Tdarnell
Copy link
Contributor

The calc_predicted_points_for_player returned predicted_points is of type either None, float or jaxlib ArrayImpl.

The jaxlib ArrayImpl is incompatible with postgresql SQLAlchemy, and results in an error when trying to commit the predictions.

One option to fix this is:

for p in predictions:
        # check if db uri contains postgresql
        if "postgresql" in dbsession.bind.url.drivername:
            # check if the predicted_points is a float or jaxlib ArrayImpl
            if hasattr(p.predicted_points, "shape"):
                p.predicted_points = p.predicted_points.tolist()
        dbsession.add(p)
Tdarnell added a commit to Tdarnell/AIrsenal that referenced this issue Aug 14, 2023
@jack89roberts
Copy link
Contributor

jack89roberts commented Aug 14, 2023

If this is the case it's a bug that should be fixed elsewhere in calc_predicted_points_for_player, as PlayerPrediction.predicted_points should always be a non-null float value per the database schema (airsenal.framework.schema.PlayerPrediction), i.e. calc_predicted_points_for_player should always return a list of valid PlayerPrediction instances compatible with the DB schema.

From a very quick look I struggled to identify when/where the points could end up being a jax array, though. It might be another unintended consequence of us updating package versions recently.

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

2 participants