ORM tutorial lacks imports

Issue #1286 resolved
Former user created an issue

I tried to run the example code from the ORM tutorial, to be precise it was the code from

http://www.sqlalchemy.org/docs/05/ormtutorial.html#creating-table-class-and-mapper-all-at-once-declaratively

This failed saying "NameError: name 'Column' is not defined". I could run the example after doing

from sqlalchemy import Column, Integer, String

My system is an openSuse 11.1 with python 2.6 and sqlalchemy 0.5.1.

Comments (1)

  1. Mike Bayer repo owner

    each code sample in the tutorial builds upon the program state built up by the previous one. in this case the import for Column etc. is here:

    http://www.sqlalchemy.org/docs/05/ormtutorial.html#define-and-create-a-table

    the file can be executed fully via the doctest script in doc/build/testdocs.py.

    while we could do the easy thing and say "from sqlalchemy import *" or have everything run off of "import sqlalchemy as sa", there hasn't been any push in that direction.

  2. Log in to comment