Computing win/loss records in Python

Ben Finney ben+python at benfinney.id.au
Sun Aug 26 00:33:16 EDT 2012


Christopher McComas <mccomas.chris at gmail.com> writes:

> I have code that I run via Django that grabs the results from various
> sports from formatted text files. The script iterates over every line
> in the formatted text files, finds the team in the Postgres database
> updates their w/l record depending on the outcome on that line, saves
> the team's row in the db, and then moves on to the next line in the
> file.

It seems that you already have a PostgreSQL database storing this data.

> I'm trying to get away from Django for this project

That existing database can be accessed without Django. You could talk
directly using the ‘psycopg2’ library, but you don't have to go that
far.

I would recommend you use SQLAlchemy as a good and flexible way to
access existing databases (or make new ones) in a Pythonic manner
<URL:http://www.sqlalchemy.org/>. If you are using a free-software
operating system, you will likely already have packages available to
install SQLAlchemy from your operating system's package repositories.

-- 
 \         “True greatness is measured by how much freedom you give to |
  `\      others, not by how much you can coerce others to do what you |
_o__)                                               want.” —Larry Wall |
Ben Finney



More information about the Python-list mailing list