remove MetaDataTable and MetaDataColumn to cleanup schema
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user