From 38d4c952cf614bc90a6b3a5179e76621726406e5 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Wed, 31 Oct 2007 21:26:40 +0000 Subject: [PATCH] Create function for schema creation * addresses #1 git-svn-id: file:///var/www/wwwusers/usr01/svn/pyalchemybiz/trunk@4 389c73d4-bf09-4d3d-a15e-f94a37d0667a --- pyalchemybiz/productdb.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 pyalchemybiz/productdb.py diff --git a/pyalchemybiz/productdb.py b/pyalchemybiz/productdb.py new file mode 100644 index 0000000..50d5016 --- /dev/null +++ b/pyalchemybiz/productdb.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# +# Package pyalchemybiz +# +# Author: Jan Dittberner +# 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()