MCPcopy Index your code
hub / github.com/webpy/webpy / database

Function database

web/db.py:1452–1468  ·  view source on GitHub ↗

Creates appropriate database using params. Pooling will be enabled if DBUtils module is available. Pooling can be disabled by passing pooling=False in params.

(dburl=None, **params)

Source from the content-addressed store, hash-verified

1450
1451
1452def database(dburl=None, **params):
1453 """Creates appropriate database using params.
1454
1455 Pooling will be enabled if DBUtils module is available.
1456 Pooling can be disabled by passing pooling=False in params.
1457 """
1458 if not dburl and not params:
1459 dburl = os.environ["DATABASE_URL"]
1460
1461 if dburl:
1462 params = dburl2dict(dburl)
1463
1464 dbn = params.pop("dbn")
1465 if dbn in _databases:
1466 return _databases[dbn](**params)
1467 else:
1468 raise UnknownDB(dbn)
1469
1470
1471def register_database(name, clazz):

Callers

nothing calls this directly

Calls 3

dburl2dictFunction · 0.85
UnknownDBClass · 0.85
popMethod · 0.80

Tested by

no test coverage detected