invoke-ai / InvokeAI

InvokeAI is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, supports terminal use through a CLI, and serves as the foundation for multiple commercial products.
https://invoke-ai.github.io/InvokeAI/
Apache License 2.0
23.07k stars 2.39k forks source link

fix(app): fix SQL query w/ enum for python 3.11 #6557

Closed psychedelicious closed 3 months ago

psychedelicious commented 3 months ago

Summary

Python 3.11 has a wonderfully devious breaking change where sometimes using enum classes that inherit from str or int do not work the same way as they do in 3.10 when used within string formatting/interpolation.

This breaks the new gallery sort queries. The fix is to use order_dir.value instead of order_dir in the query.

This was not an issue during development because the feature was developed w/ python 3.10.

Related Issues / Discussions

Thanks to @JPPhoto for reporting and troubleshooting: https://discord.com/channels/1020123559063990373/1149513625321603162/1256211815982039173

QA Instructions

JP's fancy python 3.11 system should work on this PR.

Merge Plan

n/a

Checklist

JPPhoto commented 3 months ago

LGTM!