PyPy (>= 3.6) was consistently erroring out during `pokedex load`,
with the error
OperationalError: (_sqlite3.OperationalError) cannot commit transaction - SQL statements in progress (Background on this error at: http://sqlalche.me/e/e3q8)
It turns out PyPy was not garbage collecting something, causing a
database cursor to be left open. See the giant comment block for
details.
* SQLAlchemy 1.0 introduced "baked queries" - a way to construct Query
objects so that they can be cached and reused.
* SQLAlchemy 1.2 changed lazyloaded columns to use baked queries under the
hood.
* Our MultilangQuery class attempts to set _default_language_id right
before the query is executed by overriding the __iter__ method.
* Baked queries bypass the __iter__ method and call a lower-level
method, _execute_and_instances, directly.
* This caused problems where _default_language_id wouldn't get set
correctly on lazyloaded columns.
* To fix, make MultilangQuery override the _execute_and_instances
method instead of __iter__.
* This is really just a stopgap: the root cause is that query params
are not preserved across lazyloads.
Tested with SQLAlchemy 0.9.7, 1.1.18, and 1.2.5.
Updates #236.
Went though the table docs and noted which tables have ids that correspond
to game ids, and explained why we sometimes have ids in the 10000s.
Since docs attached to id columns aren't displayed in the web documentation,
these edits all go in the class docstring, and i took the liberty of deleting
the id column docs from every table i touched.
Also: added some words about how to get to the species from pokemon and
pokemon_form.
Also: note that item flags are not official (they are a holdover from
brownkun) and item pockets are sort of kind of official (they originated from
D/P i believe, but i'm not sure how we've been assigning them for newer items).
Pertains to #99.
COPY FROM FILE requires database superuser permissions,
because of the obvious security implications.
COPY FROM STDIN has no such restriction.
Also do some cleanup while we're here.
SQLAlchemy 1.0 sets bindpararms to their default values when loading
lazy-loaded columns. This is in contrast to the 0.9 behaviour of
ignoring our incongruous bindparam alltogether.
So MultilangQuery is still broken, but now it breaks in the same way as before.
While we're here, set the correct param in one of the multilang tests. Not that
it matters.
The Column class accepts a 'doc' argument. Use it.
And while we're at it, make them all unicode strings.
Performed by the following sed script:
s/info=dict(description=u\?\("[^"]*"\))/doc=u\1/
s/info=dict(description=u\?\('[^']*'\))/doc=u\1/
s/\(\s*\)info=dict(description=u\?\("[^"]*"\), /\1doc=u\2,\n\1info=dict(/
s/\(\s*\)info=dict(description=u\?\('[^']*'\), /\1doc=u\2,\n\1info=dict(/
/info=dict(description=u\?\('[^']*'\),$/ {
s//doc=u\1,/
n
s/^\s*/&info=dict(/
}
I don't really like this but ehhhhhhh, the system for prose
translations seems to be to keep them in csv/translations/, and I can't
figure out how you're supposed to DO that, plus judging by the age of
the single file that's in there, that seems to be where translations go
to die.
<Zhorken> I'd like to motion (again) that 0 and 1 power both be stored
as null
<Zhorken> and — or * be displayed based on damage class
<Zhorken> which is what determines 0 vs 1 anyway, with the arbitrary
who-fucking-cares exception of Me First
<eevee> the ayes have it
<Zhorken> awesome
<eevee> that's a good idea i don't remember its being motioned the
first time
<Zhorken> I definitely remember arguing it when B/W released
MySQL again. Indexed keys have a maximum length of 767 bytes and unicode
is stored as 3 bytes per character. Since 256*3 = 768, that pushes us
just past the limit. Could lower the length to 255 characters, but let's
go further - currently only names and identifers have a length limit,
and if a name or identifier doesn't fit in a terminal then i don't want
to see it.
Fixes issue #123.
This way it matches /all the other prose tables/. Relatedly, all the
abilities I recently expanded on had short_effect and effect swapped,
so I fixed that too.