Using pokedex

The pokédex is, first and foremost, a Python library. To get the most of it, you’ll need to learn `Python`_ and `SQLAlchemy`_.

Here is a small example of using pokedex:

from pokedex.db import connect, tables, util
session = connect()
pokemon = util.get(session, tables.PokemonSpecies, 'bulbasaur')
print u'{0.name}, the {0.genus} Pokemon'.format(pokemon)

Running this will give you some Bulbasaur info:

Bulbasaur, the Seed Pokemon

Connecting

To get information out of the Pokédex, you will need to create a Session. To do that, use pokedex.db.connect(). For simple uses, you don’t need to give it any arguments: it the database that pokedex load fills up by default. If you need to select another database, give its URI as the first argument.

The object connect() gives you is actually a sqlalchemy.orm.session.Session, giving you the full power of SQLAlchemy for working with the data. We’ll cover some basics here, but if you intend to do some serious work, do read SQLAlchemy’s docs.

XXX: write the rest of this

Table Of Contents

Previous topic

Installing the pokedex library

Next topic

The database schema

This Page