Check the header of the file in python

Currently, i am new to python. need some help how to check the header file and check whether the values are present in the oracle table. by disregarding the key word in all the columns and check the rest of the columns and create a warning the column is not present in the table.

Input Files :

/DIL_Exts/LK/NE/input

DIL_LK_NE_WAT_FT_H001_QUAD.csv
DIL_LK_NE_WAT_FT_H001_WEEK.csv
DIL_LK_NE_WAT_FT_H002_QUAD.csv
DIL_LK_NE_WAT_FT_H002_WEEK.csv
DIL_LK_NE_WAT_FT_H003_QUAD.csv
DIL_LK_NE_WAT_FT_H003_WEEK.csv
DIL_LK_NE_WAT_FT_H004_QUAD.csv
DIL_LK_NE_WAT_FT_H004_WEEK.csv

DIL_$country_$client_$catcode_FT_H00$hierarchynum_$filecode.csv

Query Used :

Input Passed => client='NE', a.country='LK', a.catcode='WAT'
SELECT 
	   distinct(filecode),
	    delimiter,
		 hierarchynum,
		 notify
	FROM 
	   DILx_mail a 
	              JOIN DILx_file_types b ON a.catcode = b.catcode and a.client = b.client and a.country = b.country
				  JOIN DILx_conversion c ON a.catcode = c.catcode and a.client = c.client and a.country = c.country
				  JOIN DILx_hierarchy d ON a.catcode = d.catcode and a.client = d.client and a.country = d.country
				  where a.client='NE' and a.catcode='WAT'  and a.country='LK' 
Query Output :

FileCode   delimier 	hierarchynum	 	notify
"QUAD"		"|"				1				"country@wide.com"
"QUAD"		"|"				2				"country@wide.com"
"QUAD"		"|"				3				"country@wide.com"
"QUAD"		"|"				4				"country@wide.com"
"WEEK"		"|"				1				"country@wide.com"
"WEEK"		"|"				2				"country@wide.com"
"WEEK"		"|"				3				"country@wide.com"
"WEEK"		"|"				4				"country@wide.com"
Heder File :

cat DIL_LK_NE_WAT_FT_H001_QUAD_BD_20230225.csv | head -1
parent Key| child Key| Relation Key| Main Key| Unique Key_Dimensinon|Ut Sal|Val Sal|Vol Sal

By neglecting the key words values :
Ut Sal|Val Sal|Vol Sal

Oracle Table :
select * from values 

country Client	Category_code	Values		
"LK"	"NE"	"WAT"			"Val Sal"
"LK"	"NE"	"WAT"			"Ut Sal"

Use can use the python csv module to read your CSV files.
See csv — CSV File Reading and Writing — Python 3.11.2 documentation

I think you need to use the an ODBC module to get to Oracle DB.
See ODBC - Python Wiki

Once you have the data loaded you can then do the checks you describe.

If you want more help post the code you have so far and tell us what you need help with.

can you let me know how to delimit the column based upon by pipe symbol “|”

import pandas

# reading the CSV file
csvFile = pandas.read_csv('input.csv')

# displaying the contents of the CSV file
print(csvFile.columns)

csvFile = pandas.read_csv('input.csv', sep="|")
I have tried the above and it works out.

Try like this:

for col in csvFile.columns:
    if ‘Id’ in col:
        print(match)

No need to use re as its a simple string.
You needed to put the if inside the for loop.