KJ commited on
Commit ·
d84fb96
1
Parent(s): e11f617
fixing query
Browse files
app.py
CHANGED
|
@@ -53,7 +53,7 @@ engine = create_engine(MYSQL_URL, pool_pre_ping=True, pool_recycle=3600)
|
|
| 53 |
def get_timestamp_range():
|
| 54 |
try:
|
| 55 |
with engine.connect() as conn:
|
| 56 |
-
result = conn.execute(text("SELECT MIN(timestamp) as min_ts, MAX(timestamp) as max_ts FROM
|
| 57 |
return result[0], result[1] # min_ts, max_ts
|
| 58 |
except Exception as e:
|
| 59 |
st.error(f"Error fetching timestamp range: {e}")
|
|
@@ -75,7 +75,7 @@ def load_gps_data(from_ts, to_ts):
|
|
| 75 |
try:
|
| 76 |
query = text("""
|
| 77 |
SELECT latitude, longitude, device_id
|
| 78 |
-
FROM
|
| 79 |
WHERE timestamp BETWEEN :from_ts AND :to_ts
|
| 80 |
ORDER BY timestamp
|
| 81 |
""")
|
|
|
|
| 53 |
def get_timestamp_range():
|
| 54 |
try:
|
| 55 |
with engine.connect() as conn:
|
| 56 |
+
result = conn.execute(text("SELECT MIN(timestamp) as min_ts, MAX(timestamp) as max_ts FROM telemetry_data")).fetchone()
|
| 57 |
return result[0], result[1] # min_ts, max_ts
|
| 58 |
except Exception as e:
|
| 59 |
st.error(f"Error fetching timestamp range: {e}")
|
|
|
|
| 75 |
try:
|
| 76 |
query = text("""
|
| 77 |
SELECT latitude, longitude, device_id
|
| 78 |
+
FROM telemetry_data
|
| 79 |
WHERE timestamp BETWEEN :from_ts AND :to_ts
|
| 80 |
ORDER BY timestamp
|
| 81 |
""")
|