skip to Main Content

Json import to postgresql with python

I'm trying to import multiple json files into my postgres Database with the following code. import json import psycopg2 con = psycopg2.connect(database="kw_du", user="postgres", password="f67dd8hzFE5",host="localhost") cur = con.cursor() with open(r"C:UsersdiegoOneDriveDesktopWorkplace220906nu_2022_09_01.json", 'r') as data_file: data = json.load(data_file) with con.cursor() as cur: cur.executemany('INSERT…

VIEW QUESTION
Back To Top
Search