from jinja2 import Environment, BaseLoader


if __name__ == "__main__":
    env = Environment(loader=BaseLoader())
    template = env.from_string("{{ codes|map(attribute='name')|join(';') }}")
    print(template.render(codes=[{"name": "A", "id": 1}, {"name": "B"}, {"name": "C"}]))
