-1
  • Should be done using single function

  • Shouldn't use Pandas or merge function or any other inbuilt database libraries

  • Hello, welcome to Stackoverflow! Please, provide a reproducible example for your code and your tries searching for the answer. Without this, you're breaking a guideline from stackoverflow. Also, check if other questions don't help you (like https://stackoverflow.com/questions/14839528/merge-two-objects-in-python). Also worth mentioning your input data/structure and your desired output format. – Alexander Santos Apr 28 '22 at 15:46
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Apr 28 '22 at 19:24

1 Answers1

0

You can use native driver like psycopg2 for postgres https://www.psycopg.org/docs/usage.html

import psycopg2

# Connect to an existing database
conn = psycopg2.connect("dbname=test user=postgres")
cur = conn.cursor()



# Query the database and obtain data as Python objects
cur.execute("""
SELECT * FROM test t
left join test1 t1 on (t.t1_id = t1.id);
""")
fetched_rows = cur.fetchall()


# Make the changes to the database persistent
conn.commit()

# Close communication with the database
cur.close()
conn.close()
user3804427
  • 432
  • 2
  • 12