def get_mart_db_connection(config: Configuration) -> Engine: conn_string = 'postgresql://{mart_db_user}:{mart_db_password}@{warehouse_host}:{warehouse_port}/{mart_db_name}' conn_string = conn_string.format_map(config.as_dict()) engine = create_engine(conn_string) return engine
def test_as_dict(): data1 = {'key1': 'value1', 'sub_data': {'one': 1, 'two': 2}} cfg = Configuration(data1) assert cfg.as_dict() == data1