z230
This commit is contained in:
30
Medicus report/20 Debugscript.py
Normal file
30
Medicus report/20 Debugscript.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import pymysql
|
||||
import pandas as pd
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
DB_CONFIG = {
|
||||
"host": "192.168.1.76",
|
||||
"port": 3307,
|
||||
"user": "root",
|
||||
"password": "Vlado9674+",
|
||||
"database": "medevio",
|
||||
"charset": "utf8mb4",
|
||||
"cursorclass": pymysql.cursors.DictCursor,
|
||||
}
|
||||
|
||||
conn = pymysql.connect(**DB_CONFIG)
|
||||
|
||||
two_months_ago = (datetime.now() - timedelta(days=60)).strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
sql = """
|
||||
SELECT *
|
||||
FROM pozadavky
|
||||
WHERE createdAt >= %s
|
||||
ORDER BY createdAt DESC
|
||||
"""
|
||||
|
||||
df = pd.read_sql(sql, conn, params=(two_months_ago,))
|
||||
conn.close()
|
||||
|
||||
print("Rows returned:", len(df))
|
||||
print(df.head(10))
|
||||
Reference in New Issue
Block a user