The input file holds a single course id exactly as stored in the course table (e.g. CS1001).
Write a program that looks up that course and prints its title, the department that owns it, and its credit value.
Output a single row with three columns in this order, separated by one space:
title dept_name credits
title — the course title.dept_name — the owning department.credits — number of credits.The query returns exactly one row (course id is the primary key).
Note: Do not hard-code the database name — your program is run against a different database instance for evaluation. The input file is in the same folder as your program.
For the database connection, use these variables:
database = sys.argv[1] # database name, from the command line
user = os.environ.get('PGUSER')
password = os.environ.get('PGPASSWORD')
host = os.environ.get('PGHOST')
port = os.environ.get('PGPORT')
The input is a file named input.txt in the same folder — A single line containing a course id, e.g. CS1001.
primary keyforeign keyarrow points to the referenced columndrag to pan