db uri var

This commit is contained in:
Jan-Philipp Warmers 2014-04-18 18:42:17 +02:00
parent a4c235fcb2
commit 23f00d5299
1 changed files with 9 additions and 8 deletions

View File

@ -6,6 +6,11 @@ import curses
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey, create_engine
from sqlalchemy.sql import select
# Config foo
db_uri = 'sqlite:///./db.sqlite'
#produkte = Table('produkte', metadata,
# Column('barcode', Integer, primary_key=True),
# Column('name', String(40)),
@ -13,7 +18,7 @@ from sqlalchemy.sql import select
def create_db():
db = create_engine('sqlite:///./db.sqlite')
db = create_engine(db_uri)
metadata = MetaData()
produkte = Table('produkte', metadata,
Column('barcode', Integer, primary_key=True),
@ -38,8 +43,9 @@ def create_db():
db.execute(u, barcode='23', name='proGamler')
def return_price(produkt):
db = create_engine('sqlite:///./db.sqlite')
db = create_engine(db_uri)
metadata = MetaData(db)
metadata.reflect()
@ -58,7 +64,7 @@ def isproduct(code):
return False
def user(code):
db = create_engine('sqlite:///./db.sqlite')
db = create_engine(db_uri)
metadata = MetaData(db)
metadata.reflect()
@ -122,10 +128,5 @@ while x != int('01'):
else:
x = 0
curses.endwin()