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