Building DataDiluvium: A Data Generation Tool – Part 3: Data Generation and Final Implementation

In Parts 1 and 2, I set up the development environment and implemented the schema parsing functionality. Now, I’ll explore the data generation system and final implementation details that make DataDiluvium a complete solution.

Data Generation System

1. Generator Registry

I’ve implemented the generator system in src/app/lib/generators/registry.ts. This registry manages different types of data generators:

import { Generator } from './types';
import { SequentialNumberGenerator } from './basic';
import { UsernameGenerator } from './basic';
import { DateGenerator } from './basic';
import { ForeignKeyGenerator } from './basic';

export const generatorRegistry = new Map<string, Generator>();

// Register built-in generators
generatorRegistry.set('Sequential Number', new SequentialNumberGenerator());
generatorRegistry.set('Username', new UsernameGenerator());
generatorRegistry.set('Date', new DateGenerator());
generatorRegistry.set('Foreign Key', new ForeignKeyGenerator());
Continue reading “Building DataDiluvium: A Data Generation Tool – Part 3: Data Generation and Final Implementation” →

Building DataDiluvium: A Data Generation Tool – Part 2: Core Implementation and Schema Handling

In Part 1, we set up our development environment and outlined the project structure. Now, we’ll dive into implementing the core functionality of DataDiluvium, starting with SQL schema parsing and the user interface for schema input.

SQL Schema Parsing Implementation

1. SQL Parser Setup

The SQL parser is implemented in src/app/lib/parsers/sqlParser.ts. This module is responsible for:

  1. Parsing SQL schema definitions using the node-sql-parser library
  2. Extracting table and column information
  3. Mapping SQL data types to appropriate data generators

The parser works by:

  1. Taking a SQL string input
  2. Converting it to an Abstract Syntax Tree (AST)
  3. Traversing the AST to extract:
    • Table names
    • Column names
    • Data types
    • Default values
    • Foreign key relationships

The SchemaColumn type defines the structure of our parsed columns:

export type SchemaColumn = {
  tableName: string;
  columnName: string;
  dataType: string;
  defaultValue: string | null;
  generator?: string;
  referencedTable?: string;
  referencedColumn?: string;
};
Continue reading “Building DataDiluvium: A Data Generation Tool – Part 2: Core Implementation and Schema Handling” →

Building DataDiluvium: A Data Generation Tool – Part 1: Prerequisites and Project Overview

(To read up on how to use the site, check out the previous post Effortless Data Generation for Developers.)

DataDiluvium is a web-based tool I’ve built designed to help developers, database administrators, and data engineers generate realistic test data based on SQL schema definitions. The tool takes SQL table definitions as input and produces sample data in various formats, making it easier to populate development and testing environments with meaningful data.

Project Overview

The core functionality of DataDiluvium includes:

  • SQL schema parsing and validation
  • Customizable data generation rules per column
  • Support for foreign key relationships
  • Multiple export formats (JSON, CSV, XML, Plain Text, SQL Inserts)
  • Real-time preview of generated data
  • Dark mode support
  • Responsive design
Continue reading “Building DataDiluvium: A Data Generation Tool – Part 1: Prerequisites and Project Overview” →

Effortless Data Generation for Developers

DataDiluvium is a web-based tool available at datadiluvium.com that helps developers, database administrators, and data engineers generate realistic test data from SQL schema definitions. Whether you’re setting up a development environment, creating test scenarios, or preparing data for demonstrations, DataDiluvium streamlines the process of data generation.

What is DataDiluvium?

Purpose

DataDiluvium serves several key purposes:

  1. Development Environment Setup: Quickly populate development databases with meaningful test data
  2. Testing: Generate consistent test data for automated testing scenarios
  3. Demonstrations: Create realistic data sets for product demonstrations
  4. Data Migration Testing: Validate data migration scripts with generated test data
  5. Schema Validation: Test database schema designs with realistic data

Key Features

  • SQL schema parsing and validation
  • Customizable data generation rules
  • Support for foreign key relationships
  • Multiple export formats (JSON, CSV, XML, Plain Text, SQL Inserts)
  • Real-time preview of generated data
  • Dark mode support
  • Responsive design

How to Use DataDiluvium

1. Accessing the Application

  1. Visit datadiluvium.com
  2. No account required – start using immediately
  3. Your data is processed locally in your browser

2. Defining Your Schema

  1. Navigate to the Schema page

  2. Enter your SQL schema definition in the text area Example:

    CREATE TABLE users (
        id INT PRIMARY KEY,
        username VARCHAR(50) NOT NULL,
        email VARCHAR(100) NOT NULL,
        created_at DATETIME DEFAULT CURRENT_TIMESTAMP
    );
    
    CREATE TABLE orders (
        id INT PRIMARY KEY,
        user_id INT,
        total_amount DECIMAL(10,2),
        created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
        FOREIGN KEY (user_id) REFERENCES users(id)
    );
    
  3. The application will automatically:

    • Parse your schema
    • Validate the structure
    • Suggest appropriate data generators
    • Show a preview of the parsed schema

3. Configuring Data Generation

  1. For each column, you can:

    • Select a data generator
    • Set custom parameters
    • Define relationships
  2. Available generators include:

    • Sequential Numbers
    • Usernames
    • Email addresses
    • Dates
    • Foreign Keys
    • Custom text
    • And more…
  3. Set the number of rows to generate:

    • Global row count for all tables
    • Table-specific row counts
    • Preview sample data before generation

4. Generating Data

  1. Click the “Generate” button
  2. Review the generation summary
  3. Confirm the generation
  4. Wait for the process to complete

5. Exporting Data

  1. Choose your preferred export format:

    • JSON: Standard JSON format with columns and rows
    • JSON (rich): Array of objects with column names as keys
    • CSV: Comma-separated values with headers
    • XML: Structured XML format
    • Plain Text: Human-readable format with numbered rows
    • SQL Inserts: Ready-to-use SQL INSERT statements
  2. Click the “Export” button

  3. Files will be downloaded automatically:

    • One file per table
    • Named according to the table name
    • Appropriate file extension based on format

Best Practices

1. Schema Design

  • Use clear, descriptive table and column names
  • Include appropriate constraints
  • Define foreign key relationships
  • Use appropriate data types

2. Data Generation

  • Start with a small number of rows for testing
  • Use appropriate generators for each column type
  • Consider data relationships when setting up foreign keys
  • Preview data before generating large sets

3. Export Selection

  • Choose JSON for application development
  • Use CSV for spreadsheet applications
  • Select SQL Inserts for direct database population
  • Consider Plain Text for human review

Example Workflow

Scenario: Setting up a Development Environment

  1. Define Schema

    CREATE TABLE products (
        id INT PRIMARY KEY,
        name VARCHAR(100) NOT NULL,
        price DECIMAL(10,2),
        category_id INT,
        created_at DATETIME DEFAULT CURRENT_TIMESTAMP
    );
    
    CREATE TABLE categories (
        id INT PRIMARY KEY,
        name VARCHAR(50) NOT NULL
    );
    
  2. Configure Generators

    • id: Sequential Number
    • name: Product Name
    • price: Random Decimal (10-1000)
    • category_id: Foreign Key to categories
    • created_at: Current Date
  3. Generate Data

    • Set 100 rows for products
    • Set 10 rows for categories
    • Generate and review
  4. Export

    • Choose SQL Inserts format
    • Download and execute in your development database

Tips and Tricks

1. Performance

  • Generate data in smaller batches for large schemas
  • Use appropriate generators for better performance
  • Preview data before large generations

2. Data Quality

  • Use meaningful generators for each column type
  • Consider data relationships
  • Validate generated data before use

3. Export Formats

  • JSON (rich) for application development
  • CSV for data analysis
  • SQL Inserts for database population
  • Plain Text for quick review

Support and Resources

  • Visit datadiluvium.com for the latest version
  • Check the documentation for detailed guides
  • Review sample schemas in the SQL samples section
  • Contact support for questions or feedback

Conclusion

DataDiluvium provides a user-friendly and powerful solution for generating test data from SQL schemas. Whether you’re a developer setting up a new project or a database administrator preparing test environments, DataDiluvium streamlines the process of data generation and helps ensure data quality and consistency.

Coding with AI: A Comparative Series

Hello fellow coders, AI nerdists (ok, IYKYK, “machine learning LLMs nerdists), and language enthusiasts! Adron here, ready to dive into an exciting new series that’s all about pushing the boundaries of our programming prowess. If you’ve followed my work, you know I’m often delving into exploring the depths of code (or systems in general), optimizing it, and sharing those insights with all of you. This time, we’re taking things up a notch by blending the art of manual code slinging and then shifting over and giving the power of artificial intelligence (AI) a try. Ok, my nitpick has already struck. This isn’t really AI but is really just the power of LLMs and machine learning, the ole’ Chat GPT and CoPilot and Claude and whatever else, that I’ll be diving into. Let’s go and put em’ to the test.

The Journey

Our journey starts with tackling programming problems the old-fashioned way: rolling up our sleeves and solving them manually. This is where we lay the groundwork, understand the problem’s intricacies, and come up with a solution that, while not perfect, gets the job done. Then, we refactor our code, streamlining and optimizing it to make it more efficient and elegant.

Enter the AI

Once we’ve got a solid foundation, it’s time to bring in the big guns – artificial intelligence. We’ll explore various AI tools, from ChatGPT-4 to Claude and beyond, to see how they tackle the same problems. Each AI brings its unique approach and strengths to the table, and we’ll break down their solutions, comparing them to our manual efforts.

Why This Matters

In today’s fast-paced tech world, understanding how to leverage AI in our coding practices is crucial. This series isn’t just about showcasing cool AI tools; it’s about understanding their capabilities, limitations, and how they can augment our problem-solving skills. By the end of this journey, you’ll have a deeper appreciation for both human ingenuity and AI’s potential.

What to Expect

In each post, you’ll find:

  • The Hand Crafted Solution: A detailed walkthrough of solving the problem by hand.
  • Refactoring: Steps to optimize and clean up the manual solution.
  • AI Solution: A deep dive into how different AI tools approach the problem.
  • Comparative Analysis: A side-by-side comparison of manual and AI-generated solutions, highlighting strengths, weaknesses, and key takeaways.
  • The links to the code repository and respective before and after of each code base commits.
  • A video walk through of the code and process I went through to get to the solution presented in each video & blog post.
  • A ordered list of the posts as I complete them at the bottom of this post. For starters, as this post has gone live the first post of the series is also live now.

So, get those keyboards and processors ready, grab your favorite code editor, overclock your proc, and join me on this ride through the world of coding with AI. Let’s push the boundaries of what’s possible, one problem at a time.

Stay tuned and happy thrashing coding!

The Ordered List of Coding with AI: A Comparative Series Posts

  1. Finding the Maximum Sum Path in a Binary Tree in C#
  2. C# Array to Phone Number String Conversion & Testing with NUnit
  3. Converting Numbers into Roman Numerals with C#: A Classical Coding Exercise
  4. Simplifying Time: Humanizing Duration in Programming in C#
  5. Conquering the Top Words Challenge in C#: A Tale of Regular Expression and LINQ Magic
  6. How to Convert an IPv4 Address to a 32-bit Integer in C#: A Step-by-Step Guide
  7. Converting 2D Arrays to CSV in Go: Problem-Solving and Testing
  8. Calculating IP Address Ranges in Go: Learn IPv4 Range Between Addresses