remove MetaDataTable and MetaDataColumn to cleanup schema

This commit is contained in:
Thomas Peetz
2025-05-23 18:21:41 +02:00
parent 8cfb60f9a1
commit 456162da44
34 changed files with 536 additions and 1354 deletions
+9 -1
View File
@@ -3,6 +3,7 @@ import data from json file to PostgreSQL
"""
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from datetime import datetime
from typing import Any, AnyStr, Dict, List
import os
import json
@@ -61,7 +62,14 @@ def get_ids(items: List[Any]) -> List[AnyStr]:
def update_item(db: Session, import_data: Dict[AnyStr, Any], item: Any, dry_run: bool, log):
for (key, value) in import_data.items():
existing_value = getattr(item, str(key))
if existing_value != value:
update: bool = False
if isinstance(existing_value, datetime):
if str(existing_value) != str(value):
update = True
else:
if existing_value != value:
update = True
if update:
if not dry_run:
log.debug(f"update {key}({existing_value}) with {value}")
setattr(item, str(key), value)