topic stat via queries

This commit is contained in:
Igor Lobanov
2022-11-28 21:29:02 +01:00
parent 32d668b53c
commit 49ac3e97e5
7 changed files with 139 additions and 240 deletions

View File

@@ -9,9 +9,10 @@ def migrate(entry):
topic_dict = {
"slug": entry["slug"],
"oid": entry["_id"],
"title": entry["title"].replace(" ", " ")
"title": entry["title"].replace(" ", " "),
"body": extract_md(html2text(body_orig), entry["_id"])
}
topic_dict["body"] = extract_md(html2text(body_orig), entry["_id"])
with local_session() as session:
slug = topic_dict["slug"]
topic = session.query(Topic).filter(Topic.slug == slug).first() or Topic.create(