Subversion Repositories SmartDukaan

Rev

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

Rev 3044 Rev 3187
Line 96... Line 96...
96
    date = Field(Date, primary_key=True)
96
    date = Field(Date, primary_key=True)
97
    occasion = Field(String(100))
97
    occasion = Field(String(100))
98
    using_options(shortnames=True)
98
    using_options(shortnames=True)
99
    using_table_options(mysql_engine="InnoDB")
99
    using_table_options(mysql_engine="InnoDB")
100
   
100
   
101
def initialize(dbname="logistics"):
101
def initialize(dbname="logistics",db_hostname="localhost"):
102
    #metadata.bind = "sqlite:///logistics.sqlite" #need to read it from configserver.
102
    #metadata.bind = "sqlite:///logistics.sqlite" #need to read it from configserver.
103
    engine = create_engine('mysql://root:shop2020@localhost/' + dbname, pool_recycle=7200)
103
    engine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
104
    metadata.bind = engine
104
    metadata.bind = engine
105
    metadata.bind.echo = True
105
    metadata.bind.echo = True
106
    setup_all(True)
106
    setup_all(True)
107
 
107
 
108
if __name__=="__main__":
108
if __name__=="__main__":