:param attrib_od_fields: Dictionary with generic attribute name, resource name to be added, and Open Data name. :return """ # Create new array with attribute and resource fields attrib_res_fields = {} for key in attrib_od_fields.keys(): new_key = key + "_" + resource attrib_res_fields[new_key] = attrib_od_fields[key] handle_attributes(source, target, action, attrib_res_fields) return # Initialize Environment projectname = "mowdr" modulename = my_env.get_modulename(__file__) config = my_env.get_inifile(projectname) my_env.init_logfile(config, modulename) ds = Datastore(config) logging.info('\n\n\nStart Application') # all_attribs = ds.get_all_attribs() logging.info("Handle Main Attributes on Dataset") populate_attribs_main() logging.info("Handle Extra Attributes on Dataset") populate_attribs_extra() logging.info("Handle Main Attributes that are populated from ckan") populate_attribs_main_ckan() resources = my_env.get_resource_types() resource_files = my_env.get_resource_type_file() for resource_name in resources: logging.info("Handle Resource Attributes for resource %s", resource_name) populate_attribs_resource(resource_name)
#!/opt/csw/bin/python3 """ This script will find Cognos Redirect files from scan directory, put them on FTP Repository and move them to the handle directory. The Evaluate_Cognos script will run on Vo network without proxy while moving to FTP Repository needs the proxy settings. """ import logging import os from Ftp_Handler import Ftp_Handler from lib import my_env # Initialize Environment projectname = "mowdr" modulename = my_env.get_modulename(__file__) config = my_env.get_inifile(projectname, __file__) my_log = my_env.init_loghandler(config, modulename) my_log.info('Start Application') ftp = Ftp_Handler(config) scandir = config['Main']['scandir'] handledir = config['Main']['handledir'] pc_prefix = config['OpenData']['public_cognos_prefix'] filelist = [file for file in os.listdir(scandir) if pc_prefix in file] for file in filelist: redirect_file = os.path.join(scandir, file) logging.info("File {f} to FTP Repository.".format(f=file)) ftp.load_file(redirect_file) logging.info("Move file {f} from {i} to {o}".format(f=file, i=scandir,
for user in ul: rowdict = {} for col in cols: if col in user: if col in ["created"]: rowdict[col] = dateutil.parser.parse(user[col]).strftime("%d/%m/%Y %H:%M:%S") elif user[col]: rowdict[col] = user[col] dbConn.insert_row('user_data', rowdict) return if __name__ == "__main__": # Get ini-file first. projectname = 'openvl' modulename = my_env.get_modulename(__file__) config = my_env.get_inifile(projectname, __file__) # Now configure logfile my_env.init_loghandler(config, modulename) logging.info('Start Application') logdir = config['Main']['logdir'] dbConn = DataStore(config) # Reset Table dbConn.remove_table_user_data() dbConn.create_table_user_data() columns = dbConn.get_columns('user_data') ckan_conn = get_ckan_conn() ul = user_list() handle_ul(ul, columns) logging.info('End Application')