How can I include and run a program in python/psycopg2?

Hello,

I want to write a program, that loads the data from a provided datafile and ingests them into the database schema I have created earlier (a script named database1.sql). Providing a script called data1.sh that sets up prerequisites, compiles and runs my program, and can be invoked in linux as follows: ./data1.sh ./file1.csv ./file2.csv ./file3.csv

Which code do I have to use in order to include the files into my code? and how do I run the program/files in windows?

And how do I connect my database, created in pdadmin to my code?
I used:

sql_con = psycopg2.connect(host=db_host, port=db_port, database=db_name, user=db_user, password=db_password)

After running my code I receive the error:
File "C:/Users/User1/Documents/databases/IngestData.py", line 7, in <module>
localhost = sys.argv[-5]

Any help is highly appreciated.

0

Please sign in to leave a comment.