Subversion Repositories SmartDukaan

Rev

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

Rev 14769 Rev 14826
Line 62... Line 62...
62
    category_id = Field(Integer)
62
    category_id = Field(Integer)
63
    using_options(shortnames=True)
63
    using_options(shortnames=True)
64
    using_table_options(mysql_engine="InnoDB")
64
    using_table_options(mysql_engine="InnoDB")
65
 
65
 
66
 
66
 
67
def initialize(dbname='dtr', db_hostname="localhost"):
67
def initialize(dbname='dtr', db_hostname="localhost", echo=True):
68
    #metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
68
    #metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
69
    #metadata.bind = 'mysql://root:shop2020@localhost/catalog'
69
    #metadata.bind = 'mysql://root:shop2020@localhost/catalog'
70
    cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
70
    cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
71
    metadata.bind = cengine
71
    metadata.bind = cengine
72
    metadata.bind.echo = True
72
    metadata.bind.echo = echo
73
    setup_all(True)
73
    setup_all(True)
74
 
74
 
75
if __name__=="__main__":
75
if __name__=="__main__":
76
    initialize()
76
    initialize()