Giter Club home page Giter Club logo

dummy-data-generator's Introduction

Fake SQL Generator

公開URL

https://sam-osamu.github.io/dummy-data-generator/

これは?

名前の通り、ダミーデータをInsertするSQL文を作成するツールです。 乱数やランダム文字列だけでなく、架空の人名や住所、電話番号などの それっぽいデータ を作ることが出来ます。

設定値や生成結果(テーブル定義等のDBに関連する情報)は一切サーバーに送信しておらず、
全てクライアント側で処理を行っていますので、安心してお使いいただけると思います。

使い方

下記のような書式に則って記述したJSONをテキストボックスに記述し、Generateボタンを押すと作成できます。

... 設定値の説明とサンプルを展開 ...
  • defaultCount
    必須。数値のみ許容。
    後述のtables内でcountが省かれた際に生成件数として使用される値。
  • locale
    省略可。文字列のみ許容。
    ダミーデータのロケールを設定する。設定できるロケールはFaker.jsのLocalizationに準拠する。
  • tables
    必須。配列のみ許容。
    • name
      必須。文字列のみ許容。
      テーブル名を設定する。
    • count
      省略可。数値のみ許容。
      テーブル単位での生成件数を調節できる。
    • columns
      必須。配列のみ許容。
      • name 必須。文字列のみ許容。
        カラム名を設定する。
      • autoIncrement
        省略可。true/falseのみ設定可。 オートインクリメントによるID自動採番を行うカラムかどうかを設定する。
      • fakeOrder
        省略可。文字列または文字列の配列のみ許容。
        Faker.jsのAPI Methodsに記載されているメソッドをFaker.jsのFaker.fake()の書式で表した文字列を設定する。
        文字列配列にすることで複数設定可能。
      • foreignKey
        省略可。
        値が設定された場合、対象のテーブル・カラムに存在する値をランダムで生成値とする。
        (外部キー制約に抵触しないようにする)
        • table 必須。文字列のみ許容。
          制約先のテーブル名を設定する。
          ここに設定するテーブル名は、このtablesオブジェクトよりも前に定義されている
          tablesオブジェクトである必要がある。
          (ここの定義より後で出てきたtablesオブジェクトが持つテーブル名は使えない)
        • columns 必須。文字列のみ許容。
          制約先のカラム名を設定する。 制限事項は上記のtableと同様。

以下、サンプル。

{
    "defaultCount": 30,
    "tables": [
        {
            "name": "employee_table",
            "count": 5,
            "columns": [
                {
                    "name": "id",
                    "autoIncrement": true
                },
                {
                    "name": "name",
                    "fakerOrder": "name.findName"
                },
                {
                    "name": "zip_code",
                    "fakerOrder": "address.zipCode"
                },
                {
                    "name": "address",
                    "fakerOrder": [
                        "address.state",
                        "address.city",
                        "address.streetAddress",
                        "address.secondaryAddress"
                    ]
                }
            ]
        },
        {
            "name": "employee_comments_table",
            "count": 100,
            "columns": [
                {
                    "name": "id",
                    "autoIncrement": true
                },
                {
                    "name": "main_id",
                    "foreignKey": {
                        "table": "employee_table",
                        "column": "id"
                    }
                }
            ]
        }
    ]
}

謝辞

Faker.jsを始めとした、さまざまなOSSプロジェクトのおかげで形にすることが出来ました。
この場を借りて、コントリビューター諸氏に心より感謝申し上げます。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.