first Durchstich: comdirect Giro to DB
This commit is contained in:
+21
-5
@@ -2,8 +2,8 @@ import argparse
|
||||
from pathlib import Path
|
||||
|
||||
from src.db import get_session
|
||||
from src.helper_db import upsert_b4w
|
||||
from src.reader import reader_b4w
|
||||
from src.helper_db import upsert_b4w, upsert_comdirect_giro
|
||||
from src.reader import reader_b4w, reader_comdirect
|
||||
|
||||
|
||||
def ingest_b4w(path: Path):
|
||||
@@ -14,16 +14,32 @@ def ingest_b4w(path: Path):
|
||||
session.commit()
|
||||
|
||||
|
||||
def ingest_comdirect(path: Path):
|
||||
data = reader_comdirect(path).get("Girokonto")
|
||||
assert isinstance(data, list)
|
||||
with get_session() as session:
|
||||
for row in data:
|
||||
upsert_comdirect_giro(session, row, do_commit=False)
|
||||
session.commit()
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Eine App um den Überblick über Finanzen zu behalten"
|
||||
)
|
||||
parser.add_argument("input", help="Pfad einer einzulesenden Umsatzdatei (CSV)")
|
||||
parser.add_argument(
|
||||
"--input_b4w", help="Pfad einer einzulesenden Umsatzdatei (CSV)"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--input_comdirect", help="Pfad einer einzulesenden Umsatzdatei (CSV)"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
path = Path(args.input)
|
||||
path_b4w = Path(args.input_b4w)
|
||||
path_comdirect = Path(args.input_comdirect)
|
||||
|
||||
ingest_b4w(path)
|
||||
ingest_b4w(path_b4w)
|
||||
ingest_comdirect(path_comdirect)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user