118 lines
2.3 KiB
Markdown
118 lines
2.3 KiB
Markdown
# Quick Start Guide - Automotive Vehicle Database
|
|
|
|
## Database Status: ✅ OPERATIONAL
|
|
|
|
- **30,066** engines
|
|
- **828** transmissions
|
|
- **1,122,644** vehicle configurations
|
|
- **47** years (1980-2026)
|
|
- **53** makes
|
|
- **1,741** models
|
|
- **98.9%** transmission linking success
|
|
|
|
---
|
|
|
|
## 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 | Size |
|
|
|------|---------|------|
|
|
| `etl_generate_sql.py` | Generate SQL import files from JSON | ~20KB |
|
|
| `import_data.sh` | Import SQL files into database | ~2KB |
|
|
| `migrations/001_create_vehicle_database.sql` | Database schema | ~8KB |
|
|
| `output/01_engines.sql` | Engine data (id, name only) | ~632KB |
|
|
| `output/02_transmissions.sql` | Transmission data (id, type only) | ~21KB |
|
|
| `output/03_vehicle_options.sql` | Vehicle configurations | ~51MB |
|
|
| **Total Output** | | **~52MB** |
|
|
|
|
---
|
|
|
|
## Database Schema
|
|
|
|
```
|
|
engines
|
|
├── id (PK)
|
|
└── name (e.g., "V8 3.5L Turbo", "L4 2.0L")
|
|
|
|
transmissions
|
|
├── id (PK)
|
|
└── type (e.g., "8-Speed Automatic", "6-Speed Manual")
|
|
|
|
vehicle_options
|
|
├── id (PK)
|
|
├── year (1980-2026)
|
|
├── make (Title Case: "Ford", "Acura", "Land Rover")
|
|
├── model
|
|
├── trim
|
|
├── engine_id (FK → engines)
|
|
└── transmission_id (FK → transmissions)
|
|
```
|
|
|
|
---
|
|
|
|
## Performance
|
|
|
|
- **Query Time:** < 50ms (composite indexes)
|
|
- **Database Size:** ~250MB (with indexes)
|
|
- **SQL Import Files:** ~52MB total
|
|
- **Batch Insert Size:** 1,000 records per batch
|
|
|
|
---
|
|
|
|
## Support
|
|
|
|
- **Full Documentation:** See `ETL_README.md`
|
|
- **Implementation Details:** See `IMPLEMENTATION_SUMMARY.md`
|