Compare commits
7 Commits
24039269a0
...
dc30bf9226
| Author | SHA1 | Date |
|---|---|---|
|
|
dc30bf9226 | |
|
|
7beb2755c5 | |
|
|
3c9e21b961 | |
|
|
1cf6e47808 | |
|
|
2733b4a72f | |
|
|
07f1cef315 | |
|
|
5d72320673 |
|
|
@ -141,7 +141,7 @@
|
|||
//to: 'rene.forstner@nttdata.com, ermis.wieger@nttdata.com, patryk.gudalewicz.bp@nttdata.com',
|
||||
//to: 'patryk.gudalewicz.bp@nttdata.com',
|
||||
//to: 'rene.forstner@nttdata.com, ermis.wieger@nttdata.com, arnel.arnautovic@nttdata.com, patryk.gudalewicz.bp@nttdata.com, stephan.oertelt@bmw.de, Mohammed.Abadel@bmw.de, michaela.jaeger@bmw.de, OOC-Support@bmwgroup.com, Andreas.DB.Danzer@bmwgroup.com',
|
||||
to: 'ermis.wieger@nttdata.com, Andreas.DB.Danzer@bmwgroup.com, OOC-Support@bmwgroup.com, michaela.jaeger@bmw.de, thilo.bindel@bmwgroup.com',
|
||||
to: 'Andreas.DB.Danzer@bmwgroup.com',
|
||||
replyTo: 'coco-apm@bmw.de',
|
||||
attachmentsPattern: '*.xlsx'
|
||||
|
||||
|
|
@ -158,7 +158,7 @@
|
|||
failure {
|
||||
emailext subject: "${env.JOB_NAME} build ${env.BUILD_ID} failed",
|
||||
body: "QM report failed, see logs for details: ${env.BUILD_URL}",
|
||||
to: 'BMW.CoCo.Dynatrace@nttdata.com, ermis.wieger@nttdata.com, Andreas.DB.Danzer@bmwgroup.com'
|
||||
to: 'Andreas.DB.Danzer@bmwgroup.com'
|
||||
// to post to the teams channel "0 - APM Service Desk" just uncomment the following command:
|
||||
// office365ConnectorSend webhookUrl: "https://bmwgroup.webhook.office.com/webhookb2/483edc00-c925-4672-8088-8299a0139fca@ce849bab-cc1c-465b-b62e-18f07c9ac198/JenkinsCI/9aca6923685b40f794134853fcbe88f1/ff31bcee-96b3-4481-9bd8-4f74180b263b",
|
||||
// message: "QM report failed, see logs for details: ${env.BUILD_URL}",
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@ pandas
|
|||
requests
|
||||
datetime
|
||||
argparse
|
||||
openpyxl
|
||||
openpyxl
|
||||
cx_Oracle
|
||||
|
|
|
|||
46
summary.py
46
summary.py
|
|
@ -1,10 +1,19 @@
|
|||
import pandas as pd
|
||||
import os
|
||||
import glob
|
||||
import cx_Oracle
|
||||
import datetime
|
||||
from datetime import date
|
||||
import os
|
||||
|
||||
|
||||
|
||||
|
||||
def init():
|
||||
global df
|
||||
dsnStr = cx_Oracle.makedsn("plapexgma01.bmwgroup.net", "1534", "apex5p")
|
||||
db_connection_string = 'username/passwort@hostname.de.oracle.com:1521/servicename'
|
||||
con = cx_Oracle.connect(user="b2vadmin",password="B2V@aDmIn7", dsn=dsnStr)
|
||||
|
||||
#list_of_files = glob.glob('*.xlsx') # * means all if need specific format then *.csv
|
||||
latest_file = max(glob.iglob('*.xlsx'),key=os.path.getctime)
|
||||
|
|
@ -17,6 +26,35 @@ def init():
|
|||
|
||||
if df.size > 0:
|
||||
createHtmlSummary(df)
|
||||
try:
|
||||
with con.cursor() as cursor:
|
||||
# execute the insert statement
|
||||
#sql = ("INSERT INTO RELIABILITY_DAILY "
|
||||
#"(date, hub, dynatrace_id, touchpoint, percentage, status) "
|
||||
#"VALUES (to_date('%s'), %s, %s, %s, %s, %s)")
|
||||
|
||||
#sql = "INSERT INTO RELIABILITY_DAILY_NEW VALUES (:1, :2,:3,:4, :5, :6, :7)"
|
||||
|
||||
sql = "INSERT INTO RELIABILITY_DAILY_NEW VALUES (to_date(:1,'DD-MM-YYYY'), :2,:3,:4, :5, :6, :7)"
|
||||
#daily_value = (str(datetime.now().replace(microsecond=0)), 'emea', '3434','mobile', 97.43,'warning')
|
||||
daily_value = ('emea')
|
||||
df_list = df.values.tolist()
|
||||
# print(str(s1[0]))
|
||||
#cursor.execute('''INSERT INTO RELIABILITY_DAILY_TEST values ('emea')''')
|
||||
for x, item in enumerate(df_list):
|
||||
cursor.execute(sql, ( df["Date"][x], df["HUB"][x], df["id"][x], df["name"][x], df["Touchpoint"][x], float(df["evaluatedPercentage"][x]), df["status"][x]))
|
||||
# cursor.execute(sql, ( df["Date"][x], df["HUB"][x], df["id"][x], df["name"][x], df["Touchpoint"][x], float(df.evaluatedPercentage.values[x].replace(',','.')), df["status"][x]))
|
||||
# commit work
|
||||
con.commit()
|
||||
|
||||
except cx_Oracle.Error as error:
|
||||
print('Error occurred:')
|
||||
print(error)
|
||||
|
||||
|
||||
print("Database version:", con.version)
|
||||
con.close()
|
||||
|
||||
|
||||
|
||||
def createHtmlSummary(df):
|
||||
|
|
@ -92,4 +130,10 @@ def createHtmlSummary(df):
|
|||
f.write(SummaryString)
|
||||
|
||||
if __name__ == "__main__":
|
||||
init()
|
||||
init()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue