Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gabeweiss/sql_data_randomizer
Holds some scripts I've written to help quickly get some random data into a SQL database.
https://github.com/gabeweiss/sql_data_randomizer
Last synced: 2 months ago
JSON representation
Holds some scripts I've written to help quickly get some random data into a SQL database.
- Host: GitHub
- URL: https://github.com/gabeweiss/sql_data_randomizer
- Owner: GabeWeiss
- License: apache-2.0
- Created: 2019-12-05T19:18:29.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-09-13T23:45:18.000Z (over 3 years ago)
- Last Synced: 2023-10-20T19:55:59.322Z (about 1 year ago)
- Language: Python
- Size: 74.2 KB
- Stars: 6
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sql_data_randomizer
Couple scripts I wrote to help quickly get some random data into a MySQL or PostgreSQL database. If you're looking for something similar for SQL Server, you can find a good one here: https://github.com/dmahugh/cloudsql-samples/blob/master/faker_sample.pyIt connects on 127.0.0.1 by default (can be changed via env var or flag). I rely on running the Cloud SQL proxy at the same location as the script to make things consistent. If you're running a local database, of course it will also work fine on that db.
**NOTE** that by default this drops the tables before re-creating them. Don't run this against a database with existing data unless you're okay with said data going away.
Can run *-h* for full usage/options.
Dockerfile and deployment yaml files also handy to run this in a container if you want to scale it up with Kubernetes.
Blog posts breaking things down:
Script: https://medium.com/@GabeWeiss/creating-sample-data-for-mysql-databases-38e3eff4a91b
Containerization basics: https://medium.com/@GabeWeiss/breaking-down-containers-9b0eb94cc0cd (not quite live yet, soon)
Scaling app with Kubernetes and connecting to Cloud SQL using sidecar pattern: https://medium.com/@GabeWeiss/connecting-cloud-sql-kubernetes-sidecar-46e016e07bb4 (also not quite live yet, soon)