#NEWLINE# def from_config( configname = None ) : #NEWLINE# #INDENT# 'Connect to a database based upon its `nickname`.\n\n    See ipydb.magic.connect() for details.\n    ' #NEWLINE# ( default , configs ) = getconfigs ( ) #NEWLINE# if ( not configname ) : #NEWLINE# #INDENT# raise ValueError ( 'Configname is required' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( configname not in configs ) : #NEWLINE# #INDENT# raise ValueError ( ( 'Config name not found. Try one of {%s}' % get_nicknames ( ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# config = configs [ configname ] #NEWLINE# connect_args = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# engine = from_url ( make_connection_url ( config ) , connect_args = connect_args ) #NEWLINE# #UNINDENT# #UNINDENT# return engine