PokeAPI / pokedex

PokeAPI's fork for adding gen-8 data.
https://github.com/PokeAPI/pokedex/tree/master-pokeapi/pokeapi
MIT License
43 stars 40 forks source link

Fix failing to bind default_language_id #116

Closed giginet closed 2 years ago

giginet commented 2 years ago

On the current master, pokedex setup failed due to the following errors.

    raise exc.InvalidRequestError(
sqlalchemy.exc.StatementError: (sqlalchemy.exc.InvalidRequestError) A value is required for bind parameter '_default_language_id'
[SQL: SELECT abilities.id AS abilities_id, abilities.identifier AS abilities_identifier, abilities.generation_id AS abilities_generation_id, abilities.is_main_series AS abilities_is_main_series, ability_names_1.ability_id AS ability_names_1_ability_id, ability_names_1.local_language_id AS ability_names_1_local_language_id, ability_names_1.name AS ability_names_1_name
FROM abilities LEFT OUTER JOIN ability_names AS ability_names_1 ON ability_names_1.ability_id = abilities.id AND ability_names_1.local_language_id = ? ORDER BY abilities.id]
[parameters: [{}]]
(Background on this error at: https://sqlalche.me/e/14/cd3x)

On the latest SQLAlchemy, Query._execute_and_instances isn't supported. According to the documentation, use do_execute_orm instead. https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_4_39/lib/sqlalchemy/orm/events.py#L1421

So I migrated new API and pin SQLAlchemy version to 1.4.x.

This PR fixes the error when executing pokedex setup.

giginet commented 2 years ago

This change is the same as this PR for the original repo. https://github.com/veekun/pokedex/pull/361

So if this PR is merged. they will be conflicted.