Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def check_column_existence(dbHost, dbPort, dbName, dbUser, dbPassword, table_name, column_name):
- sqlQuery="""select count(*) from
- INFORMATION_SCHEMA.columns
- where table_name='{}' and column_name='{}';""".format(table_name, column_name)
- conn = pymssql.connect(host=dbHost, port=dbPort, user=dbUser, password=dbPassword, database=dbName)
- cursor = conn.cursor()
- sql = sqlQuery.encode('utf-8')
- cursor.execute(sql)
- for row in cursor:
- if row[0] == 1:
- result = True
- else:
- result = False
- print(result)
- return result
- def populate_db_attribute_existence(input_csv_file_path):
- input_csv_file_path = os.path.abspath(input_csv_file_path)
- df = pd.read_csv(input_csv_file_path)
- df['DB_Entity'] = df['DB_Entity'].str.replace(' ', '')
- df['DB_Attributes'] = df['DB_Attributes'].str.replace(' ', '')
- print(df[['DB_Entity', 'DB_Attributes']])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement