How lerocha/netflixdb works
Netflix Sample Database imports Netflix engagement-report and weekly Top 10 spreadsheets into a relational sample database, then exports vendor-specific SQL scripts. The principal workflow is startup-triggered batch import: read and map spreadsheet rows, persist titles and viewing summaries, verify the data, and export schema/data. The graph preserves the documented database-vendor options and the model’s movie, TV-show, season, and summary stages. Some batch steps are omitted from the excerpt, so only documented or indexed relationships are shown.
Main entry points: CreateNetflixDatabaseJobConfig.kt Import and export job · ReportSheetRow.kt Report row mapping · DatabaseStrategyFactory.kt Vendor strategy selection · DatabaseStrategy.kt SQL generation strategy
Components 22
Batch ingestion
- Spring Boot app
src/main/kotlin/com/github/lerocha/netflixdb/NetflixDbApplication.kt - Import and export job
src/main/kotlin/com/github/lerocha/netflixdb/batch/CreateNetflixDatabaseJobConfig.kt - Netflix spreadsheets
src/main/resources/reports - Report row mapping
src/main/kotlin/com/github/lerocha/netflixdb/dto/ReportSheetRow.kt - Engagement report metadata
src/main/kotlin/com/github/lerocha/netflixdb/dto/EngagementReport.kt - Streaming categories
src/main/kotlin/com/github/lerocha/netflixdb/dto/StreamingCategory.kt
Data model
- Movies
src/main/kotlin/com/github/lerocha/netflixdb/entity/Movie.kt - TV shows
src/main/kotlin/com/github/lerocha/netflixdb/entity/TvShow.kt - Seasons
src/main/kotlin/com/github/lerocha/netflixdb/entity/Season.kt - View summaries
src/main/kotlin/com/github/lerocha/netflixdb/entity/ViewSummary.kt - Summary duration
src/main/kotlin/com/github/lerocha/netflixdb/entity/SummaryDuration.kt - Entity base and audit fields
src/main/kotlin/com/github/lerocha/netflixdb/entity/AbstractEntity.kt
Persistence
- JPA repositories
src/main/kotlin/com/github/lerocha/netflixdb/repository - Relational database
SQL export
- Schema and data export
src/main/kotlin/com/github/lerocha/netflixdb/service/DatabaseExportService.kt - Vendor strategy selection
src/main/kotlin/com/github/lerocha/netflixdb/service/DatabaseStrategyFactory.kt - SQL generation strategy
src/main/kotlin/com/github/lerocha/netflixdb/service/DatabaseStrategy.kt - MySQL SQL strategy
src/main/kotlin/com/github/lerocha/netflixdb/service/MySqlStrategy.kt - Oracle SQL strategy
src/main/kotlin/com/github/lerocha/netflixdb/service/OracleStrategy.kt - PostgreSQL SQL strategy
src/main/kotlin/com/github/lerocha/netflixdb/service/PostgresStrategy.kt - SQL Server SQL strategy
src/main/kotlin/com/github/lerocha/netflixdb/service/SqlServerStrategy.kt
Other components
- SQL script user
Connections 23
- Spring Boot app → Import and export job: starts batch
README.md - Import and export job → Netflix spreadsheets: reads sheets
README.md - Import and export job → Engagement report metadata: selects reports
src/main/kotlin/com/github/lerocha/netflixdb/batch/CreateNetflixDatabaseJobConfig.kt - Import and export job → Report row mapping: maps rows
src/main/kotlin/com/github/lerocha/netflixdb/batch/CreateNetflixDatabaseJobConfig.kt - Report row mapping → Streaming categories: uses categories
src/main/kotlin/com/github/lerocha/netflixdb/dto/ReportSheetRow.kt - Report row mapping → Movies: creates movie
src/main/kotlin/com/github/lerocha/netflixdb/dto/ReportSheetRow.kt - Report row mapping → Seasons: creates season
src/main/kotlin/com/github/lerocha/netflixdb/dto/ReportSheetRow.kt - Report row mapping → TV shows: creates show
src/main/kotlin/com/github/lerocha/netflixdb/dto/ReportSheetRow.kt - Report row mapping → View summaries: creates summary
src/main/kotlin/com/github/lerocha/netflixdb/dto/ReportSheetRow.kt - View summaries → Summary duration: uses duration
src/main/kotlin/com/github/lerocha/netflixdb/entity/ViewSummary.kt - Import and export job → JPA repositories: persists entities
src/main/kotlin/com/github/lerocha/netflixdb/batch/CreateNetflixDatabaseJobConfig.kt - JPA repositories → Relational database: stores records
- Import and export job → Schema and data export: requests export
src/main/kotlin/com/github/lerocha/netflixdb/batch/CreateNetflixDatabaseJobConfig.kt - Schema and data export → Vendor strategy selection: selects strategy
src/main/kotlin/com/github/lerocha/netflixdb/service/DatabaseExportService.kt - Vendor strategy selection → MySQL SQL strategy: dispatches
src/main/kotlin/com/github/lerocha/netflixdb/service/DatabaseStrategyFactory.kt - Vendor strategy selection → Oracle SQL strategy: dispatches
src/main/kotlin/com/github/lerocha/netflixdb/service/DatabaseStrategyFactory.kt - Vendor strategy selection → PostgreSQL SQL strategy: dispatches
src/main/kotlin/com/github/lerocha/netflixdb/service/DatabaseStrategyFactory.kt - Vendor strategy selection → SQL Server SQL strategy: dispatches
src/main/kotlin/com/github/lerocha/netflixdb/service/DatabaseStrategyFactory.kt - MySQL SQL strategy → SQL generation strategy: implements
src/main/kotlin/com/github/lerocha/netflixdb/service/MySqlStrategy.kt - Oracle SQL strategy → SQL generation strategy: implements
src/main/kotlin/com/github/lerocha/netflixdb/service/OracleStrategy.kt - PostgreSQL SQL strategy → SQL generation strategy: implements
src/main/kotlin/com/github/lerocha/netflixdb/service/PostgresStrategy.kt - SQL Server SQL strategy → SQL generation strategy: implements
src/main/kotlin/com/github/lerocha/netflixdb/service/SqlServerStrategy.kt - Schema and data export → SQL script user: exports scripts
README.md