コード例 #1
0
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())
コード例 #2
0
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())
コード例 #3
0
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())
コード例 #4
0
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())