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.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),
|
||||
|
@ -36,10 +41,11 @@ def create_db():
|
|||
|
||||
u = users.insert()
|
||||
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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue