#NEWLINE# @ access . user #NEWLINE# def createPostgresSource( self , params ) : #NEWLINE# #INDENT# name = params [ 'name' ] #NEWLINE# baseURL = params [ 'baseURL' ] #NEWLINE# parsedUrl = getUrlParts ( baseURL ) #NEWLINE# hostName = parsedUrl . netloc #NEWLINE# dbname = params [ 'dbname' ] #NEWLINE# username = ( params [ 'username' ] if ( 'username' in params ) else None ) #NEWLINE# password = ( params [ 'password' ] if ( 'password' in params ) else None ) #NEWLINE# minerva_metadata = { #NEWLINE# #INDENT# 'source_type' : 'postgres' , #NEWLINE# 'postgres_params' : { #NEWLINE# #INDENT# 'dbname' : dbname , #NEWLINE# 'base_url' : baseURL , #NEWLINE# 'host_name' : hostName , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# if ( username and password ) : #NEWLINE# #INDENT# enc_creds = encryptCredentials ( '{}:{}' . format ( username , password ) ) #NEWLINE# minerva_metadata [ 'postgres_params' ] [ 'credentials' ] = enc_creds #NEWLINE# #UNINDENT# desc = ( 'postgres source for  %s' % name ) #NEWLINE# return self . createSource ( name , minerva_metadata , desc )