def demoLoadFromFile(): """Demonstrate loading database connection config from config file. This method can be used to change default connection at runtime, but only before instantiating a DbObject. """ config = BaseCatalogConfig() configFilename = os.path.join(getPackageDir("sims_catUtils"), "config", "db.py") config.load(configFilename) starDB = StarObj(**config.toDict())
def demoGlobalConfig(): """Demonstrate changing database connection in script. This method can be used to change default connections at runtime, but only before instantiating a DbObject """ CONFIG = BaseCatalogConfig(driver='mssql+pymssql', port='51433', host='localhost', database='LSSTCATSIM') #Can pass to the constructor starDB = StarObj(**CONFIG.toDict())