Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.

Conversation

@giginet
Copy link

@giginet giginet commented Jul 21, 2022

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.

return Translations

class MultilangQuery(Query):
def _execute_and_instances(self, *args, **kwargs):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is private. So it should not be overridden.

@giginet giginet mentioned this pull request Jul 21, 2022
@Naramsim Naramsim merged commit f9e4a16 into PokeAPI:master-pokeapi Jul 22, 2022
@giginet
Copy link
Author

giginet commented Jul 22, 2022

This change is the same as this PR for the original repo.
veekun#361

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

@giginet giginet deleted the fix-local-language-id branch July 22, 2022 12:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants