sqlalchemy beginner

Jabba Laci jabba.laci at gmail.com
Mon Nov 21 10:56:59 EST 2011


Hi,

I'm reading the Essential SQLAlchemy book from O'Reilly. It explains
SqlAlch 0.4 but my current version is 0.7 and there are some
differences.

Here is an example from the book:

user_table = Table('tf_user', metadata,
        Column('id', Integer, primary_key=True),
        Column('user_name', Unicode(16), unique=True, nullable=False),
        Column('password', Unicode(40), nullable=False),
        Column('display_name', Unicode(255), default=''),
        Column('created', DateTime, default=datetime.now)
    )

Here I get the following warning:

SAWarning: Unicode column received non-unicode default value.
  Column('display_name', Unicode(255), default=''),

Changing Unicode(255) to String(255) makes the warning disappear but
I'm not sure if it's the correct solution.

For table names, the book uses the prefix convention 'tf_' but what
does it mean? 't' is table, but what is 'f'?

Thanks,

Laszlo



More information about the Python-list mailing list