def create_or_update_presto_schema_fields_for_mongo(topic: Topic): if topic.type == RAW: log.info("raw topic ignore presto update") else: topic_name = build_collection_name(topic.name) presto_schema = find_one({"table": topic_name}, Schema, "_schema") new_schema = { "table": topic_name, "fields": __build_presto_fields(topic.factors) } if presto_schema is None: insert_one(new_schema, Schema, "_schema") else: delete_one({"table": topic_name}, "_schema") insert_one(new_schema, Schema, "_schema")
def delete_report_by_id(report_id): # template.delete_one(CONSOLE_REPORTS, {"reportId": report_id}) delete_one(report_id, CONSOLE_REPORTS)
def delete_console_space_storage(connect_id: str): # template.delete_one("console_spaces", {"connectId": connect_id}) delete_one(connect_id, "console_spaces")
def remove_presto_schema_by_name(topic_name): try: delete_one({"table": build_collection_name(topic_name)}, "_schema") except Exception as e: log.exception(e)
def delete_console_subject_by_id(subject_id): # return template.delete_one(CONSOLE_SPACE_SUBJECTS, {"subjectId": subject_id}) delete_one(subject_id, CONSOLE_SPACE_SUBJECTS)
def delete_dashboard_by_id(dashboard_id): # return template.delete_one(DASHBOARDS, {DASHBOARD_ID: dashboard_id}) delete_one(dashboard_id, DASHBOARDS)
def delete_console_subject_by_id(subject_id): delete_one(subject_id, CONSOLE_SPACE_SUBJECTS)