114 lines
2.0 KiB
Markdown
114 lines
2.0 KiB
Markdown
# Quick Start Guide - Automotive Vehicle Database
|
|
|
|
## Database Status: ✅ OPERATIONAL
|
|
|
|
- **30,066** engines
|
|
- **1,213,401** vehicle configurations
|
|
- **93** years (1918-2026)
|
|
- **53** makes
|
|
- **1,937** models
|
|
|
|
---
|
|
|
|
## Access the Database
|
|
|
|
```bash
|
|
docker exec -it mvp-postgres psql -U postgres -d motovaultpro
|
|
```
|
|
|
|
---
|
|
|
|
## Essential Queries
|
|
|
|
### 1. Get All Available Years
|
|
```sql
|
|
SELECT * FROM available_years;
|
|
```
|
|
|
|
### 2. Get Makes for a Specific Year
|
|
```sql
|
|
SELECT * FROM get_makes_for_year(2024);
|
|
```
|
|
|
|
### 3. Get Models for Year + Make
|
|
```sql
|
|
SELECT * FROM get_models_for_year_make(2024, 'Ford');
|
|
```
|
|
|
|
### 4. Get Trims for Year + Make + Model
|
|
```sql
|
|
SELECT * FROM get_trims_for_year_make_model(2024, 'Ford', 'f-150');
|
|
```
|
|
|
|
### 5. Get Complete Vehicle Details
|
|
```sql
|
|
SELECT * FROM complete_vehicle_configs
|
|
WHERE year = 2024
|
|
AND make = 'Ford'
|
|
AND model = 'f-150'
|
|
LIMIT 10;
|
|
```
|
|
|
|
---
|
|
|
|
## Refresh the Database
|
|
|
|
```bash
|
|
# Re-generate SQL files from JSON source data
|
|
python3 etl_generate_sql.py
|
|
|
|
# Re-import into database
|
|
./import_data.sh
|
|
```
|
|
|
|
---
|
|
|
|
## Files Overview
|
|
|
|
| File | Purpose |
|
|
|------|---------|
|
|
| `etl_generate_sql.py` | Generate SQL import files from JSON |
|
|
| `import_data.sh` | Import SQL files into database |
|
|
| `migrations/001_create_vehicle_database.sql` | Database schema |
|
|
| `output/*.sql` | Generated SQL import files (90MB total) |
|
|
|
|
---
|
|
|
|
## Database Schema
|
|
|
|
```
|
|
engines
|
|
├── id (PK)
|
|
├── name
|
|
├── displacement
|
|
├── configuration (I4, V6, V8, etc.)
|
|
├── horsepower
|
|
├── torque
|
|
├── fuel_type
|
|
└── specs_json (full specifications)
|
|
|
|
vehicle_options
|
|
├── id (PK)
|
|
├── year
|
|
├── make
|
|
├── model
|
|
├── trim
|
|
├── engine_id (FK → engines)
|
|
└── transmission_id (FK → transmissions)
|
|
```
|
|
|
|
---
|
|
|
|
## Performance
|
|
|
|
- **Query Time:** < 50ms (indexed)
|
|
- **Database Size:** 219MB
|
|
- **Index Size:** 117MB
|
|
|
|
---
|
|
|
|
## Support
|
|
|
|
- **Full Documentation:** See `ETL_README.md`
|
|
- **Implementation Details:** See `IMPLEMENTATION_SUMMARY.md`
|