Subversion Repositories SmartDukaan

Rev

Rev 18769 | Rev 19421 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18769 Rev 19235
Line 16... Line 16...
16
 
16
 
17
#===============================================================================
17
#===============================================================================
18
# Different entities in the model
18
# Different entities in the model
19
#===============================================================================
19
#===============================================================================
20
 
20
 
21
def initialize(dbname='transaction', db_hostname="localhost", echoOn=True):
21
def initialize(dbname='transaction', db_hostname="localhost", echoOn=True, setup=True):
22
    #metadata.bind = "sqlite:///Transactionsnew.sqlite"
22
    #metadata.bind = "sqlite:///Transactionsnew.sqlite"
23
    #metadata.bind = 'mysql://root:shop2020@localhost/transaction'
23
    #metadata.bind = 'mysql://root:shop2020@localhost/transaction'
24
    engine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
24
    engine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
25
    metadata.bind = engine
25
    metadata.bind = engine
26
    metadata.bind.echo = echoOn
26
    metadata.bind.echo = echoOn
27
    setup_all(True)
27
    setup_all(setup)
28
 
28
 
29
 
29
 
30
if __name__=="__main__":
30
if __name__=="__main__":
31
    initialize()
31
    initialize()
32
 
32