Create function for schema creation
* addresses #1 git-svn-id: file:///var/www/wwwusers/usr01/svn/pyalchemybiz/trunk@4 389c73d4-bf09-4d3d-a15e-f94a37d0667a
This commit is contained in:
parent
2378b72add
commit
38d4c952cf
1 changed files with 20 additions and 0 deletions
20
pyalchemybiz/productdb.py
Normal file
20
pyalchemybiz/productdb.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Package pyalchemybiz
|
||||||
|
#
|
||||||
|
# Author: Jan Dittberner <jan@dittberner.info>
|
||||||
|
# Version: $Id$
|
||||||
|
#
|
||||||
|
# This file is part of pyalchemybiz
|
||||||
|
from sqlalchemy import *
|
||||||
|
|
||||||
|
def create_schema(metadata):
|
||||||
|
"""Create the database schema for products."""
|
||||||
|
product_table = Table(
|
||||||
|
'product', metadata,
|
||||||
|
Column('product_id', Integer, primary_key=True),
|
||||||
|
Column('name', String(100), nullable=False),
|
||||||
|
Column('description', String(4096), nullable=False),
|
||||||
|
Column('product_type', Integer, nullable=False)
|
||||||
|
)
|
||||||
|
product_table.create()
|
Loading…
Reference in a new issue