no message
parent
342be255fa
commit
4515f4d52a
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SourceSyncRemoteConfigurationsService"><![CDATA[{
|
||||
"connections": [
|
||||
{
|
||||
"type": "ssh_configuration",
|
||||
"name": "API-Server",
|
||||
"hostname": "172.17.1.239",
|
||||
"username": "root",
|
||||
"remote_workspace_path": "/root",
|
||||
"preserve_timestamps": true
|
||||
}
|
||||
],
|
||||
"mainConnection": "API-Server"
|
||||
}]]></component>
|
||||
</project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,44 @@
|
|||
import mysql.connector.locales.eng
|
||||
import mysql.connector
|
||||
import os
|
||||
import time
|
||||
os.environ['TZ'] = 'Europe/Berlin'
|
||||
time.tzset()
|
||||
|
||||
def database(query,name,user):
|
||||
# server.start()
|
||||
|
||||
mydb = mysql.connector.connect(
|
||||
host="172.17.1.21",
|
||||
port=3306,
|
||||
user="root",
|
||||
password="N53yBCswuawzBzS445VNAhWVMs3N59Gb9szEsrzXRBzarDqpdETpQeyt5v5CGe",
|
||||
database="" + name,
|
||||
auth_plugin='mysql_native_password',
|
||||
)
|
||||
mydb.connect()
|
||||
cursor = mydb.cursor()
|
||||
if "SELECT" in query:
|
||||
if user:
|
||||
cursor.execute(query, user)
|
||||
return cursor.fetchone()
|
||||
else:
|
||||
cursor.execute(query, user)
|
||||
return cursor.fetchall()
|
||||
if "SHOW" in query:
|
||||
cursor.execute(query)
|
||||
return cursor.fetchall()
|
||||
if "INSERT" in query:
|
||||
cursor.execute(query,user)
|
||||
mydb.commit()
|
||||
if "UPDATE" in query:
|
||||
cursor.execute(query,user)
|
||||
mydb.commit()
|
||||
mydb.close()
|
||||
|
||||
# mysql_connect.database("SELECT * from `Ping-Server` WHERE NAME='TNPTS01' ORDER BY time DESC LIMIT 1;")
|
||||
server = database("SELECT DISTINCT NAME FROM `Ping-Server`","Stines-GmbH","")
|
||||
for i in server:
|
||||
print(i[0])
|
||||
time = database(f"SELECT * from `Ping-Server` WHERE NAME='{i[0]}' ORDER BY time DESC LIMIT 1;","Stines-GmbH","")
|
||||
print(time[0][0])
|
||||
Loading…
Reference in New Issue