Spaces:
Sleeping
Sleeping
Download backend/database_setup.py from Rohxn08/ZipRoute-API: direct link, hf CLI and curl.
- Browser
- Download file 612 Bytes
-
https://huggingface.co/spaces/Rohxn08/ZipRoute-API/resolve/main/backend/database_setup.py
- Command line
-
hf download hf://spaces/Rohxn08/ZipRoute-API/backend/database_setup.py
-
curl -L -o database_setup.py https://huggingface.co/spaces/Rohxn08/ZipRoute-API/resolve/main/backend/database_setup.py
612 Bytes
| import sqlite3 | |
| conn = sqlite3.connect('/home/tejas/Projects/Delivery_route_optimize/delivery-route-app/backend/routes.db') | |
| cursor = conn.cursor() | |
| create_table_sql = """ | |
| CREATE TABLE IF NOT EXISTS completed_routes ( | |
| id INTEGER PRIMARY KEY AUTOINCREMENT, | |
| start_time TEXT NOT NULL, | |
| end_time TEXT NOT NULL, | |
| ors_duration_minutes REAL NOT NULL, | |
| total_distance_km REAL NOT NULL, | |
| num_stops INTEGER NOT NULL, | |
| actual_duration_minutes REAL NOT NULL | |
| );""" | |
| cursor.execute(create_table_sql) | |
| conn.commit() | |
| conn.close() | |
| print("Database 'routes.db' and table 'completed_routes' created successfully.") |