This commit is contained in:
2025-10-03 15:49:08 +02:00
parent 3d3784ce58
commit 7fbeba5a1d
3 changed files with 316 additions and 8 deletions

View File

@@ -32,7 +32,7 @@ K_DATU = date.today().isoformat() # YYYY-MM-DD
ODBORNOSTI = ["001"] # VPL (adult GP)
# MySQL
if socket.gethostname().strip() == "NTBVBHP470G10":
if socket.gethostname().strip() in ("NTBVBHP470G10","Z230"):
MYSQL_CFG = dict(
host="192.168.1.76",
port=3307,
@@ -175,13 +175,13 @@ ON DUPLICATE KEY UPDATE
for p in payloads:
pprint(p)
conn = pymysql.connect(**MYSQL_CFG)
connsql = get_mysql_connection()
try:
with conn.cursor() as cur:
with connsql.cursor() as cur:
cur.executemany(sql, payloads)
conn.commit()
connsql.commit()
finally:
conn.close()
connsql.close()
print(f"\nUpserted rows: {len(payloads)}")
return len(payloads)
@@ -216,7 +216,7 @@ def main():
con = get_medicus_connection()
cur = con.cursor()
cur.execute("select rodcis, prijmeni, jmeno from kar where rodcis starting with '9'")
cur.execute("select rodcis, prijmeni, jmeno from kar where rodcis starting with '8'")
# cur.execute("select first 2 rodcis, prijmeni, jmeno from kar where rodcis starting with '0'")
# Vytvor seznam rodnych cisel, která už máme