veekun_pokedex/pokedex
Andrew Ekstedt 98696cdd69 Fix pokedex search command
Filtering on pokemon name was broken. Not sure why, since the search CLI
was added way after the i18n stuff was added. The error is related to
AssociationProxy, which figures because nothing about association
proxies ever seems to work right. I don't know enough about SQLAlchemy
internals to know if what it was trying to do was supposed to
work, or how to fix it if so. So, fix it by using the same boring
join-based filtering that spline-pokedex uses.

Running `pokedex search --name=gloom` caused the following error with
PostgreSQL and SQLAlchemy 1.3.5:

    sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) can't adapt type 'ColumnAssociationProxyInstance'

...and this error with SQLite.

    sqlalchemy.exc.InterfaceError: (sqlite3.InterfaceError) Error binding parameter 4 - probably unsupported type.
    [parameters: (9, 9, 9, 9, ColumnAssociationProxyInstance(AssociationProxy('names_local', 'name')), 'gloom')]

Additionaly, the following error would happen with PostgreSQL and SQLAlchemy 0.9.7,
but that's probably unrelated:

    sqlalchemy.exc.ProgrammingError: (ProgrammingError) subquery in FROM must have an alias
    LINE 4: FROM pokemon_species, (SELECT pokemon_species_names.name AS ...
                                   ^

Fixes #296
2020-04-17 16:42:47 -07:00
..
cli Stub out a CLI search interface, which can also work with JSON and strings 2016-02-02 10:13:38 -08:00
data/csv Load/dump dance 2020-03-04 16:19:29 -08:00
db Fix Roserade's Central Kalos dex number and add tests 2019-07-16 18:12:58 -07:00
doc Addressed all of pyflakes3's complaints 2016-11-24 21:29:58 +00:00
struct Unbreak SaveFilePokemon slightly 2018-06-26 23:53:59 -07:00
tests Fix Roserade's Central Kalos dex number and add tests 2019-07-16 18:12:58 -07:00
util Addressed all of pyflakes3's complaints 2016-11-24 21:29:58 +00:00
__init__.py Speed up import pokedex.db slightly. 2011-04-03 03:13:07 -07:00
__main__.py Make the library work with python -m. 2013-08-09 13:00:37 -07:00
compatibility.py Addressed all of pyflakes3's complaints 2016-11-24 21:29:58 +00:00
defaults.py Speed up import pokedex.db slightly. 2011-04-03 03:13:07 -07:00
formulae.py Addressed all of pyflakes3's complaints 2016-11-24 21:29:58 +00:00
lookup.py Fix references to "ja" (which is now ja-Hrkt) 2017-06-18 00:15:05 -07:00
main.py Fix error when no arguments are specified (#240) 2018-08-22 23:34:27 -07:00
roomaji.py Compat with Python 3.3+ 2015-10-05 08:12:23 -07:00
search.py Fix pokedex search command 2020-04-17 16:42:47 -07:00