def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text( "update workflow set specification = :spec where id = :id") for workflow in connection.execute(fetch_workflows): if not workflow.specification: continue specification = Yaml.unserialize(workflow.specification) if not specification or 'schema' not in specification: continue try: query = specification['schema']['structure']['infoset']['source'][ 'query'] except: continue if query == old_query: specification['schema']['structure']['infoset']['source'][ 'query'] = new_query specification = Yaml.serialize(specification) connection.execute(update_workflows, spec=specification, id=workflow.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text("update workflow set specification = :spec where id = :id") for wf in connection.execute(fetch_workflows): yaml_dict = Yaml.unserialize(wf.specification) if yaml_dict.get('form', IncorrectFormDict) == IncorrectFormDict: yaml_dict['form'] = CorrectedFormDict specification = Yaml.serialize(yaml_dict) connection.execute(update_workflows, spec=specification, id=wf.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text( "update workflow set specification = :spec where id = :id") for wf in connection.execute(fetch_workflows): yaml_dict = Yaml.unserialize(wf.specification) if yaml_dict.get('form', IncorrectFormDict) == IncorrectFormDict: yaml_dict['form'] = CorrectedFormDict specification = Yaml.serialize(yaml_dict) connection.execute(update_workflows, spec=specification, id=wf.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text("update workflow set specification = :spec where id = :id") for wf in connection.execute(fetch_workflows): try: Workflow._verify_specification(wf.specification) except Exception, e: continue #dont modify invalid workflows yaml_dict = Yaml.unserialize(wf.specification) if not(yaml_dict.get('form')): yaml_dict['form'] = FormDict specification = Yaml.serialize(yaml_dict) connection.execute(update_workflows, spec=specification, id=wf.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text( "update workflow set specification = :spec where id = :id") for wf in connection.execute(fetch_workflows): try: Workflow._verify_specification(wf.specification) except Exception, e: continue #dont modify invalid workflows yaml_dict = Yaml.unserialize(wf.specification) if not (yaml_dict.get('form')): yaml_dict['form'] = FormDict specification = Yaml.serialize(yaml_dict) connection.execute(update_workflows, spec=specification, id=wf.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text("update workflow set specification = :spec where id = :id") for workflow in connection.execute(fetch_workflows): if not workflow.specification: continue specification = Yaml.unserialize(workflow.specification) if not specification or 'form' not in specification: continue form = specification.pop('form') if 'schema' in form: specification['schema'] = form['schema'] if 'layout' in form: specification['layout'] = form['layout'] specification = Yaml.serialize(specification) connection.execute(update_workflows, spec=specification, id=workflow.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text("update workflow set specification = :spec where id = :id") for workflow in connection.execute(fetch_workflows): if not workflow.specification: continue specification = Yaml.unserialize(workflow.specification) if not specification or 'schema' not in specification: continue try: query = specification['schema']['structure']['infoset']['source']['query'] except: continue if query == old_query: specification['schema']['structure']['infoset']['source']['query'] = new_query specification = Yaml.serialize(specification) connection.execute(update_workflows, spec=specification, id=workflow.id)