-
Notifications
You must be signed in to change notification settings - Fork 635
Getting Data
If you're like most people, you just want to get a hold of the data for your own nefarious purposes. Lucky for you, I have made this as simple as I can imagine. As long as you know your way around a terminal, anyway. You do, right?
For more exhaustive documentation on using the pokedex
program, see CLI.
Install Git, Python 3, and the Virtualenv library for Python.
On Debian or Ubuntu, that would be sudo apt-get install git python python-virtualenv
.
On Windows, get Git and Python.
You have two options here.
You can use Git, like I do, if you're familiar with source control:
git clone git://github.com/veekun/pokedex.git
Or you can just go to Releases on Github and download an archive, or download the latest development version.
You have to do this for two reasons: (a) to make sure you have all the right libraries installed, and (b) to create the pokedex
program, which actually loads the data into a database for you.
You can do this...
python setup.py develop
(Windows users will want to use the full path, e.g. C:\Python39\python
instead of just python
.)
You might have to invoke sudo
if you're on a good platform, because this will install necessary libraries to your system Python directory.
If you'd rather not the quick way (good for you!), you should instead use:
- Get virtualenv. It's in most repositories as
python-virtualenv
, or you can usepip install virtualenv
, or get it manually if you must. - Create a virtualenv for the pokedex project by running
virtualenv ./
inside the topmostpokedex
directory. This will set up a little Python environment inside it. - Run
bin/python setup.py develop
. (Or, on Windows, useScripts/python setup.py develop
.) Make sure you run thebin/python
inside your virtualenv. This will install libraries and thepokedex
program only inside the virtualenv and will not touch your system Python. Note that thepokedex
program will then end up inside that samebin/
(orScripts/
) directory, so you'll have to usebin/pokedex
(orScripts/pokedex
) in step 4.
A lot of people come ask for help, only to realize they sort of forgot this bit. Here's a quick checklist:
- Be sure you know which database engine you're using!
- Be sure you've actually created the database!
- Be sure you have Python support for it installed! Out of the box, Python ONLY supports SQLite! For PostgreSQL, you'll need
psycopg2-binary
; for MySQL, you'll needpymysql
.
If you don't care, you can use the default SQLite, but this won't work if you used sudo
before.
For the default SQLite, just do:
pokedex load
(Windows users will use C:\Python39\Scripts\pokedex.exe
or similar instead of pokedex
.)
For different databases, do this:
pokedex load -e postgresql://username:password@localhost/database
pokedex load -e mssql+pyodbc://.\SQLEXPRESS/database?driver=SQL+Server+Native+Client+11.0
pokedex load -e mysql+pymysql://username:password@localhost/database
Or, you know, something like that. This will churn away for a while (a pretty long while, actually). Then, do:
pokedex reindex
When it's done, you should have a database full of data. Congrats!
For more stuff you can do with the pokedex program, and better instructions on how to use load
, see the pokedex documentation (pokedex -h
).