https://github.com/nomemory/neat-sample-databases-generators
Neat java scripts (!not javascript) to generate arbitrary data for various sample databases (hr schema, classicmodels, etc.)
https://github.com/nomemory/neat-sample-databases-generators
classicmodels java jbang mariadb mockneat mysql postgresql sample-databases sample-schemas sql
Last synced: 11 months ago
JSON representation
Neat java scripts (!not javascript) to generate arbitrary data for various sample databases (hr schema, classicmodels, etc.)
- Host: GitHub
- URL: https://github.com/nomemory/neat-sample-databases-generators
- Owner: nomemory
- Created: 2021-02-12T12:26:52.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-19T16:36:44.000Z (almost 5 years ago)
- Last Synced: 2025-03-22T06:32:36.028Z (11 months ago)
- Topics: classicmodels, java, jbang, mariadb, mockneat, mysql, postgresql, sample-databases, sample-schemas, sql
- Language: Java
- Homepage:
- Size: 301 KB
- Stars: 17
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A list of scripts that are genering DDL and DML scripts to fill-up sample schemas with data.
Scripts are written in Java, and can be run using [jbang](https://github.com/jbangdev/jbang).
To install jbang - [check the official documentation](https://github.com/jbangdev/jbang) - or simply:
```sh
curl -s "https://get.sdkman.io" | bash
source ~/.bash_profile
sdk install java
sdk install jbang
```
Data is generated using [mockneat](https://www.mockneat.com).
Contributions are welcomed!
# List of scripts
| Script | Schema | Targets |
| ------ | ------ | ------- |
| [scripts/classicmodels_mysql.java](https://github.com/nomemory/neat-sample-databases-generators/blob/main/scripts/classicmodels_mysql.java) | [classicmodels](#classicmodels-sql) | mysql, mariadb |
| [scripts/classicmodels_postgresql.java](https://github.com/nomemory/neat-sample-databases-generators/blob/main/scripts/classicmodels_postgresql.java) | [classicmodels](#classicmodels-sql) | postgresql |
| [scripts/hr_schema_mysql.java](https://github.com/nomemory/neat-sample-databases-generators/blob/main/scripts/hr_schema_mysql.java) | [HR](#hr-schema-sql) | mysql, mariadb |
| [scripts/hr_schema_postgresql.java](https://github.com/nomemory/neat-sample-databases-generators/blob/main/scripts/hr_schema_postgresql.java) | [HR](#hr-schema-sql) | postgresql |
# Running the scripts
After cloning the project:
```sh
jbang scripts/hr_schema_mysql.java > inserts.sql
```
Most scripts support various options (e.g.: generating more data, or target various databases). The best way to see the options a script is offering:
```sh
jbang scripts/hr_schema_mysql.java --help
```
Each subsequent run will generate arbitrary data, different than the previous run.
# Supported Schemas
ER diagrams were generated using [DBeaver](https://dbeaver.io/).
## HR Schema (SQL)
If you ever had the chance to work with [Oracle DB](https://www.oracle.com/ro/database/technologies/) this is probably one of the most known sample schemas to play with.
It models an HR application containing information about the Company's Locations, Departements, Employees and their Managers.

## classicmodels (SQL)
This is a classic schema describing a online-shop.
It's one of the official sample schemas for MySQL.
