from sqlor.dbpools import DBPools async def main(): dbname = get_module_dbname('pipeline_core') async with DBPools().sqlorContext(dbname) as sor: recs = await sor.R('pipelines', {'status': 'published'}) if not recs: recs = await sor.R('pipelines', {}) result = [] for r in recs: result.append({'id': r.id, 'name': r.name, 'text': r.name, 'value': r.id}) return result