db_config

class dbbase.utils.db_config[source]

This function combines config variables with a base string.

It is a convenience function for combining data elements to make a string that represents a database URI.

Default:

db_config(base, config_vars=None)

Parameters
  • base – (str) : a string that is the db template, such as “postgresql://{user}:{pass}@{host}:{port}/{dbname}”

  • config_vars – (dict) : variables that will be combined with the base.

  • example (For) – ‘user’: ‘auser’, ‘pass’: ‘123’, ‘host’: ‘localhost’, ‘port’: 5432, ‘dbname’: ‘mydatadb’

config_vars can also be a string that successfully converts from JSON to a dict.

This enables a config to be as simplistic or complex as the situation warrants.

Returns

completed_URI (str) – the database URI