def load_definitions(sess, force_tas_load, ruleList=None): """Load file definitions.""" validator_config_path = os.path.join(CONFIG_BROKER["path"], "dataactvalidator", "config") integration_test_data_path = os.path.join(CONFIG_BROKER["path"], "tests", "integration", "data") SchemaLoader.loadAllFromPath(validator_config_path) SQLLoader.loadSql("sqlRules.csv") if ruleList is not None: # If rule list provided, drop all other rules sess.query(RuleSql).filter(not_( RuleSql.rule_label.in_(ruleList))).delete( synchronize_session='fetch') sess.commit() # Load domain values tables loadDomainValues( validator_config_path, os.path.join(integration_test_data_path, "program_activity.csv")) if sess.query(TASLookup).count() == 0 or force_tas_load: # TAS table is empty, load it loadTas(tasFile=os.path.join(integration_test_data_path, "cars_tas.csv")) # Load test SF-133 load_all_sf133(integration_test_data_path)
def load_sql_rules(): """Load the SQL-based validation rules.""" logger.info('Loading SQL-based validation rules') SQLLoader.loadSql("sqlRules.csv")