├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── cmd ├── generate.go ├── generateWithLlm.go ├── root.go ├── runScenario.go └── runTest.go ├── go.mod ├── go.sum ├── main.go ├── pkg ├── config │ ├── connection.go │ ├── generate_with_llm.go │ ├── generate_with_llm_test.go │ ├── generation.go │ ├── generation_test.go │ ├── scenario.go │ └── simple_config.go ├── generate │ ├── fields.go │ ├── schema.go │ └── social_media.go ├── generatewithllm │ └── knownschema.go ├── namesgenerator │ └── namesgenerator.go ├── openai │ ├── query.go │ └── query_test.go ├── runner │ └── runner.go └── utils │ └── random.go └── samples ├── mysql └── README.md └── postgres └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.yaml 2 | .idea/* 3 | *.iml 4 | bin/* -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Adaptive Automation Technologies, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | BINARY_NAME=dbchaos 2 | setup: 3 | go mod tidy 4 | rm -rf bin 5 | mkdir -p bin 6 | build: setup 7 | go build -o bin/$(BINARY_NAME) . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DBChaos 2 | 3 | Stress-test your database with pre-defined queries, generate synthetic data in your database. Validate slow and expensive queries that breaks your database. 4 | 5 | Use GPT to generate synthetic data for you database. 6 | 7 | ### Features 8 | - Synthetic Event Generation 9 | - Synthentic Data Generation 10 | 11 | ### Installation 12 | 13 | ```shell 14 | go install github.com/adaptive-scale/dbchaos@v0.4.4 15 | ``` 16 | 17 | ### Supported Databases 18 | 19 | | Database | Synthetic Event Generation | Synthetic Data Generation | 20 | | ------------- | -----------------------|-------------------------------| 21 | | Postgres | ✅ | ✅ | 22 | | MySQL | ✅ | ✅ | 23 | | SQL Server | ✅ | ✅ | 24 | | MongoDB | ✅ | ⛔ | 25 | 26 | ### Synthetic Event Generation 27 | With DBChaos, you can run parallel queries on your target database. There two ways you could do that - test and scenarios. 28 | 29 | With test, you can run single query on your target database. It would run the query parallely for the given amount of time. With Scenario, you could run multiple queries with different timeout and rates creating diverse load patterns. 30 | 31 | We are planning to add more features around creating various load patterns. 32 | 33 | #### Run your first test 34 | 35 | Create a file named `config.yaml` with the following content: 36 | ```yaml 37 | dbType: postgres 38 | connection: "host=localhost port=5432 user=postgres password=postgres dbname=postgres sslmode=disable" 39 | query: | 40 | SELECT pg_database.datname as "Database", pg_size_pretty(pg_database_size(pg_database.datname)) as "Size" 41 | FROM pg_database; 42 | parallelRuns: 100 43 | runFor: 30m 44 | ``` 45 | 46 | For MongoDB, the connection string should be in the following format: 47 | ```yaml 48 | dbType: mongodb 49 | connection: "mongodb://root:example@localhost:27017/" 50 | query: | 51 | {"insert": "users", "documents": [{ "user": "abc123", "status": "A" }]} 52 | parallelRuns: 100 53 | runFor: 30m 54 | dbName: users 55 | ``` 56 | 57 | To run the above config file: 58 | 59 | ```shell 60 | dbchaos runTest 61 | ``` 62 | 63 | #### Run bunch of queries in parallel 64 | 65 | Create a file called `scenario.yaml` with the following content: 66 | 67 | ```yaml 68 | dbType: mysql 69 | connection: "root:root@tcp(host:port)/db" 70 | scenarios: 71 | - query: select * from information_schema.statistics 72 | parallelRuns: 10000 73 | runFor: 15m 74 | - query: | 75 | SELECT table_schema "Database", ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) "Size (MB)" 76 | FROM information_schema.tables 77 | GROUP BY table_schema; 78 | parallelRuns: 10000 79 | runFor: 15m 80 | ``` 81 | 82 | To run the above scenario file: 83 | 84 | ```shell 85 | dbchaos runScenario 86 | ``` 87 | 88 | For MongoDB Specific, an example `scenario.yaml` file would look as follows : 89 | ```yaml 90 | dbType: mongodb 91 | connection: "mongodb://root:example@localhost:27017/" 92 | scenarios: 93 | - query: '{"insert": "users", "documents": [{ "user": "abc123", "status": "A" }]}' 94 | parallelRuns: 10000 95 | runFor: 15m 96 | dbName: users #(MongoDB only) 97 | ``` 98 | 99 | ### Synthetic Data Generation 100 | DBChaos can generate full schema and synthetic data for your database. In DBChaos, there are two kinds of data generation techniques - Static and GPT-based. 101 | 102 | In static data generation, dbchaos randomly generates schema, schema name, column names and data. It comes very handy and is inexpensive if you want to create huge schemas and generate large amount data. For instance, At [Adaptive](https://adaptive.live) we use this is create unrealistic sized databases and schema to load testing our services and processes. 103 | 104 | In GPT based data generation, you can create hyper-realistic databases and data. However, you would need an API key from OPENAI as well as it will cost you credits if you which to generate huge amount to data. We have tried to build a known schema cache in the product, which we will keep improving as well built out more features. 105 | 106 | #### Static Data Generation 107 | 108 | A configuration for static generation looks as follows: 109 | ```yaml 110 | connection: 111 | dbType: postgres 112 | connection: "host=localhost port=5432 user=postgres password=postgres dbname=postgres sslmode=disable" 113 | dryRun: false 114 | schema: 115 | numberOfSchema: 10 116 | generateTables: true 117 | language: en 118 | tables: 119 | numberOfTables: 10 120 | minColumns: 5 121 | maxColumns: 10 122 | populateTable: true 123 | rows: 124 | minRows: 100 125 | maxRows: 1000 126 | ``` 127 | 128 | Save above config as `config.yaml` and run the following command: 129 | ```shell 130 | dbchaos generate 131 | ``` 132 | 133 | #### GPT-based Synthetic Data Generation 134 | 135 | Configuration for GPT-based synthetic data looks as follows: 136 | 137 | ```yaml 138 | connection: 139 | dbType: postgres 140 | connection: "host=localhost port=5432 user=postgres password=postgres dbname=postgres sslmode=disable" 141 | dryRun: false 142 | provider: openai 143 | model: gpt-3.5-turbo 144 | schema_type: webshop # can be anything word like ecommerce, webshop, hospital etc 145 | ``` 146 | 147 | You have to set your OpenAI API key as an environment variable `OPENAI_API_KEY`. 148 | 149 | Save above config as `config.yaml` and run the following command: 150 | ```shell 151 | dbchaos generateWithLLM 152 | ``` 153 | 154 | This will generate the schemas, insert commands and persist it in the database. 155 | -------------------------------------------------------------------------------- /cmd/generate.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2024 NAME HERE 3 | */ 4 | package cmd 5 | 6 | import ( 7 | "github.com/adaptive-scale/dbchaos/pkg/config" 8 | "github.com/spf13/cobra" 9 | "gopkg.in/yaml.v3" 10 | "log" 11 | "os" 12 | ) 13 | 14 | // generateCmd represents the generate command 15 | var generateCmd = &cobra.Command{ 16 | Use: "generate", 17 | Short: "generates synthetic data for generating schema, tables and data", 18 | Long: `generates synthetic data for generating schema, tables and dat`, 19 | Run: func(cmd *cobra.Command, args []string) { 20 | 21 | configFile, _ := cmd.Flags().GetString("config") 22 | 23 | d, err := os.ReadFile(configFile) 24 | if err != nil { 25 | log.Fatal(err) 26 | } 27 | 28 | var schemaConfig config.SchemaGeneration 29 | if err := yaml.Unmarshal(d, &schemaConfig); err != nil { 30 | log.Fatal("invalid schema configuration -", err) 31 | } 32 | err = schemaConfig.GenerateSchema() 33 | if err != nil { 34 | log.Fatal(err) 35 | } 36 | }, 37 | } 38 | 39 | func init() { 40 | rootCmd.AddCommand(generateCmd) 41 | 42 | // Here you will define your flags and configuration settings. 43 | 44 | // Cobra supports Persistent Flags which will work for this command 45 | // and all subcommands, e.g.: 46 | // generateCmd.PersistentFlags().String("foo", "", "A help for foo") 47 | 48 | // Cobra supports local flags which will only run when this command 49 | // is called directly, e.g.: 50 | // generateCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") 51 | 52 | generateCmd.Flags().String("config", "config.yaml", "config file (default is config.yaml)") 53 | } 54 | -------------------------------------------------------------------------------- /cmd/generateWithLlm.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2024 NAME HERE 3 | */ 4 | package cmd 5 | 6 | import ( 7 | "github.com/adaptive-scale/dbchaos/pkg/config" 8 | "github.com/spf13/cobra" 9 | "gopkg.in/yaml.v3" 10 | "log" 11 | "os" 12 | ) 13 | 14 | // generateWithLlmCmd represents the generateWithLlm command 15 | var generateWithLlmCmd = &cobra.Command{ 16 | Use: "generateWithLLM", 17 | Short: "A brief description of your command", 18 | Long: `A longer description that spans multiple lines and likely contains examples 19 | and usage of using your command. For example: 20 | 21 | Cobra is a CLI library for Go that empowers applications. 22 | This application is a tool to generate the needed files 23 | to quickly create a Cobra application.`, 24 | Run: func(cmd *cobra.Command, args []string) { 25 | 26 | configFile, _ := cmd.Flags().GetString("config") 27 | 28 | d, err := os.ReadFile(configFile) 29 | if err != nil { 30 | log.Fatal(err) 31 | } 32 | 33 | var schemaConfig config.SchemaGenerationWithLLM 34 | if err := yaml.Unmarshal(d, &schemaConfig); err != nil { 35 | log.Fatal("invalid schema configuration -", err) 36 | } 37 | 38 | apiKey := os.Getenv("OPENAI_API_KEY") 39 | 40 | if apiKey == "" { 41 | log.Fatal("Please set OPENAI_API_KEY environment variable") 42 | } 43 | 44 | err = schemaConfig.GenerateSchema(apiKey) 45 | if err != nil { 46 | log.Fatal(err) 47 | } 48 | }, 49 | } 50 | 51 | func init() { 52 | rootCmd.AddCommand(generateWithLlmCmd) 53 | 54 | generateWithLlmCmd.Flags().String("config", "config.yaml", "config file (default is config.yaml)") 55 | 56 | // Here you will define your flags and configuration settings. 57 | 58 | // Cobra supports Persistent Flags which will work for this command 59 | // and all subcommands, e.g.: 60 | // generateWithLlmCmd.PersistentFlags().String("foo", "", "A help for foo") 61 | 62 | // Cobra supports local flags which will only run when this command 63 | // is called directly, e.g.: 64 | // generateWithLlmCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") 65 | } 66 | -------------------------------------------------------------------------------- /cmd/root.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2023 Debarshi Basak 3 | */ 4 | package cmd 5 | 6 | import ( 7 | "os" 8 | 9 | "github.com/spf13/cobra" 10 | ) 11 | 12 | const VERSION = "v0.4.4" 13 | 14 | // rootCmd represents the base command when called without any subcommands 15 | var rootCmd = &cobra.Command{ 16 | Use: "dbchaos", 17 | Short: "DBChaos allows users to run queries in parallel on the database", 18 | Long: `DBChaos (` + VERSION + `) allows users to run queries in parallel on the database. 19 | dbchaos -h for help 20 | `, 21 | // Uncomment the following line if your bare application 22 | // has an action associated with it: 23 | Run: func(cmd *cobra.Command, args []string) { 24 | cmd.Help() 25 | }, 26 | } 27 | 28 | // Execute adds all child commands to the root command and sets flags appropriately. 29 | // This is called by main.main(). It only needs to happen once to the rootCmd. 30 | func Execute() { 31 | err := rootCmd.Execute() 32 | if err != nil { 33 | os.Exit(1) 34 | } 35 | } 36 | 37 | func init() { 38 | // Here you will define your flags and configuration settings. 39 | // Cobra supports persistent flags, which, if defined here, 40 | // will be global for your application. 41 | 42 | // rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.bamsql.yaml)") 43 | 44 | // Cobra also supports local flags, which will only run 45 | // when this action is called directly. 46 | rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") 47 | } 48 | -------------------------------------------------------------------------------- /cmd/runScenario.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2023 Debarshi Basak 3 | */ 4 | package cmd 5 | 6 | import ( 7 | "fmt" 8 | "log" 9 | "os" 10 | 11 | "github.com/adaptive-scale/dbchaos/pkg/config" 12 | "github.com/spf13/cobra" 13 | ) 14 | 15 | // runScenarioCmd represents the runScenario command 16 | var runScenarioCmd = &cobra.Command{ 17 | Use: "runScenario", 18 | Short: "Execute a scenario", 19 | Long: `Execute a scenario. 20 | A scenario is a collection of tests that can be run in parallel. 21 | 22 | Create a file called scenario.yaml with the following content: 23 | 24 | dbType: mysql 25 | connection: "root:root@tcp(host:port)/db" 26 | scenarios: 27 | - query: select * from information_schema.statistics # (for MongoDB, query must be valid JSON ex: '{"insert": "users", "documents": [{ "user": "abc123", "status": "A" }]}') 28 | parallelRuns: 10000 29 | runFor: 15m 30 | - query: | 31 | SELECT table_schema "Database", 32 | ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) "Size (MB)" 33 | FROM information_schema.tables 34 | GROUP BY table_schema; 35 | parallelRuns: 10000 36 | runFor: 15m 37 | dbName: users #(MongoDB only) 38 | 39 | Run as follows: 40 | dbchaos runScenario 41 | `, 42 | Run: func(cmd *cobra.Command, args []string) { 43 | file, err := cmd.Flags().GetString("file") 44 | if err != nil { 45 | fmt.Println(err) 46 | os.Exit(1) 47 | } 48 | var d []byte 49 | if file != "" { 50 | d, err = os.ReadFile(file) 51 | if err != nil { 52 | log.Fatal(err) 53 | } 54 | } else { 55 | d, err = os.ReadFile("./scenario.yaml") 56 | if err != nil { 57 | log.Fatal(err) 58 | } 59 | } 60 | s1 := config.ParseScenario(d) 61 | s1.Start() 62 | }, 63 | } 64 | 65 | func init() { 66 | runScenarioCmd.PersistentFlags().String("file", "scenario.yaml", "Scenario yaml file to use") 67 | rootCmd.AddCommand(runScenarioCmd) 68 | 69 | // Here you will define your flags and configuration settings. 70 | 71 | // Cobra supports Persistent Flags which will work for this command 72 | // and all subcommands, e.g.: 73 | // runScenarioCmd.PersistentFlags().String("foo", "", "A help for foo") 74 | 75 | // Cobra supports local flags which will only run when this command 76 | // is called directly, e.g.: 77 | // runScenarioCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") 78 | } 79 | -------------------------------------------------------------------------------- /cmd/runTest.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright © 2023 Debarshi Basak 3 | */ 4 | package cmd 5 | 6 | import ( 7 | "fmt" 8 | "log" 9 | "os" 10 | 11 | "github.com/adaptive-scale/dbchaos/pkg/config" 12 | "github.com/spf13/cobra" 13 | ) 14 | 15 | // runTestCmd represents the runTest command 16 | var runTestCmd = &cobra.Command{ 17 | Use: "runTest", 18 | Short: "Execute a test on DB", 19 | Long: `Execute a test on DB. 20 | 21 | Create a file name config.yaml with the following content: 22 | 23 | dbType: postgres 24 | dbName: some_database #(NoSQL Databases Only) 25 | connection: "host=localhost port=5432 user=postgres password=postgres dbname=postgres sslmode=disable" 26 | query: | 27 | SELECT pg_database.datname as "Database", pg_size_pretty(pg_database_size(pg_database.datname)) as "Size" 28 | FROM pg_database; # For MongoDB provide JSON string: '{"$and": [{"rating": {"$gt": 7}}, {"rating": {"$lte", 10}]}' # (for MongoDB query must be valid JSON ex: '{"insert": "users", "documents": [{ "user": "abc123", "status": "A" }]}') 29 | parallelRuns: 100 30 | runFor: 30m 31 | 32 | To run the above config file: 33 | 34 | dbchaos runTest config.yaml 35 | 36 | `, 37 | Run: func(cmd *cobra.Command, args []string) { 38 | file, err := cmd.Flags().GetString("file") 39 | if err != nil { 40 | fmt.Println(err) 41 | os.Exit(1) 42 | } 43 | var d []byte 44 | if file != "" { 45 | d, err = os.ReadFile(file) 46 | if err != nil { 47 | log.Fatal(err) 48 | } 49 | } else { 50 | d, err = os.ReadFile("./config.yaml") 51 | if err != nil { 52 | log.Fatal(err) 53 | } 54 | } 55 | s1 := config.ParseConfiguration(d) 56 | err = s1.Start() 57 | if err != nil { 58 | log.Fatal(err) 59 | } 60 | }, 61 | } 62 | 63 | func init() { 64 | runTestCmd.PersistentFlags().String("file", "config.yaml", "Config yaml file to use") 65 | 66 | rootCmd.AddCommand(runTestCmd) 67 | 68 | // Here you will define your flags and configuration settings. 69 | 70 | // Cobra supports Persistent Flags which will work for this command 71 | // and all subcommands, e.g.: 72 | // runTestCmd.PersistentFlags().String("foo", "", "A help for foo") 73 | 74 | // Cobra supports local flags which will only run when this command 75 | // is called directly, e.g.: 76 | // runTestCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") 77 | } 78 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/adaptive-scale/dbchaos 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/adaptive-scale/funktors v0.0.7 7 | github.com/google/uuid v1.3.0 8 | github.com/sashabaranov/go-openai v1.20.0 9 | github.com/spf13/cobra v1.8.0 10 | gopkg.in/yaml.v3 v3.0.1 11 | gorm.io/driver/mysql v1.5.2 12 | gorm.io/driver/postgres v1.5.4 13 | gorm.io/driver/sqlserver v1.5.2 14 | gorm.io/gorm v1.25.5 15 | ) 16 | 17 | require ( 18 | github.com/golang/snappy v0.0.1 // indirect 19 | github.com/klauspost/compress v1.13.6 // indirect 20 | github.com/montanaflynn/stats v0.7.0 // indirect 21 | github.com/xdg-go/pbkdf2 v1.0.0 // indirect 22 | github.com/xdg-go/scram v1.1.2 // indirect 23 | github.com/xdg-go/stringprep v1.0.4 // indirect 24 | github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect 25 | golang.org/x/sync v0.1.0 // indirect 26 | ) 27 | 28 | require ( 29 | github.com/go-sql-driver/mysql v1.7.0 // indirect 30 | github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect 31 | github.com/golang-sql/sqlexp v0.1.0 // indirect 32 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 33 | github.com/jackc/pgpassfile v1.0.0 // indirect 34 | github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect 35 | github.com/jackc/pgx/v5 v5.4.3 // indirect 36 | github.com/jinzhu/inflection v1.0.0 // indirect 37 | github.com/jinzhu/now v1.1.5 // indirect 38 | github.com/kr/text v0.2.0 // indirect 39 | github.com/microsoft/go-mssqldb v1.6.0 // indirect 40 | github.com/rogpeppe/go-internal v1.12.0 // indirect 41 | github.com/spf13/pflag v1.0.5 // indirect 42 | go.mongodb.org/mongo-driver v1.13.1 43 | golang.org/x/crypto v0.17.0 // indirect 44 | golang.org/x/text v0.14.0 // indirect 45 | ) 46 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= 2 | github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= 3 | github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= 4 | github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1 h1:/iHxaJhsFr0+xVFfbMr5vxz848jyiWuIEDhYq3y5odY= 5 | github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= 6 | github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= 7 | github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= 8 | github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= 9 | github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= 10 | github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= 11 | github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= 12 | github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.0 h1:yfJe15aSwEQ6Oo6J+gdfdulPNoZ3TEhmbhLIoxZcA+U= 13 | github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.0/go.mod h1:Q28U+75mpCaSCDowNEmhIo/rmgdkqmkmzI7N6TGR4UY= 14 | github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v0.8.0 h1:T028gtTPiYt/RMUfs8nVsAL7FDQrfLlrm/NnRG/zcC4= 15 | github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v0.8.0/go.mod h1:cw4zVQgBby0Z5f2v0itn6se2dDP17nTjbZFXW5uPyHA= 16 | github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= 17 | github.com/AzureAD/microsoft-authentication-library-for-go v1.1.0 h1:HCc0+LpPfpCKs6LGGLAhwBARt9632unrVcI6i8s/8os= 18 | github.com/AzureAD/microsoft-authentication-library-for-go v1.1.0/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= 19 | github.com/adaptive-scale/funktors v0.0.7 h1:sEhTgDGND0uUel3uDdFedncuw+jXozflaPDn9hEJvWk= 20 | github.com/adaptive-scale/funktors v0.0.7/go.mod h1:oQYTTA/xXgI46kRxywpvxfGhCdqWduJbd46AhMxWBGs= 21 | github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 22 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 23 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 24 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 25 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 26 | github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= 27 | github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= 28 | github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= 29 | github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= 30 | github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= 31 | github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= 32 | github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= 33 | github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= 34 | github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA= 35 | github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= 36 | github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= 37 | github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= 38 | github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= 39 | github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 40 | github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= 41 | github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 42 | github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= 43 | github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 44 | github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= 45 | github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= 46 | github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 47 | github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 48 | github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= 49 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 50 | github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= 51 | github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= 52 | github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= 53 | github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= 54 | github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= 55 | github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= 56 | github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs= 57 | github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM= 58 | github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo= 59 | github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg= 60 | github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod h1:1btQEpgT6k+unzCwX1KdWMEwPPkkgBtP+F6aCACiMrs= 61 | github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= 62 | github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= 63 | github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= 64 | github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= 65 | github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= 66 | github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= 67 | github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= 68 | github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= 69 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 70 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 71 | github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= 72 | github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 73 | github.com/microsoft/go-mssqldb v1.6.0 h1:mM3gYdVwEPFrlg/Dvr2DNVEgYFG7L42l+dGc67NNNpc= 74 | github.com/microsoft/go-mssqldb v1.6.0/go.mod h1:00mDtPbeQCRGC1HwOOR5K/gr30P1NcEG0vx6Kbv2aJU= 75 | github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= 76 | github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= 77 | github.com/montanaflynn/stats v0.7.0 h1:r3y12KyNxj/Sb/iOE46ws+3mS1+MZca1wlHQFPsY/JU= 78 | github.com/montanaflynn/stats v0.7.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= 79 | github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= 80 | github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= 81 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 82 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 83 | github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= 84 | github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= 85 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 86 | github.com/sashabaranov/go-openai v1.20.0 h1:r9WiwJY6Q2aPDhVyfOSKm83Gs04ogN1yaaBoQOnusS4= 87 | github.com/sashabaranov/go-openai v1.20.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= 88 | github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= 89 | github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= 90 | github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= 91 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 92 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 93 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 94 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 95 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 96 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 97 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 98 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 99 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 100 | github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 101 | github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 102 | github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= 103 | github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= 104 | github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= 105 | github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= 106 | github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= 107 | github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= 108 | github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8= 109 | github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= 110 | github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= 111 | github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= 112 | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= 113 | go.mongodb.org/mongo-driver v1.13.1 h1:YIc7HTYsKndGK4RFzJ3covLz1byri52x0IoMB0Pt/vk= 114 | go.mongodb.org/mongo-driver v1.13.1/go.mod h1:wcDf1JBCXy2mOW0bWHwO/IOYqdca1MPCwDtFu/Z9+eo= 115 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 116 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 117 | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 118 | golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 119 | golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= 120 | golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= 121 | golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= 122 | golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= 123 | golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= 124 | golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= 125 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= 126 | golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 127 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 128 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 129 | golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 130 | golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 131 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 132 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 133 | golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 134 | golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= 135 | golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= 136 | golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= 137 | golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= 138 | golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= 139 | golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= 140 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 141 | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 142 | golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= 143 | golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 144 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 145 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 146 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 147 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 148 | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 149 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 150 | golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 151 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 152 | golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 153 | golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 154 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 155 | golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 156 | golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 157 | golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= 158 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 159 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 160 | golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= 161 | golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= 162 | golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= 163 | golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= 164 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 165 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 166 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 167 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 168 | golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= 169 | golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 170 | golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= 171 | golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= 172 | golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= 173 | golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= 174 | golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= 175 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 176 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 177 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= 178 | golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= 179 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 180 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 181 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 182 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 183 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 184 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 185 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 186 | gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 187 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 188 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 189 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 190 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 191 | gorm.io/driver/mysql v1.5.2 h1:QC2HRskSE75wBuOxe0+iCkyJZ+RqpudsQtqkp+IMuXs= 192 | gorm.io/driver/mysql v1.5.2/go.mod h1:pQLhh1Ut/WUAySdTHwBpBv6+JKcj+ua4ZFx1QQTBzb8= 193 | gorm.io/driver/postgres v1.5.4 h1:Iyrp9Meh3GmbSuyIAGyjkN+n9K+GHX9b9MqsTL4EJCo= 194 | gorm.io/driver/postgres v1.5.4/go.mod h1:Bgo89+h0CRcdA33Y6frlaHHVuTdOf87pmyzwW9C/BH0= 195 | gorm.io/driver/sqlserver v1.5.2 h1:+o4RQ8w1ohPbADhFqDxeeZnSWjwOcBnxBckjTbcP4wk= 196 | gorm.io/driver/sqlserver v1.5.2/go.mod h1:gaKF0MO0cfTq9Q3/XhkowSw4g6nIwHPGAs4hzKCmvBo= 197 | gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= 198 | gorm.io/gorm v1.25.2-0.20230610234218-206613868439/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= 199 | gorm.io/gorm v1.25.5 h1:zR9lOiiYf09VNh5Q1gphfyia1JpiClIWG9hQaxB/mls= 200 | gorm.io/gorm v1.25.5/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= 201 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/adaptive-scale/dbchaos/cmd" 4 | 5 | func main() { 6 | cmd.Execute() 7 | } 8 | -------------------------------------------------------------------------------- /pkg/config/connection.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "errors" 5 | "gorm.io/driver/mysql" 6 | "gorm.io/driver/postgres" 7 | "gorm.io/driver/sqlserver" 8 | "gorm.io/gorm" 9 | "time" 10 | ) 11 | 12 | type Connection struct { 13 | DbType string `json:"db_type,omitempty" yaml:"dbType,omitempty"` 14 | ConnectionString string `json:"connection_string,omitempty" yaml:"connection,omitempty"` 15 | DbName string `json:"db_name,omitempty" yaml:"dbName,omitempty"` 16 | } 17 | 18 | func (s Connection) NewClient() (*gorm.DB, error) { 19 | 20 | var d *gorm.DB 21 | var err error 22 | 23 | switch s.DbType { 24 | case MySQL: 25 | { 26 | d, err = gorm.Open(mysql.Open(s.ConnectionString), &gorm.Config{}) 27 | if err != nil { 28 | return nil, err 29 | } 30 | sqlDB, _ := d.DB() 31 | 32 | sqlDB.SetMaxIdleConns(10) 33 | sqlDB.SetMaxOpenConns(100) 34 | sqlDB.SetConnMaxLifetime(time.Hour) 35 | 36 | return d, nil 37 | 38 | } 39 | case Postgres: 40 | { 41 | d, err = gorm.Open(postgres.Open(s.ConnectionString), &gorm.Config{}) 42 | if err != nil { 43 | return nil, err 44 | } 45 | sqlDB, _ := d.DB() 46 | 47 | sqlDB.SetMaxIdleConns(10) 48 | sqlDB.SetMaxOpenConns(100) 49 | sqlDB.SetConnMaxLifetime(time.Hour) 50 | 51 | return d, nil 52 | 53 | } 54 | case SQLServer, "mssql": 55 | { 56 | d, err = gorm.Open(sqlserver.Open(s.ConnectionString), &gorm.Config{}) 57 | if err != nil { 58 | return nil, err 59 | } 60 | sqlDB, _ := d.DB() 61 | 62 | sqlDB.SetMaxIdleConns(10) 63 | sqlDB.SetMaxOpenConns(100) 64 | sqlDB.SetConnMaxLifetime(time.Hour) 65 | 66 | return d, nil 67 | } 68 | default: 69 | { 70 | return nil, errors.New("db is not supported") 71 | } 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /pkg/config/generate_with_llm.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "github.com/adaptive-scale/dbchaos/pkg/generatewithllm" 7 | openai_dbchaos "github.com/adaptive-scale/dbchaos/pkg/openai" 8 | "log" 9 | "os" 10 | "strings" 11 | "time" 12 | ) 13 | 14 | type SchemaGenerationWithLLM struct { 15 | Connection Connection `yaml:"connection,omitempty"` 16 | Provider string `yaml:"provider,omitempty"` 17 | Model string `yaml:"model,omitempty"` 18 | SchemaType string `yaml:"schema_type,omitempty"` 19 | InsertIterations int `yaml:"insert_iterations,omitempty"` 20 | DryRun bool `yaml:"dry_run,omitempty"` 21 | PersistSchema string `yaml:"persist_schema,omitempty"` 22 | } 23 | 24 | const ( 25 | PromptTemplateForGenerateSchema = "Generate Schema in SQL for %v database. Give me only SQL Commands No text. Make tables with foreign key references are at the end." 26 | PromptTemplateForInsertData = "Also generate the 100 SQL commands insert randomized data into the %v. Give me only SQL Commands No text." 27 | ) 28 | 29 | func (s *SchemaGenerationWithLLM) GenerateSchema(apiToken string) error { 30 | 31 | totalWords := strings.Split(s.SchemaType, " ") 32 | if len(totalWords) > 1 { 33 | return errors.New("schema type can only be one word") 34 | } 35 | 36 | log.Println("starting schema generation with LLM") 37 | 38 | switch s.Provider { 39 | case "openai": 40 | return s.generateDataWithOpenAI(apiToken) 41 | case "llama-7b": 42 | return errors.New("llama-7b is not supported") 43 | case "Mixtral-8x7B": 44 | return errors.New("Mixtral-8x7B is not supported") 45 | default: 46 | return s.generateDataWithOpenAI(apiToken) 47 | } 48 | } 49 | 50 | func (s *SchemaGenerationWithLLM) generateDataWithOpenAI(apiToken string) error { 51 | o := openai_dbchaos.OpenAI{ 52 | Model: s.Model, 53 | APIkey: apiToken, 54 | } 55 | 56 | log.Println("generating schema") 57 | 58 | schemaValue := generatewithllm.KnownSchema[strings.ToLower(s.SchemaType)] 59 | 60 | if schemaValue == "" { 61 | v, err := o.Prompt(fmt.Sprintf(PromptTemplateForGenerateSchema, s.SchemaType)) 62 | if err != nil { 63 | return err 64 | } 65 | schemaValue = v 66 | } 67 | 68 | var dataVal string 69 | 70 | if s.InsertIterations == 0 { 71 | s.InsertIterations = 1 72 | } 73 | 74 | log.Println("generating data") 75 | 76 | for i := 0; i < s.InsertIterations; i++ { 77 | // Insert data 78 | data, err := o.Prompt(fmt.Sprintf(PromptTemplateForInsertData, schemaValue)) 79 | if err != nil { 80 | return err 81 | } 82 | dataVal = dataVal + "\n--insert data\n" + data 83 | 84 | time.Sleep(1 * time.Second) 85 | } 86 | 87 | queries := schemaValue + "\n--insert data\n" + dataVal 88 | 89 | if s.PersistSchema != "" { 90 | 91 | log.Println("saving commands to file to " + s.PersistSchema) 92 | 93 | err := os.WriteFile(s.PersistSchema, []byte(queries), 0644) 94 | if err != nil { 95 | return err 96 | } 97 | } 98 | 99 | if s.DryRun { 100 | fmt.Println(queries) 101 | } else { 102 | d, err := s.Connection.NewClient() 103 | if err != nil { 104 | return err 105 | } 106 | 107 | log.Println("executing commands") 108 | 109 | fmt.Println(queries) 110 | 111 | if err := d.Exec(queries).Error; err != nil { 112 | return err 113 | } 114 | } 115 | 116 | return nil 117 | } 118 | -------------------------------------------------------------------------------- /pkg/config/generate_with_llm_test.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import "testing" 4 | 5 | func TestGenerateWithLLM(t *testing.T) { 6 | 7 | var s SchemaGenerationWithLLM 8 | 9 | s.Connection.DbType = "postgres" 10 | s.Connection.DbName = "test-sql" 11 | s.Connection.ConnectionString = `host=localhost user=postgres password=mysecretpassword dbname=test_generation port=5432 sslmode=disable` 12 | 13 | s.Provider = "openai" 14 | s.Model = "gpt-3.5-turbo" 15 | s.SchemaType = "Webshop" 16 | 17 | s.InsertIterations = 1 18 | 19 | if err := s.GenerateSchema(""); err != nil { 20 | t.Errorf("Error: %v", err) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pkg/config/generation.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "fmt" 5 | "github.com/adaptive-scale/dbchaos/pkg/namesgenerator" 6 | "github.com/adaptive-scale/dbchaos/pkg/utils" 7 | funktors "github.com/adaptive-scale/funktors" 8 | "log" 9 | "math/rand" 10 | "strconv" 11 | "strings" 12 | "time" 13 | ) 14 | 15 | type SchemaGeneration struct { 16 | // Name of the generation 17 | Connection Connection `json:"connection,omitempty" yaml:"connection,omitempty"` 18 | Schema StaticSchemaGeneration `json:"schema,omitempty" yaml:"schema,omitempty"` 19 | DryRun bool `json:"dry_run,omitempty" yaml:"dryRun,omitempty"` 20 | Tables TableGeneration `json:"tables,omitempty" yaml:"tables,omitempty"` 21 | Rows DataGeneration `json:"rows,omitempty" yaml:"rows,omitempty"` 22 | } 23 | 24 | type StaticSchemaGeneration struct { 25 | NumberOfSchema int `json:"number_of_schema,omitempty" yaml:"numberOfSchema,omitempty"` 26 | GenerateTables bool `json:"generate_tables,omitempty" yaml:"generateTables,omitempty"` 27 | Language string `json:"language,omitempty" yaml:"language,omitempty"` 28 | SchemaName string `json:"schema_name,omitempty" yaml:"schemaName,omitempty"` 29 | DryRun bool `json:"dry_run,omitempty" yaml:"dryRun,omitempty"` 30 | } 31 | 32 | type internalTable struct { 33 | TableName string 34 | Fields []Field 35 | } 36 | 37 | func (i internalTable) String(n int) string { 38 | 39 | fields := funktors.Map(i.Fields, func(i int, f Field) string { 40 | return f.Name 41 | }) 42 | 43 | f := "INSERT INTO " + i.TableName + " (" + strings.Join(fields, ",") + ") VALUES " 44 | 45 | inserts := []string{} 46 | for iv := 0; iv < n; iv++ { 47 | rows := funktors.Map(i.Fields, func(i int, f Field) string { 48 | return f.Type.value() 49 | }) 50 | 51 | inserts = append(inserts, "("+strings.Join(rows, ",")+")") 52 | } 53 | 54 | return f + strings.Join(inserts, ",") 55 | } 56 | 57 | type Field struct { 58 | Name string 59 | Type TypeInterface 60 | } 61 | 62 | type TypeInterface interface { 63 | name() string 64 | value() string 65 | } 66 | 67 | type intval struct{} 68 | 69 | func (i intval) name() string { 70 | return "int" 71 | } 72 | 73 | func (i intval) value() string { 74 | rand.Seed(time.Now().UnixNano()) 75 | randomNumber := rand.Intn(19) 76 | return strconv.Itoa(randomNumber) 77 | } 78 | 79 | type floatval struct{} 80 | 81 | func (f floatval) name() string { 82 | return "float" 83 | } 84 | 85 | func randFloats(min, max float64, n int) []float64 { 86 | res := make([]float64, n) 87 | for i := range res { 88 | res[i] = min + rand.Float64()*(max-min) 89 | } 90 | return res 91 | } 92 | 93 | func (f floatval) value() string { 94 | rand.Seed(time.Now().UnixNano()) 95 | return strconv.FormatFloat(rand.Float64(), 'f', -1, 64) 96 | } 97 | 98 | type textval struct{} 99 | 100 | func (t textval) name() string { 101 | return "TEXT" 102 | } 103 | 104 | func (t textval) value() string { 105 | return `'` + utils.RandomString(utils.CharsetAlphabet, 10) + `'` 106 | } 107 | 108 | type varchar struct{} 109 | 110 | func (v varchar) name() string { 111 | return "VARCHAR(255)" 112 | } 113 | 114 | func (v varchar) value() string { 115 | return `'` + utils.RandomString(utils.CharsetAlphabet, 10) + `'` 116 | } 117 | 118 | func randomizeType() TypeInterface { 119 | rand.Seed(time.Now().UnixNano()) 120 | randomNumber := rand.Intn(3) 121 | switch randomNumber { 122 | case 0: 123 | return intval{} 124 | case 1: 125 | return floatval{} 126 | case 2: 127 | return textval{} 128 | case 3: 129 | return varchar{} 130 | default: 131 | return intval{} 132 | } 133 | } 134 | 135 | type SchemaName struct { 136 | Name string 137 | } 138 | 139 | func (s *SchemaName) String() string { 140 | return s.Name 141 | } 142 | 143 | func (s *SchemaName) Create() string { 144 | return "CREATE SCHEMA " + s.Name 145 | } 146 | 147 | func (g SchemaGeneration) GenerateSchema() error { 148 | 149 | totalSchema := g.Schema.NumberOfSchema 150 | var schemas []SchemaName 151 | 152 | for i := 0; i < totalSchema; i++ { 153 | rand.Seed(time.Now().UnixNano()) 154 | a := rand.Intn(10) 155 | name := namesgenerator.GetRandomName(a) 156 | schemas = append(schemas, SchemaName{Name: name}) 157 | } 158 | 159 | fmt.Println("Schema SchemaGeneration Completed. Generated", totalSchema, "Schema(s)") 160 | fmt.Println(schemas) 161 | 162 | var tableNames []string 163 | 164 | var tables []internalTable 165 | 166 | if g.Schema.GenerateTables { 167 | if g.Schema.SchemaName == "" { 168 | for _, s := range schemas { 169 | for i := 0; i < g.Tables.NumberOfTables; i++ { 170 | 171 | rand.Seed(time.Now().UnixNano()) 172 | a := rand.Intn(10) 173 | tableName := namesgenerator.GetRandomName(a) 174 | rand.Seed(time.Now().UnixNano()) 175 | randomNumber := rand.Intn(g.Tables.MaxColumns-g.Tables.MinColumns+1) + g.Tables.MinColumns // rand.Intn(n) generates a number in [0, n) 176 | 177 | var table internalTable 178 | 179 | table.TableName = s.String() + "." + tableName 180 | 181 | var fields []string 182 | for j := 0; j < randomNumber; j++ { 183 | 184 | rand.Seed(time.Now().UnixNano()) 185 | a := rand.Intn(10) 186 | 187 | fieldName := namesgenerator.GetRandomName(a) 188 | typeVal := randomizeType() 189 | 190 | table.Fields = append(table.Fields, Field{Name: fieldName, Type: typeVal}) 191 | fields = append(fields, fieldName+" "+typeVal.name()) 192 | } 193 | 194 | tables = append(tables, table) 195 | 196 | tableNames = append(tableNames, "CREATE TABLE "+s.String()+"."+tableName+" ("+strings.Join(fields, ",")+")") 197 | } 198 | } 199 | } else { 200 | for i := 0; i < g.Tables.NumberOfTables; i++ { 201 | 202 | rand.Seed(time.Now().UnixNano()) 203 | a := rand.Intn(10) 204 | 205 | tableName := namesgenerator.GetRandomName(a) 206 | rand.Seed(time.Now().UnixNano()) 207 | randomNumber := rand.Intn(g.Tables.MaxColumns-g.Tables.MinColumns+1) + g.Tables.MinColumns // rand.Intn(n) generates a number in [0, n) 208 | 209 | var table internalTable 210 | 211 | table.TableName = g.Schema.SchemaName + "." + tableName 212 | 213 | var fields []string 214 | for j := 0; j < randomNumber; j++ { 215 | 216 | rand.Seed(time.Now().UnixNano()) 217 | a := rand.Intn(10) 218 | 219 | fieldName := namesgenerator.GetRandomName(a) 220 | typeVal := randomizeType() 221 | 222 | table.Fields = append(table.Fields, Field{Name: fieldName, Type: typeVal}) 223 | fields = append(fields, fieldName+" "+typeVal.name()) 224 | } 225 | 226 | tables = append(tables, table) 227 | tableNames = append(tableNames, "CREATE TABLE "+g.Schema.SchemaName+"."+tableName+" ("+strings.Join(fields, ",")+")") 228 | } 229 | } 230 | } 231 | 232 | var insertQueries []string 233 | 234 | fmt.Println("populating tables") 235 | 236 | if g.Tables.PopulateTable { 237 | for _, t := range tables { 238 | rand.Seed(time.Now().UnixNano()) 239 | randomNumber := rand.Intn(g.Rows.MaxRows-g.Rows.MinRows+1) + g.Rows.MinRows // rand.Intn(n) generates a number in [0, n) 240 | insertQueries = append(insertQueries, t.String(randomNumber)) 241 | } 242 | } 243 | 244 | if g.DryRun { 245 | for _, s := range schemas { 246 | fmt.Println(s.Create()) 247 | } 248 | 249 | for _, t := range tableNames { 250 | fmt.Println(t) 251 | } 252 | 253 | for _, i := range insertQueries { 254 | fmt.Println(i) 255 | } 256 | 257 | } else { 258 | 259 | fmt.Println("creating everything in the database") 260 | 261 | d, err := g.Connection.NewClient() 262 | if err != nil { 263 | return err 264 | } 265 | for _, s := range schemas { 266 | if err = d.Exec(s.Create()).Error; err != nil { 267 | log.Println(err) 268 | } 269 | } 270 | 271 | for _, t := range tableNames { 272 | if err = d.Exec(t).Error; err != nil { 273 | log.Println(err) 274 | } 275 | } 276 | 277 | for _, i := range insertQueries { 278 | if err = d.Exec(i).Error; err != nil { 279 | log.Println(err) 280 | } 281 | } 282 | } 283 | 284 | return nil 285 | } 286 | 287 | type TableGeneration struct { 288 | Connection Connection `json:"connection,omitempty" yaml:"connection,omitempty"` 289 | NumberOfTables int `json:"number_of_tables,omitempty" yaml:"numberOfTables,omitempty"` 290 | MinColumns int `json:"min_columns,omitempty" yaml:"minColumns,omitempty"` 291 | MaxColumns int `json:"max_columns,omitempty" yaml:"maxColumns,omitempty"` 292 | PopulateTable bool `json:"populate_table,omitempty" yaml:"populateTable,omitempty"` 293 | } 294 | 295 | func (g TableGeneration) GenerateTables() error { 296 | 297 | return nil 298 | } 299 | 300 | type DataGeneration struct { 301 | Connection Connection `json:"connection,omitempty" yaml:"connection,omitempty"` 302 | TableName string `json:"table_name,omitempty" yaml:"tableName,omitempty"` 303 | MinRows int `json:"min_rows,omitempty" yaml:"minRows,omitempty"` 304 | MaxRows int `json:"max_rows,omitempty" yaml:"maxRows,omitempty"` 305 | } 306 | 307 | func (g DataGeneration) GenerateData() error { 308 | return nil 309 | } 310 | -------------------------------------------------------------------------------- /pkg/config/generation_test.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "log" 5 | "testing" 6 | ) 7 | 8 | // SchemaType is a type of schema 9 | func TestSchemaGeneration(t *testing.T) { 10 | var schemaConfig SchemaGeneration 11 | 12 | schemaConfig.Connection.DbType = "postgres" 13 | schemaConfig.Connection.DbName = "test-sql" 14 | 15 | //password := url.QueryEscape(`adaptive-3jvw:G!q6BVhjZz^0`) 16 | //schemaConfig.ConnectionString = `sqlserver://` + `adaptive-3jvw:G!q6BVhjZz^0` + `@127.0.0.1:11433?database=pubs` 17 | 18 | schemaConfig.Connection.ConnectionString = `host=localhost user=postgres password=mysecretpassword dbname=test_generation port=5432 sslmode=disable` 19 | 20 | schemaConfig.Schema.NumberOfSchema = 1 21 | schemaConfig.Schema.GenerateTables = true 22 | schemaConfig.Schema.Language = "en" 23 | schemaConfig.DryRun = false 24 | schemaConfig.Tables.NumberOfTables = 20 25 | schemaConfig.Tables.MinColumns = 1 26 | schemaConfig.Tables.MaxColumns = 5 27 | 28 | schemaConfig.Tables.PopulateTable = true 29 | schemaConfig.Rows.MinRows = 1 30 | schemaConfig.Rows.MaxRows = 10 31 | 32 | err := schemaConfig.GenerateSchema() 33 | if err != nil { 34 | log.Fatal(err) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /pkg/config/scenario.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "log" 5 | "sync" 6 | 7 | "gopkg.in/yaml.v3" 8 | ) 9 | 10 | type Scenario struct { 11 | Connection // Applies to NoSQL Databases Only 12 | Scenarios []SimpleConfiguration `json:"scenarios" yaml:"scenarios"` 13 | Collection string `json:"collection" yaml:"collection"` // Applies to NoSQL Databases Only 14 | QueryType string `json:"query_type" yaml:"queryType"` // Applies to MongoDB Only 15 | SortQuery string `json:"sort_query" yaml:"sortQuery"` // Applies to MongoDB Only 16 | SkipNumber int `json:"skip_number" yaml:"skipNumber"` // Applies to MongoDB Only 17 | LimitNumber int `json:"limit_number" yaml:"limitNumber"` // Applies to MongoDB Only 18 | ProjectionQuery string `json:"projection_query" yaml:"projectionQuery"` // Applies to MongoDB Only 19 | Docs []interface{} `json:"docs" yaml:"docs"` // Applies to NoSQL Databases Only 20 | } 21 | 22 | func ParseScenario(config []byte) *Scenario { 23 | var configuration Scenario 24 | if err := yaml.Unmarshal(config, &configuration); err != nil { 25 | return nil 26 | } 27 | return &configuration 28 | } 29 | 30 | func (s *Scenario) Start() { 31 | 32 | var wg sync.WaitGroup 33 | wg.Add(len(s.Scenarios)) 34 | for _, a := range s.Scenarios { 35 | 36 | if a.DbType == "" { 37 | a.DbType = s.DbType 38 | } 39 | 40 | if a.ConnectionString == "" { 41 | a.ConnectionString = s.ConnectionString 42 | } 43 | 44 | a.DbName = s.DbName 45 | 46 | go func(a SimpleConfiguration) { 47 | defer wg.Done() 48 | if err := a.Start(); err != nil { 49 | log.Println(err) 50 | return 51 | } 52 | }(a) 53 | } 54 | 55 | wg.Wait() 56 | 57 | } 58 | -------------------------------------------------------------------------------- /pkg/config/simple_config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "context" 5 | "log" 6 | "time" 7 | 8 | "github.com/adaptive-scale/dbchaos/pkg/runner" 9 | "go.mongodb.org/mongo-driver/mongo" 10 | "go.mongodb.org/mongo-driver/mongo/options" 11 | "gopkg.in/yaml.v3" 12 | "gorm.io/gorm" 13 | ) 14 | 15 | const ( 16 | MySQL = "mysql" 17 | Postgres = "postgres" 18 | SQLServer = "sqlserver" 19 | MongoDB = "mongodb" 20 | ) 21 | 22 | type Randomize struct { 23 | Variable string `yaml:"variable"` 24 | RangeFrom int `yaml:"rangeFrom,omitempty"` 25 | RangeTo int `yaml:"rangeTo,omitempty"` 26 | RandomString bool `yaml:"randomString,omitempty"` 27 | RandomAlphanumeric bool `yaml:"randomAlphanumeric,omitempty"` 28 | maxLength int `yaml:"maxLength,omitempty"` 29 | } 30 | 31 | type SimpleConfiguration struct { 32 | Connection 33 | Collection string `json:"collection" yaml:"collection"` 34 | Query string `json:"query" yaml:"query"` 35 | ParallelRuns int `json:"parallel_runs" yaml:"parallelRuns,omitempty"` 36 | RunFor string `json:"run_for" yaml:"runFor,omitempty"` 37 | CoolOffTime int `json:"coolOffTime" yaml:"coolOffTime,omitempty"` 38 | Randomize Randomize `json:"randomize" yaml:"randomize,omitempty"` 39 | QueryType string `json:"query_type" yaml:"queryType"` // Applies to MongoDB Only 40 | SortQuery string `json:"sort_query" yaml:"sortQuery"` // Applies to MongoDB Only 41 | SkipNumber int `json:"skip_number" yaml:"skipNumber"` // Applies to MongoDB Only 42 | LimitNumber int `json:"limit_number" yaml:"limitNumber"` // Applies to MongoDB Only 43 | ProjectionQuery string `json:"projection_query" yaml:"projectionQuery"` // Applies to MongoDB Only 44 | Docs []interface{} `json:"docs" yaml:"docs"` // Applies to NoSQL Databases Only 45 | //RequestPerSecond int64 `yaml:"requestPerSecond" json:"requestPerSecond"` 46 | } 47 | 48 | func ParseConfiguration(config []byte) *SimpleConfiguration { 49 | var configuration SimpleConfiguration 50 | if err := yaml.Unmarshal(config, &configuration); err != nil { 51 | return nil 52 | } 53 | return &configuration 54 | } 55 | 56 | func (s *SimpleConfiguration) Start() error { 57 | 58 | var d *gorm.DB 59 | var err error 60 | switch s.DbType { 61 | case MySQL, Postgres, SQLServer: 62 | { 63 | d, err = s.NewClient() 64 | if err != nil { 65 | return err 66 | } 67 | } 68 | case MongoDB: 69 | { 70 | ctx, cancel := context.WithTimeout(context.Background(), time.Hour) 71 | clientOptions := options.Client().ApplyURI(s.ConnectionString) 72 | clientOptions.SetMaxPoolSize(100) 73 | client, err := mongo.Connect(ctx, clientOptions) 74 | defer cancel() 75 | if err != nil { 76 | log.Fatal(err) 77 | } 78 | if s.RunFor != "" { 79 | dur := runner.DurationRunner{ 80 | RunFor: s.RunFor, 81 | ParallelRuns: s.ParallelRuns, 82 | CoolOffTime: s.CoolOffTime, 83 | MongoDB: client, 84 | DbType: s.DbType, 85 | DbName: s.DbName, 86 | //RequestPerSecond: s.RequestPerSecond, 87 | Query: s.Query, 88 | } 89 | return dur.Run() 90 | } 91 | } 92 | } 93 | 94 | if s.RunFor != "" && s.DbType != MongoDB { 95 | dur := runner.DurationRunner{ 96 | RunFor: s.RunFor, 97 | ParallelRuns: s.ParallelRuns, 98 | CoolOffTime: s.CoolOffTime, 99 | DB: d, 100 | DbType: s.DbType, 101 | //RequestPerSecond: s.RequestPerSecond, 102 | Query: s.Query, 103 | } 104 | return dur.Run() 105 | } 106 | 107 | return nil 108 | } 109 | -------------------------------------------------------------------------------- /pkg/generate/fields.go: -------------------------------------------------------------------------------- 1 | package generate 2 | 3 | type SchemaType string 4 | 5 | const ( 6 | SchemaTypeSocialMedia SchemaType = "social_media" 7 | SchemaTypeFintech SchemaType = "fintech" 8 | SchemaTypeSakila SchemaType = "sakila" 9 | SchemaTypeStackOverflow SchemaType = "stackoverflow" 10 | SchemaTypeLogictics SchemaType = "logistics" 11 | SchemaTypeWebshop SchemaType = "webshop" 12 | ) 13 | 14 | var socialMedia = []string{ 15 | "_users", "_followers", "_posts", "_comments", "_likes", "_shares", "_groups", "_pages", "_events", "_messages", "_notifications", "_settings", "_profile", "_media", "_tags", "_locations", "_checkins", "_friends", "_family", "_colleagues", "_classmates", "_neighbors", "_acquaintances", "_strangers", "_blocked", "_muted", "_restricted", "_unrestricted", "_banned", "_deleted", "_archived", "_hidden", "_suspended", "_verified", "_unverified", "_pending", "_approved", "_rejected", "_reported", "_flagged", "_spam", 16 | } 17 | 18 | var fintech = []string{ 19 | "_users", "_accounts", "_transactions", "_payments", "_loans", "_deposits", "_withdrawals", "_transfers", "_balances", "_statements", "_invoices", "_bills", "_purchases", "_sales", "_orders", "_carts", "_checkout", "_shipping", "_delivery", "_returns", "_refunds", "_disputes", "_claims", "_fraud", "_scams", "_phishing", "_hacking", "_security", "_privacy", "_encryption", "_decryption", "_authentication", "_authorization", "_verification", "_validation", "_confirmation", "_rejection", "_approval", "_reporting", "_flagging", "_spam", 20 | } 21 | 22 | var sakila = []string{ 23 | "_actors", "_categories", "_films", "_languages", "_customers", "_stores", "_staff", "_inventory", "_rentals", "_payments", "_cities", "_countries", "_addresses", "_districts", "_postal_codes", "_phone_numbers", "_emails", "_websites", "_social_media", "_profiles", "_logins", "_passwords", "_security_questions", "_answers", "_verification", "_confirmation", "_rejection", "_approval", "_reporting", "_flagging", "_spam", 24 | } 25 | 26 | var stackOverflow = []string{ 27 | "_users", "_questions", "_answers", "_comments", "_votes", "_badges", "_tags", "_categories", "_reputation", "_privileges", "_settings", "_profile", "_notifications", "_messages", "_inbox", "_outbox", "_drafts", "_trash", "_spam", "_flagged", "_reported", "_blocked", "_muted", "_restricted", "_unrestricted", "_banned", "_deleted", "_archived", "_hidden", "_suspended", "_verified", "_unverified", "_pending", "_approved", "_rejected", "_reported", "_flagged", "_spam", 28 | } 29 | 30 | var logistics = []string{ 31 | "_users", "_customers", "_suppliers", "_vendors", "_partners", "_employees", "_contractors", "_drivers", "_vehicles", "_warehouses", "_inventory", "_products", "_orders", "_shipments", "_deliveries", "_returns", "_refunds", "_invoices", "_bills", "_purchases", "_sales", "_transactions", "_payments", "_loans", "_deposits", "_withdrawals", "_transfers", "_balances", "_statements", "_invoices", "_bills", "_purchases", "_sales", "_orders", "_carts", "_checkout", "_shipping", "_delivery", "_returns", "_refunds", "_disputes", "_claims", "_fraud", "_scams", "_phishing", "_hacking", "_security", "_privacy", "_encryption", "_decryption", "_authentication", "_authorization", "_verification", "_validation", "_confirmation", "_rejection", "_approval", "_reporting", "_flagging", "_spam", 32 | } 33 | 34 | var webshop = []string{ 35 | "_cart", "_checkout", "_shipping", "_delivery", "_returns", "_refunds", "_disputes", "_claims", "_fraud", "_scams", "_phishing", "_hacking", "_security", "_privacy", "_encryption", "_decryption", "_authentication", "_authorization", "_verification", "_validation", "_confirmation", "_rejection", "_approval", "_reporting", "_flagging", "_spam", 36 | } 37 | -------------------------------------------------------------------------------- /pkg/generate/schema.go: -------------------------------------------------------------------------------- 1 | package generate 2 | 3 | var socialMediaGenerator = map[SchemaType][]FieldType{ 4 | "_users": []FieldType{ 5 | {"id", TypeString}, 6 | {"username", TypeString}, 7 | {"password", TypePassword}, 8 | {"name", TypeName}, 9 | {"email", TypeString}, 10 | {"phone", TypeString}, 11 | {"address", TypeString}, 12 | {"city", TypeString}, 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /pkg/generate/social_media.go: -------------------------------------------------------------------------------- 1 | package generate 2 | 3 | type FieldType struct { 4 | Name string 5 | Type Type 6 | } 7 | 8 | type Type string 9 | 10 | const ( 11 | TypeName Type = "name" 12 | TypeString Type = "string" 13 | TypeNumber Type = "number" 14 | TypeFloat Type = "float" 15 | TypeBoolean Type = "boolean" 16 | TypeDate Type = "date" 17 | TypeEmail Type = "email" 18 | TypePassword Type = "password" 19 | TypeCompany Type = "company" 20 | TypeHackerPhrase Type = "hackerphrase" 21 | ) 22 | -------------------------------------------------------------------------------- /pkg/generatewithllm/knownschema.go: -------------------------------------------------------------------------------- 1 | package generatewithllm 2 | 3 | const ( 4 | webshop = ` 5 | 6 | CREATE TABLE Categories ( 7 | category_id INT PRIMARY KEY, 8 | category_name VARCHAR(255), 9 | parent_category_id INT 10 | ); 11 | 12 | CREATE TABLE Customers ( 13 | customer_id INT PRIMARY KEY, 14 | first_name VARCHAR(50), 15 | last_name VARCHAR(50), 16 | email VARCHAR(100), 17 | password VARCHAR(255), 18 | address VARCHAR(255), 19 | city VARCHAR(100), 20 | country VARCHAR(100), 21 | postal_code VARCHAR(20), 22 | phone_number VARCHAR(20) 23 | ); 24 | 25 | 26 | CREATE TABLE Products ( 27 | product_id INT PRIMARY KEY, 28 | product_name VARCHAR(255), 29 | description TEXT, 30 | price DECIMAL(10, 2), 31 | stock_quantity INT, 32 | category_id INT, 33 | FOREIGN KEY (category_id) REFERENCES Categories(category_id) 34 | ); 35 | 36 | 37 | CREATE TABLE Orders ( 38 | order_id INT PRIMARY KEY, 39 | customer_id INT, 40 | order_date DATE, 41 | status VARCHAR(50), 42 | total_amount DECIMAL(10, 2), 43 | shipping_address VARCHAR(255), 44 | city VARCHAR(100), 45 | country VARCHAR(100), 46 | postal_code VARCHAR(20), 47 | phone_number VARCHAR(20), 48 | payment_method VARCHAR(100), 49 | FOREIGN KEY (customer_id) REFERENCES Customers(customer_id) 50 | ); 51 | 52 | CREATE TABLE Order_Details ( 53 | order_detail_id INT PRIMARY KEY, 54 | order_id INT, 55 | product_id INT, 56 | quantity INT, 57 | unit_price DECIMAL(10, 2), 58 | subtotal DECIMAL(10, 2), 59 | FOREIGN KEY (order_id) REFERENCES Orders(order_id), 60 | FOREIGN KEY (product_id) REFERENCES Products(product_id) 61 | );` 62 | 63 | logistics = ` 64 | CREATE TABLE Customers ( 65 | customer_id INT PRIMARY KEY, 66 | first_name VARCHAR(50), 67 | last_name VARCHAR(50), 68 | email VARCHAR(100), 69 | address VARCHAR(255), 70 | city VARCHAR(100), 71 | country VARCHAR(100), 72 | postal_code VARCHAR(20), 73 | phone_number VARCHAR(20) 74 | ); 75 | 76 | CREATE TABLE Shipments ( 77 | shipment_id INT PRIMARY KEY, 78 | shipment_date DATE, 79 | sender_id INT, 80 | recipient_id INT, 81 | delivery_status VARCHAR(50), 82 | shipping_method VARCHAR(100), 83 | total_weight DECIMAL(10, 2), 84 | shipping_cost DECIMAL(10, 2), 85 | FOREIGN KEY (sender_id) REFERENCES Customers(customer_id), 86 | FOREIGN KEY (recipient_id) REFERENCES Customers(customer_id) 87 | ); 88 | 89 | CREATE TABLE Addresses ( 90 | address_id INT PRIMARY KEY, 91 | customer_id INT, 92 | address_type VARCHAR(50), 93 | address VARCHAR(255), 94 | city VARCHAR(100), 95 | country VARCHAR(100), 96 | postal_code VARCHAR(20), 97 | phone_number VARCHAR(20), 98 | FOREIGN KEY (customer_id) REFERENCES Customers(customer_id) 99 | ); 100 | 101 | CREATE TABLE Packages ( 102 | package_id INT PRIMARY KEY, 103 | shipment_id INT, 104 | package_weight DECIMAL(10, 2), 105 | package_dimensions VARCHAR(100), 106 | package_contents TEXT, 107 | FOREIGN KEY (shipment_id) REFERENCES Shipments(shipment_id) 108 | ); 109 | 110 | CREATE TABLE Carriers ( 111 | carrier_id INT PRIMARY KEY, 112 | carrier_name VARCHAR(100), 113 | tracking_url VARCHAR(255), 114 | contact_information VARCHAR(255) 115 | ); 116 | 117 | CREATE TABLE Shipment_Carriers ( 118 | shipment_carrier_id INT PRIMARY KEY, 119 | shipment_id INT, 120 | carrier_id INT, 121 | tracking_number VARCHAR(100), 122 | FOREIGN KEY (shipment_id) REFERENCES Shipments(shipment_id), 123 | FOREIGN KEY (carrier_id) REFERENCES Carriers(carrier_id) 124 | ); 125 | ` 126 | 127 | hostpital = `-- Table for Patients 128 | CREATE TABLE Patients ( 129 | patient_id INT PRIMARY KEY, 130 | first_name VARCHAR(50), 131 | last_name VARCHAR(50), 132 | date_of_birth DATE, 133 | gender VARCHAR(10), 134 | address VARCHAR(255), 135 | city VARCHAR(100), 136 | country VARCHAR(100), 137 | postal_code VARCHAR(20), 138 | phone_number VARCHAR(20) 139 | ); 140 | 141 | -- Table for Doctors 142 | CREATE TABLE Doctors ( 143 | doctor_id INT PRIMARY KEY, 144 | first_name VARCHAR(50), 145 | last_name VARCHAR(50), 146 | specialization VARCHAR(100), 147 | address VARCHAR(255), 148 | city VARCHAR(100), 149 | country VARCHAR(100), 150 | postal_code VARCHAR(20), 151 | phone_number VARCHAR(20) 152 | ); 153 | 154 | -- Table for Appointments 155 | CREATE TABLE Appointments ( 156 | appointment_id INT PRIMARY KEY, 157 | patient_id INT, 158 | doctor_id INT, 159 | appointment_date DATETIME, 160 | reason VARCHAR(255), 161 | status VARCHAR(50), 162 | FOREIGN KEY (patient_id) REFERENCES Patients(patient_id), 163 | FOREIGN KEY (doctor_id) REFERENCES Doctors(doctor_id) 164 | ); 165 | 166 | -- Table for Medical Records 167 | CREATE TABLE MedicalRecords ( 168 | record_id INT PRIMARY KEY, 169 | patient_id INT, 170 | doctor_id INT, 171 | record_date DATE, 172 | diagnosis TEXT, 173 | treatment TEXT, 174 | prescription TEXT, 175 | FOREIGN KEY (patient_id) REFERENCES Patients(patient_id), 176 | FOREIGN KEY (doctor_id) REFERENCES Doctors(doctor_id) 177 | ); 178 | 179 | -- Table for Ward 180 | CREATE TABLE Ward ( 181 | ward_id INT PRIMARY KEY, 182 | ward_name VARCHAR(100), 183 | ward_type VARCHAR(50), 184 | capacity INT 185 | ); 186 | 187 | -- Table for Admission 188 | CREATE TABLE Admissions ( 189 | admission_id INT PRIMARY KEY, 190 | patient_id INT, 191 | ward_id INT, 192 | admission_date DATETIME, 193 | discharge_date DATETIME, 194 | status VARCHAR(50), 195 | FOREIGN KEY (patient_id) REFERENCES Patients(patient_id), 196 | FOREIGN KEY (ward_id) RE 197 | ` 198 | medical_record = `-- Table for Patients 199 | CREATE TABLE Patients ( 200 | patient_id INT PRIMARY KEY, 201 | first_name VARCHAR(50), 202 | last_name VARCHAR(50), 203 | date_of_birth DATE, 204 | gender VARCHAR(10), 205 | address VARCHAR(255), 206 | city VARCHAR(100), 207 | country VARCHAR(100), 208 | postal_code VARCHAR(20), 209 | phone_number VARCHAR(20) 210 | ); 211 | 212 | -- Table for Physicians 213 | CREATE TABLE Physicians ( 214 | physician_id INT PRIMARY KEY, 215 | first_name VARCHAR(50), 216 | last_name VARCHAR(50), 217 | specialization VARCHAR(100), 218 | address VARCHAR(255), 219 | city VARCHAR(100), 220 | country VARCHAR(100), 221 | postal_code VARCHAR(20), 222 | phone_number VARCHAR(20) 223 | ); 224 | 225 | -- Table for MedicalRecords 226 | CREATE TABLE MedicalRecords ( 227 | record_id INT PRIMARY KEY, 228 | patient_id INT, 229 | physician_id INT, 230 | record_date DATETIME, 231 | diagnosis TEXT, 232 | treatment TEXT, 233 | prescription TEXT, 234 | FOREIGN KEY (patient_id) REFERENCES Patients(patient_id), 235 | FOREIGN KEY (physician_id) REFERENCES Physicians(physician_id) 236 | ); 237 | 238 | -- Table for LabTests 239 | CREATE TABLE LabTests ( 240 | test_id INT PRIMARY KEY, 241 | patient_id INT, 242 | physician_id INT, 243 | test_date DATETIME, 244 | test_name VARCHAR(255), 245 | result TEXT, 246 | FOREIGN KEY (patient_id) REFERENCES Patients(patient_id), 247 | FOREIGN KEY (physician_id 248 | ` 249 | ) 250 | 251 | var KnownSchema = map[string]string{ 252 | "webshop": webshop, 253 | "logistics": logistics, 254 | "hospital": hostpital, 255 | "medical_record": medical_record, 256 | } 257 | -------------------------------------------------------------------------------- /pkg/namesgenerator/namesgenerator.go: -------------------------------------------------------------------------------- 1 | // Package namesgenerator generates random names. 2 | // 3 | // This package is officially "frozen" - no new additions will be accepted. 4 | // 5 | // For a long time, this package provided a lot of joy within the project, but 6 | // at some point the conflicts of opinion became greater than the added joy. 7 | // 8 | // At some future time, this may be replaced with something that sparks less 9 | // controversy, but for now it will remain as-is. 10 | // 11 | // See also https://github.com/moby/moby/pull/43210#issuecomment-1029934277 12 | package namesgenerator // import "github.com/docker/docker/pkg/namesgenerator" 13 | 14 | import ( 15 | "math/rand" 16 | "strconv" 17 | ) 18 | 19 | var ( 20 | left = [...]string{ 21 | "admiring", 22 | "adoring", 23 | "affectionate", 24 | "agitated", 25 | "amazing", 26 | "angry", 27 | "awesome", 28 | "beautiful", 29 | "blissful", 30 | "bold", 31 | "boring", 32 | "brave", 33 | "busy", 34 | "charming", 35 | "clever", 36 | "compassionate", 37 | "competent", 38 | "condescending", 39 | "confident", 40 | "cool", 41 | "cranky", 42 | "crazy", 43 | "dazzling", 44 | "determined", 45 | "distracted", 46 | "dreamy", 47 | "eager", 48 | "ecstatic", 49 | "elastic", 50 | "elated", 51 | "elegant", 52 | "eloquent", 53 | "epic", 54 | "exciting", 55 | "fervent", 56 | "festive", 57 | "flamboyant", 58 | "focused", 59 | "friendly", 60 | "frosty", 61 | "funny", 62 | "gallant", 63 | "gifted", 64 | "goofy", 65 | "gracious", 66 | "great", 67 | "happy", 68 | "hardcore", 69 | "heuristic", 70 | "hopeful", 71 | "hungry", 72 | "infallible", 73 | "inspiring", 74 | "intelligent", 75 | "interesting", 76 | "jolly", 77 | "jovial", 78 | "keen", 79 | "kind", 80 | "laughing", 81 | "loving", 82 | "lucid", 83 | "magical", 84 | "modest", 85 | "musing", 86 | "mystifying", 87 | "naughty", 88 | "nervous", 89 | "nice", 90 | "nifty", 91 | "nostalgic", 92 | "objective", 93 | "optimistic", 94 | "peaceful", 95 | "pedantic", 96 | "pensive", 97 | "practical", 98 | "priceless", 99 | "quirky", 100 | "quizzical", 101 | "recursing", 102 | "relaxed", 103 | "reverent", 104 | "romantic", 105 | "sad", 106 | "serene", 107 | "sharp", 108 | "silly", 109 | "sleepy", 110 | "stoic", 111 | "strange", 112 | "stupefied", 113 | "suspicious", 114 | "sweet", 115 | "tender", 116 | "thirsty", 117 | "trusting", 118 | "unruffled", 119 | "upbeat", 120 | "vibrant", 121 | "vigilant", 122 | "vigorous", 123 | "wizardly", 124 | "wonderful", 125 | "xenodochial", 126 | "youthful", 127 | "zealous", 128 | "zen", 129 | } 130 | 131 | // Docker, starting from 0.7.x, generates names from notable scientists and hackers. 132 | // Please, for any amazing man that you add to the list, consider adding an equally amazing woman to it, and vice versa. 133 | right = [...]string{ 134 | // Maria Gaetana Agnesi - Italian mathematician, philosopher, theologian and humanitarian. She was the first woman to write a mathematics handbook and the first woman appointed as a Mathematics Professor at a University. https://en.wikipedia.org/wiki/Maria_Gaetana_Agnesi 135 | "agnesi", 136 | 137 | // Muhammad ibn Jābir al-Ḥarrānī al-Battānī was a founding father of astronomy. https://en.wikipedia.org/wiki/Mu%E1%B8%A5ammad_ibn_J%C4%81bir_al-%E1%B8%A4arr%C4%81n%C4%AB_al-Batt%C4%81n%C4%AB 138 | "albattani", 139 | 140 | // Frances E. Allen, became the first female IBM Fellow in 1989. In 2006, she became the first female recipient of the ACM's Turing Award. https://en.wikipedia.org/wiki/Frances_E._Allen 141 | "allen", 142 | 143 | // June Almeida - Scottish virologist who took the first pictures of the rubella virus - https://en.wikipedia.org/wiki/June_Almeida 144 | "almeida", 145 | 146 | // Kathleen Antonelli, American computer programmer and one of the six original programmers of the ENIAC - https://en.wikipedia.org/wiki/Kathleen_Antonelli 147 | "antonelli", 148 | 149 | // Archimedes was a physicist, engineer and mathematician who invented too many things to list them here. https://en.wikipedia.org/wiki/Archimedes 150 | "archimedes", 151 | 152 | // Maria Ardinghelli - Italian translator, mathematician and physicist - https://en.wikipedia.org/wiki/Maria_Ardinghelli 153 | "ardinghelli", 154 | 155 | // Aryabhata - Ancient Indian mathematician-astronomer during 476-550 CE https://en.wikipedia.org/wiki/Aryabhata 156 | "aryabhata", 157 | 158 | // Wanda Austin - Wanda Austin is the President and CEO of The Aerospace Corporation, a leading architect for the US security space programs. https://en.wikipedia.org/wiki/Wanda_Austin 159 | "austin", 160 | 161 | // Charles Babbage invented the concept of a programmable computer. https://en.wikipedia.org/wiki/Charles_Babbage. 162 | "babbage", 163 | 164 | // Stefan Banach - Polish mathematician, was one of the founders of modern functional analysis. https://en.wikipedia.org/wiki/Stefan_Banach 165 | "banach", 166 | 167 | // Buckaroo Banzai and his mentor Dr. Hikita perfected the "oscillation overthruster", a device that allows one to pass through solid matter. - https://en.wikipedia.org/wiki/The_Adventures_of_Buckaroo_Banzai_Across_the_8th_Dimension 168 | "banzai", 169 | 170 | // John Bardeen co-invented the transistor - https://en.wikipedia.org/wiki/John_Bardeen 171 | "bardeen", 172 | 173 | // Jean Bartik, born Betty Jean Jennings, was one of the original programmers for the ENIAC computer. https://en.wikipedia.org/wiki/Jean_Bartik 174 | "bartik", 175 | 176 | // Laura Bassi, the world's first female professor https://en.wikipedia.org/wiki/Laura_Bassi 177 | "bassi", 178 | 179 | // Hugh Beaver, British engineer, founder of the Guinness Book of World Records https://en.wikipedia.org/wiki/Hugh_Beaver 180 | "beaver", 181 | 182 | // Alexander Graham Bell - an eminent Scottish-born scientist, inventor, engineer and innovator who is credited with inventing the first practical telephone - https://en.wikipedia.org/wiki/Alexander_Graham_Bell 183 | "bell", 184 | 185 | // Karl Friedrich Benz - a German automobile engineer. Inventor of the first practical motorcar. https://en.wikipedia.org/wiki/Karl_Benz 186 | "benz", 187 | 188 | // Homi J Bhabha - was an Indian nuclear physicist, founding director, and professor of physics at the Tata Institute of Fundamental Research. Colloquially known as "father of Indian nuclear programme"- https://en.wikipedia.org/wiki/Homi_J._Bhabha 189 | "bhabha", 190 | 191 | // Bhaskara II - Ancient Indian mathematician-astronomer whose work on calculus predates Newton and Leibniz by over half a millennium - https://en.wikipedia.org/wiki/Bh%C4%81skara_II#Calculus 192 | "bhaskara", 193 | 194 | // Sue Black - British computer scientist and campaigner. She has been instrumental in saving Bletchley Park, the site of World War II codebreaking - https://en.wikipedia.org/wiki/Sue_Black_(computer_scientist) 195 | "black", 196 | 197 | // Elizabeth Helen Blackburn - Australian-American Nobel laureate; best known for co-discovering telomerase. https://en.wikipedia.org/wiki/Elizabeth_Blackburn 198 | "blackburn", 199 | 200 | // Elizabeth Blackwell - American doctor and first American woman to receive a medical degree - https://en.wikipedia.org/wiki/Elizabeth_Blackwell 201 | "blackwell", 202 | 203 | // Niels Bohr is the father of quantum theory. https://en.wikipedia.org/wiki/Niels_Bohr. 204 | "bohr", 205 | 206 | // Kathleen Booth, she's credited with writing the first assembly language. https://en.wikipedia.org/wiki/Kathleen_Booth 207 | "booth", 208 | 209 | // Anita Borg - Anita Borg was the founding director of the Institute for Women and Technology (IWT). https://en.wikipedia.org/wiki/Anita_Borg 210 | "borg", 211 | 212 | // Satyendra Nath Bose - He provided the foundation for Bose–Einstein statistics and the theory of the Bose–Einstein condensate. - https://en.wikipedia.org/wiki/Satyendra_Nath_Bose 213 | "bose", 214 | 215 | // Katherine Louise Bouman is an imaging scientist and Assistant Professor of Computer Science at the California Institute of Technology. She researches computational methods for imaging, and developed an algorithm that made possible the picture first visualization of a black hole using the Event Horizon Telescope. - https://en.wikipedia.org/wiki/Katie_Bouman 216 | "bouman", 217 | 218 | // Evelyn Boyd Granville - She was one of the first African-American woman to receive a Ph.D. in mathematics; she earned it in 1949 from Yale University. https://en.wikipedia.org/wiki/Evelyn_Boyd_Granville 219 | "boyd", 220 | 221 | // Brahmagupta - Ancient Indian mathematician during 598-670 CE who gave rules to compute with zero - https://en.wikipedia.org/wiki/Brahmagupta#Zero 222 | "brahmagupta", 223 | 224 | // Walter Houser Brattain co-invented the transistor - https://en.wikipedia.org/wiki/Walter_Houser_Brattain 225 | "brattain", 226 | 227 | // Emmett Brown invented time travel. https://en.wikipedia.org/wiki/Emmett_Brown (thanks Brian Goff) 228 | "brown", 229 | 230 | // Linda Brown Buck - American biologist and Nobel laureate best known for her genetic and molecular analyses of the mechanisms of smell. https://en.wikipedia.org/wiki/Linda_B._Buck 231 | "buck", 232 | 233 | // Dame Susan Jocelyn Bell Burnell - Northern Irish astrophysicist who discovered radio pulsars and was the first to analyse them. https://en.wikipedia.org/wiki/Jocelyn_Bell_Burnell 234 | "burnell", 235 | 236 | // Annie Jump Cannon - pioneering female astronomer who classified hundreds of thousands of stars and created the system we use to understand stars today. https://en.wikipedia.org/wiki/Annie_Jump_Cannon 237 | "cannon", 238 | 239 | // Rachel Carson - American marine biologist and conservationist, her book Silent Spring and other writings are credited with advancing the global environmental movement. https://en.wikipedia.org/wiki/Rachel_Carson 240 | "carson", 241 | 242 | // Dame Mary Lucy Cartwright - British mathematician who was one of the first to study what is now known as chaos theory. Also known for Cartwright's theorem which finds applications in signal processing. https://en.wikipedia.org/wiki/Mary_Cartwright 243 | "cartwright", 244 | 245 | // George Washington Carver - American agricultural scientist and inventor. He was the most prominent black scientist of the early 20th century. https://en.wikipedia.org/wiki/George_Washington_Carver 246 | "carver", 247 | 248 | // Vinton Gray Cerf - American Internet pioneer, recognised as one of "the fathers of the Internet". With Robert Elliot Kahn, he designed TCP and IP, the primary data communication protocols of the Internet and other computer networks. https://en.wikipedia.org/wiki/Vint_Cerf 249 | "cerf", 250 | 251 | // Subrahmanyan Chandrasekhar - Astrophysicist known for his mathematical theory on different stages and evolution in structures of the stars. He has won nobel prize for physics - https://en.wikipedia.org/wiki/Subrahmanyan_Chandrasekhar 252 | "chandrasekhar", 253 | 254 | // Sergey Alexeyevich Chaplygin (Russian: Серге́й Алексе́евич Чаплы́гин; April 5, 1869 – October 8, 1942) was a Russian and Soviet physicist, mathematician, and mechanical engineer. He is known for mathematical formulas such as Chaplygin's equation and for a hypothetical substance in cosmology called Chaplygin gas, named after him. https://en.wikipedia.org/wiki/Sergey_Chaplygin 255 | "chaplygin", 256 | 257 | // Émilie du Châtelet - French natural philosopher, mathematician, physicist, and author during the early 1730s, known for her translation of and commentary on Isaac Newton's book Principia containing basic laws of physics. https://en.wikipedia.org/wiki/%C3%89milie_du_Ch%C3%A2telet 258 | "chatelet", 259 | 260 | // Asima Chatterjee was an Indian organic chemist noted for her research on vinca alkaloids, development of drugs for treatment of epilepsy and malaria - https://en.wikipedia.org/wiki/Asima_Chatterjee 261 | "chatterjee", 262 | 263 | // David Lee Chaum - American computer scientist and cryptographer. Known for his seminal contributions in the field of anonymous communication. https://en.wikipedia.org/wiki/David_Chaum 264 | "chaum", 265 | 266 | // Pafnuty Chebyshev - Russian mathematician. He is known fo his works on probability, statistics, mechanics, analytical geometry and number theory https://en.wikipedia.org/wiki/Pafnuty_Chebyshev 267 | "chebyshev", 268 | 269 | // Joan Clarke - Bletchley Park code breaker during the Second World War who pioneered techniques that remained top secret for decades. Also an accomplished numismatist https://en.wikipedia.org/wiki/Joan_Clarke 270 | "clarke", 271 | 272 | // Bram Cohen - American computer programmer and author of the BitTorrent peer-to-peer protocol. https://en.wikipedia.org/wiki/Bram_Cohen 273 | "cohen", 274 | 275 | // Jane Colden - American botanist widely considered the first female American botanist - https://en.wikipedia.org/wiki/Jane_Colden 276 | "colden", 277 | 278 | // Gerty Theresa Cori - American biochemist who became the third woman—and first American woman—to win a Nobel Prize in science, and the first woman to be awarded the Nobel Prize in Physiology or Medicine. Cori was born in Prague. https://en.wikipedia.org/wiki/Gerty_Cori 279 | "cori", 280 | 281 | // Seymour Roger Cray was an American electrical engineer and supercomputer architect who designed a series of computers that were the fastest in the world for decades. https://en.wikipedia.org/wiki/Seymour_Cray 282 | "cray", 283 | 284 | // Marie Curie discovered radioactivity. https://en.wikipedia.org/wiki/Marie_Curie. 285 | "curie", 286 | 287 | // This entry reflects a husband and wife team who worked together: 288 | // Joan Curran was a Welsh scientist who developed radar and invented chaff, a radar countermeasure. https://en.wikipedia.org/wiki/Joan_Curran 289 | // Samuel Curran was an Irish physicist who worked alongside his wife during WWII and invented the proximity fuse. https://en.wikipedia.org/wiki/Samuel_Curran 290 | "curran", 291 | 292 | // Charles Darwin established the principles of natural evolution. https://en.wikipedia.org/wiki/Charles_Darwin. 293 | "darwin", 294 | 295 | // Leonardo Da Vinci invented too many things to list here. https://en.wikipedia.org/wiki/Leonardo_da_Vinci. 296 | "davinci", 297 | 298 | // A. K. (Alexander Keewatin) Dewdney, Canadian mathematician, computer scientist, author and filmmaker. Contributor to Scientific American's "Computer Recreations" from 1984 to 1991. Author of Core War (program), The Planiverse, The Armchair Universe, The Magic Machine, The New Turing Omnibus, and more. https://en.wikipedia.org/wiki/Alexander_Dewdney 299 | "dewdney", 300 | 301 | // Satish Dhawan - Indian mathematician and aerospace engineer, known for leading the successful and indigenous development of the Indian space programme. https://en.wikipedia.org/wiki/Satish_Dhawan 302 | "dhawan", 303 | 304 | // Bailey Whitfield Diffie - American cryptographer and one of the pioneers of public-key cryptography. https://en.wikipedia.org/wiki/Whitfield_Diffie 305 | "diffie", 306 | 307 | // Edsger Wybe Dijkstra was a Dutch computer scientist and mathematical scientist. https://en.wikipedia.org/wiki/Edsger_W._Dijkstra. 308 | "dijkstra", 309 | 310 | // Paul Adrien Maurice Dirac - English theoretical physicist who made fundamental contributions to the early development of both quantum mechanics and quantum electrodynamics. https://en.wikipedia.org/wiki/Paul_Dirac 311 | "dirac", 312 | 313 | // Agnes Meyer Driscoll - American cryptanalyst during World Wars I and II who successfully cryptanalysed a number of Japanese ciphers. She was also the co-developer of one of the cipher machines of the US Navy, the CM. https://en.wikipedia.org/wiki/Agnes_Meyer_Driscoll 314 | "driscoll", 315 | 316 | // Donna Dubinsky - played an integral role in the development of personal digital assistants (PDAs) serving as CEO of Palm, Inc. and co-founding Handspring. https://en.wikipedia.org/wiki/Donna_Dubinsky 317 | "dubinsky", 318 | 319 | // Annie Easley - She was a leading member of the team which developed software for the Centaur rocket stage and one of the first African-Americans in her field. https://en.wikipedia.org/wiki/Annie_Easley 320 | "easley", 321 | 322 | // Thomas Alva Edison, prolific inventor https://en.wikipedia.org/wiki/Thomas_Edison 323 | "edison", 324 | 325 | // Albert Einstein invented the general theory of relativity. https://en.wikipedia.org/wiki/Albert_Einstein 326 | "einstein", 327 | 328 | // Alexandra Asanovna Elbakyan (Russian: Алекса́ндра Аса́новна Элбакя́н) is a Kazakhstani graduate student, computer programmer, internet pirate in hiding, and the creator of the site Sci-Hub. Nature has listed her in 2016 in the top ten people that mattered in science, and Ars Technica has compared her to Aaron Swartz. - https://en.wikipedia.org/wiki/Alexandra_Elbakyan 329 | "elbakyan", 330 | 331 | // Taher A. ElGamal - Egyptian cryptographer best known for the ElGamal discrete log cryptosystem and the ElGamal digital signature scheme. https://en.wikipedia.org/wiki/Taher_Elgamal 332 | "elgamal", 333 | 334 | // Gertrude Elion - American biochemist, pharmacologist and the 1988 recipient of the Nobel Prize in Medicine - https://en.wikipedia.org/wiki/Gertrude_Elion 335 | "elion", 336 | 337 | // James Henry Ellis - British engineer and cryptographer employed by the GCHQ. Best known for conceiving for the first time, the idea of public-key cryptography. https://en.wikipedia.org/wiki/James_H._Ellis 338 | "ellis", 339 | 340 | // Douglas Engelbart gave the mother of all demos: https://en.wikipedia.org/wiki/Douglas_Engelbart 341 | "engelbart", 342 | 343 | // Euclid invented geometry. https://en.wikipedia.org/wiki/Euclid 344 | "euclid", 345 | 346 | // Leonhard Euler invented large parts of modern mathematics. https://de.wikipedia.org/wiki/Leonhard_Euler 347 | "euler", 348 | 349 | // Michael Faraday - British scientist who contributed to the study of electromagnetism and electrochemistry. https://en.wikipedia.org/wiki/Michael_Faraday 350 | "faraday", 351 | 352 | // Horst Feistel - German-born American cryptographer who was one of the earliest non-government researchers to study the design and theory of block ciphers. Co-developer of DES and Lucifer. Feistel networks, a symmetric structure used in the construction of block ciphers are named after him. https://en.wikipedia.org/wiki/Horst_Feistel 353 | "feistel", 354 | 355 | // Pierre de Fermat pioneered several aspects of modern mathematics. https://en.wikipedia.org/wiki/Pierre_de_Fermat 356 | "fermat", 357 | 358 | // Enrico Fermi invented the first nuclear reactor. https://en.wikipedia.org/wiki/Enrico_Fermi. 359 | "fermi", 360 | 361 | // Richard Feynman was a key contributor to quantum mechanics and particle physics. https://en.wikipedia.org/wiki/Richard_Feynman 362 | "feynman", 363 | 364 | // Benjamin Franklin is famous for his experiments in electricity and the invention of the lightning rod. 365 | "franklin", 366 | 367 | // Yuri Alekseyevich Gagarin - Soviet pilot and cosmonaut, best known as the first human to journey into outer space. https://en.wikipedia.org/wiki/Yuri_Gagarin 368 | "gagarin", 369 | 370 | // Galileo was a founding father of modern astronomy, and faced politics and obscurantism to establish scientific truth. https://en.wikipedia.org/wiki/Galileo_Galilei 371 | "galileo", 372 | 373 | // Évariste Galois - French mathematician whose work laid the foundations of Galois theory and group theory, two major branches of abstract algebra, and the subfield of Galois connections, all while still in his late teens. https://en.wikipedia.org/wiki/%C3%89variste_Galois 374 | "galois", 375 | 376 | // Kadambini Ganguly - Indian physician, known for being the first South Asian female physician, trained in western medicine, to graduate in South Asia. https://en.wikipedia.org/wiki/Kadambini_Ganguly 377 | "ganguly", 378 | 379 | // William Henry "Bill" Gates III is an American business magnate, philanthropist, investor, computer programmer, and inventor. https://en.wikipedia.org/wiki/Bill_Gates 380 | "gates", 381 | 382 | // Johann Carl Friedrich Gauss - German mathematician who made significant contributions to many fields, including number theory, algebra, statistics, analysis, differential geometry, geodesy, geophysics, mechanics, electrostatics, magnetic fields, astronomy, matrix theory, and optics. https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss 383 | "gauss", 384 | 385 | // Marie-Sophie Germain - French mathematician, physicist and philosopher. Known for her work on elasticity theory, number theory and philosophy. https://en.wikipedia.org/wiki/Sophie_Germain 386 | "germain", 387 | 388 | // Adele Goldberg, was one of the designers and developers of the Smalltalk language. https://en.wikipedia.org/wiki/Adele_Goldberg_(computer_scientist) 389 | "goldberg", 390 | 391 | // Adele Goldstine, born Adele Katz, wrote the complete technical description for the first electronic digital computer, ENIAC. https://en.wikipedia.org/wiki/Adele_Goldstine 392 | "goldstine", 393 | 394 | // Shafi Goldwasser is a computer scientist known for creating theoretical foundations of modern cryptography. Winner of 2012 ACM Turing Award. https://en.wikipedia.org/wiki/Shafi_Goldwasser 395 | "goldwasser", 396 | 397 | // James Golick, all around gangster. 398 | "golick", 399 | 400 | // Jane Goodall - British primatologist, ethologist, and anthropologist who is considered to be the world's foremost expert on chimpanzees - https://en.wikipedia.org/wiki/Jane_Goodall 401 | "goodall", 402 | 403 | // Stephen Jay Gould was was an American paleontologist, evolutionary biologist, and historian of science. He is most famous for the theory of punctuated equilibrium - https://en.wikipedia.org/wiki/Stephen_Jay_Gould 404 | "gould", 405 | 406 | // Carolyn Widney Greider - American molecular biologist and joint winner of the 2009 Nobel Prize for Physiology or Medicine for the discovery of telomerase. https://en.wikipedia.org/wiki/Carol_W._Greider 407 | "greider", 408 | 409 | // Alexander Grothendieck - German-born French mathematician who became a leading figure in the creation of modern algebraic geometry. https://en.wikipedia.org/wiki/Alexander_Grothendieck 410 | "grothendieck", 411 | 412 | // Lois Haibt - American computer scientist, part of the team at IBM that developed FORTRAN - https://en.wikipedia.org/wiki/Lois_Haibt 413 | "haibt", 414 | 415 | // Margaret Hamilton - Director of the Software Engineering Division of the MIT Instrumentation Laboratory, which developed on-board flight software for the Apollo space program. https://en.wikipedia.org/wiki/Margaret_Hamilton_(scientist) 416 | "hamilton", 417 | 418 | // Caroline Harriet Haslett - English electrical engineer, electricity industry administrator and champion of women's rights. Co-author of British Standard 1363 that specifies AC power plugs and sockets used across the United Kingdom (which is widely considered as one of the safest designs). https://en.wikipedia.org/wiki/Caroline_Haslett 419 | "haslett", 420 | 421 | // Stephen Hawking pioneered the field of cosmology by combining general relativity and quantum mechanics. https://en.wikipedia.org/wiki/Stephen_Hawking 422 | "hawking", 423 | 424 | // Werner Heisenberg was a founding father of quantum mechanics. https://en.wikipedia.org/wiki/Werner_Heisenberg 425 | "heisenberg", 426 | 427 | // Martin Edward Hellman - American cryptologist, best known for his invention of public-key cryptography in co-operation with Whitfield Diffie and Ralph Merkle. https://en.wikipedia.org/wiki/Martin_Hellman 428 | "hellman", 429 | 430 | // Grete Hermann was a German philosopher noted for her philosophical work on the foundations of quantum mechanics. https://en.wikipedia.org/wiki/Grete_Hermann 431 | "hermann", 432 | 433 | // Caroline Lucretia Herschel - German astronomer and discoverer of several comets. https://en.wikipedia.org/wiki/Caroline_Herschel 434 | "herschel", 435 | 436 | // Heinrich Rudolf Hertz - German physicist who first conclusively proved the existence of the electromagnetic waves. https://en.wikipedia.org/wiki/Heinrich_Hertz 437 | "hertz", 438 | 439 | // Jaroslav Heyrovský was the inventor of the polarographic method, father of the electroanalytical method, and recipient of the Nobel Prize in 1959. His main field of work was polarography. https://en.wikipedia.org/wiki/Jaroslav_Heyrovsk%C3%BD 440 | "heyrovsky", 441 | 442 | // Dorothy Hodgkin was a British biochemist, credited with the development of protein crystallography. She was awarded the Nobel Prize in Chemistry in 1964. https://en.wikipedia.org/wiki/Dorothy_Hodgkin 443 | "hodgkin", 444 | 445 | // Douglas R. Hofstadter is an American professor of cognitive science and author of the Pulitzer Prize and American Book Award-winning work Goedel, Escher, Bach: An Eternal Golden Braid in 1979. A mind-bending work which coined Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's Law." https://en.wikipedia.org/wiki/Douglas_Hofstadter 446 | "hofstadter", 447 | 448 | // Erna Schneider Hoover revolutionized modern communication by inventing a computerized telephone switching method. https://en.wikipedia.org/wiki/Erna_Schneider_Hoover 449 | "hoover", 450 | 451 | // Grace Hopper developed the first compiler for a computer programming language and is credited with popularizing the term "debugging" for fixing computer glitches. https://en.wikipedia.org/wiki/Grace_Hopper 452 | "hopper", 453 | 454 | // Frances Hugle, she was an American scientist, engineer, and inventor who contributed to the understanding of semiconductors, integrated circuitry, and the unique electrical principles of microscopic materials. https://en.wikipedia.org/wiki/Frances_Hugle 455 | "hugle", 456 | 457 | // Hypatia - Greek Alexandrine Neoplatonist philosopher in Egypt who was one of the earliest mothers of mathematics - https://en.wikipedia.org/wiki/Hypatia 458 | "hypatia", 459 | 460 | // Teruko Ishizaka - Japanese scientist and immunologist who co-discovered the antibody class Immunoglobulin E. https://en.wikipedia.org/wiki/Teruko_Ishizaka 461 | "ishizaka", 462 | 463 | // Mary Jackson, American mathematician and aerospace engineer who earned the highest title within NASA's engineering department - https://en.wikipedia.org/wiki/Mary_Jackson_(engineer) 464 | "jackson", 465 | 466 | // Yeong-Sil Jang was a Korean scientist and astronomer during the Joseon Dynasty; he invented the first metal printing press and water gauge. https://en.wikipedia.org/wiki/Jang_Yeong-sil 467 | "jang", 468 | 469 | // Mae Carol Jemison - is an American engineer, physician, and former NASA astronaut. She became the first black woman to travel in space when she served as a mission specialist aboard the Space Shuttle Endeavour - https://en.wikipedia.org/wiki/Mae_Jemison 470 | "jemison", 471 | 472 | // Betty Jennings - one of the original programmers of the ENIAC. https://en.wikipedia.org/wiki/ENIAC - https://en.wikipedia.org/wiki/Jean_Bartik 473 | "jennings", 474 | 475 | // Mary Lou Jepsen, was the founder and chief technology officer of One Laptop Per Child (OLPC), and the founder of Pixel Qi. https://en.wikipedia.org/wiki/Mary_Lou_Jepsen 476 | "jepsen", 477 | 478 | // Katherine Coleman Goble Johnson - American physicist and mathematician contributed to the NASA. https://en.wikipedia.org/wiki/Katherine_Johnson 479 | "johnson", 480 | 481 | // Irène Joliot-Curie - French scientist who was awarded the Nobel Prize for Chemistry in 1935. Daughter of Marie and Pierre Curie. https://en.wikipedia.org/wiki/Ir%C3%A8ne_Joliot-Curie 482 | "joliot", 483 | 484 | // Karen Spärck Jones came up with the concept of inverse document frequency, which is used in most search engines today. https://en.wikipedia.org/wiki/Karen_Sp%C3%A4rck_Jones 485 | "jones", 486 | 487 | // A. P. J. Abdul Kalam - is an Indian scientist aka Missile Man of India for his work on the development of ballistic missile and launch vehicle technology - https://en.wikipedia.org/wiki/A._P._J._Abdul_Kalam 488 | "kalam", 489 | 490 | // Sergey Petrovich Kapitsa (Russian: Серге́й Петро́вич Капи́ца; 14 February 1928 – 14 August 2012) was a Russian physicist and demographer. He was best known as host of the popular and long-running Russian scientific TV show, Evident, but Incredible. His father was the Nobel laureate Soviet-era physicist Pyotr Kapitsa, and his brother was the geographer and Antarctic explorer Andrey Kapitsa. - https://en.wikipedia.org/wiki/Sergey_Kapitsa 491 | "kapitsa", 492 | 493 | // Susan Kare, created the icons and many of the interface elements for the original Apple Macintosh in the 1980s, and was an original employee of NeXT, working as the Creative Director. https://en.wikipedia.org/wiki/Susan_Kare 494 | "kare", 495 | 496 | // Mstislav Keldysh - a Soviet scientist in the field of mathematics and mechanics, academician of the USSR Academy of Sciences (1946), President of the USSR Academy of Sciences (1961–1975), three times Hero of Socialist Labor (1956, 1961, 1971), fellow of the Royal Society of Edinburgh (1968). https://en.wikipedia.org/wiki/Mstislav_Keldysh 497 | "keldysh", 498 | 499 | // Mary Kenneth Keller, Sister Mary Kenneth Keller became the first American woman to earn a PhD in Computer Science in 1965. https://en.wikipedia.org/wiki/Mary_Kenneth_Keller 500 | "keller", 501 | 502 | // Johannes Kepler, German astronomer known for his three laws of planetary motion - https://en.wikipedia.org/wiki/Johannes_Kepler 503 | "kepler", 504 | 505 | // Omar Khayyam - Persian mathematician, astronomer and poet. Known for his work on the classification and solution of cubic equations, for his contribution to the understanding of Euclid's fifth postulate and for computing the length of a year very accurately. https://en.wikipedia.org/wiki/Omar_Khayyam 506 | "khayyam", 507 | 508 | // Har Gobind Khorana - Indian-American biochemist who shared the 1968 Nobel Prize for Physiology - https://en.wikipedia.org/wiki/Har_Gobind_Khorana 509 | "khorana", 510 | 511 | // Jack Kilby invented silicon integrated circuits and gave Silicon Valley its name. - https://en.wikipedia.org/wiki/Jack_Kilby 512 | "kilby", 513 | 514 | // Maria Kirch - German astronomer and first woman to discover a comet - https://en.wikipedia.org/wiki/Maria_Margarethe_Kirch 515 | "kirch", 516 | 517 | // Donald Knuth - American computer scientist, author of "The Art of Computer Programming" and creator of the TeX typesetting system. https://en.wikipedia.org/wiki/Donald_Knuth 518 | "knuth", 519 | 520 | // Sophie Kowalevski - Russian mathematician responsible for important original contributions to analysis, differential equations and mechanics - https://en.wikipedia.org/wiki/Sofia_Kovalevskaya 521 | "kowalevski", 522 | 523 | // Marie-Jeanne de Lalande - French astronomer, mathematician and cataloguer of stars - https://en.wikipedia.org/wiki/Marie-Jeanne_de_Lalande 524 | "lalande", 525 | 526 | // Hedy Lamarr - Actress and inventor. The principles of her work are now incorporated into modern Wi-Fi, CDMA and Bluetooth technology. https://en.wikipedia.org/wiki/Hedy_Lamarr 527 | "lamarr", 528 | 529 | // Leslie B. Lamport - American computer scientist. Lamport is best known for his seminal work in distributed systems and was the winner of the 2013 Turing Award. https://en.wikipedia.org/wiki/Leslie_Lamport 530 | "lamport", 531 | 532 | // Mary Leakey - British paleoanthropologist who discovered the first fossilized Proconsul skull - https://en.wikipedia.org/wiki/Mary_Leakey 533 | "leakey", 534 | 535 | // Henrietta Swan Leavitt - she was an American astronomer who discovered the relation between the luminosity and the period of Cepheid variable stars. https://en.wikipedia.org/wiki/Henrietta_Swan_Leavitt 536 | "leavitt", 537 | 538 | // Esther Miriam Zimmer Lederberg - American microbiologist and a pioneer of bacterial genetics. https://en.wikipedia.org/wiki/Esther_Lederberg 539 | "lederberg", 540 | 541 | // Inge Lehmann - Danish seismologist and geophysicist. Known for discovering in 1936 that the Earth has a solid inner core inside a molten outer core. https://en.wikipedia.org/wiki/Inge_Lehmann 542 | "lehmann", 543 | 544 | // Daniel Lewin - Mathematician, Akamai co-founder, soldier, 9/11 victim-- Developed optimization techniques for routing traffic on the internet. Died attempting to stop the 9-11 hijackers. https://en.wikipedia.org/wiki/Daniel_Lewin 545 | "lewin", 546 | 547 | // Ruth Lichterman - one of the original programmers of the ENIAC. https://en.wikipedia.org/wiki/ENIAC - https://en.wikipedia.org/wiki/Ruth_Teitelbaum 548 | "lichterman", 549 | 550 | // Barbara Liskov - co-developed the Liskov substitution principle. Liskov was also the winner of the Turing Prize in 2008. - https://en.wikipedia.org/wiki/Barbara_Liskov 551 | "liskov", 552 | 553 | // Ada Lovelace invented the first algorithm. https://en.wikipedia.org/wiki/Ada_Lovelace (thanks James Turnbull) 554 | "lovelace", 555 | 556 | // Auguste and Louis Lumière - the first filmmakers in history - https://en.wikipedia.org/wiki/Auguste_and_Louis_Lumi%C3%A8re 557 | "lumiere", 558 | 559 | // Mahavira - Ancient Indian mathematician during 9th century AD who discovered basic algebraic identities - https://en.wikipedia.org/wiki/Mah%C4%81v%C4%ABra_(mathematician) 560 | "mahavira", 561 | 562 | // Lynn Margulis (b. Lynn Petra Alexander) - an American evolutionary theorist and biologist, science author, educator, and popularizer, and was the primary modern proponent for the significance of symbiosis in evolution. - https://en.wikipedia.org/wiki/Lynn_Margulis 563 | "margulis", 564 | 565 | // Yukihiro Matsumoto - Japanese computer scientist and software programmer best known as the chief designer of the Ruby programming language. https://en.wikipedia.org/wiki/Yukihiro_Matsumoto 566 | "matsumoto", 567 | 568 | // James Clerk Maxwell - Scottish physicist, best known for his formulation of electromagnetic theory. https://en.wikipedia.org/wiki/James_Clerk_Maxwell 569 | "maxwell", 570 | 571 | // Maria Mayer - American theoretical physicist and Nobel laureate in Physics for proposing the nuclear shell model of the atomic nucleus - https://en.wikipedia.org/wiki/Maria_Mayer 572 | "mayer", 573 | 574 | // John McCarthy invented LISP: https://en.wikipedia.org/wiki/John_McCarthy_(computer_scientist) 575 | "mccarthy", 576 | 577 | // Barbara McClintock - a distinguished American cytogeneticist, 1983 Nobel Laureate in Physiology or Medicine for discovering transposons. https://en.wikipedia.org/wiki/Barbara_McClintock 578 | "mcclintock", 579 | 580 | // Anne Laura Dorinthea McLaren - British developmental biologist whose work helped lead to human in-vitro fertilisation. https://en.wikipedia.org/wiki/Anne_McLaren 581 | "mclaren", 582 | 583 | // Malcolm McLean invented the modern shipping container: https://en.wikipedia.org/wiki/Malcom_McLean 584 | "mclean", 585 | 586 | // Kay McNulty - one of the original programmers of the ENIAC. https://en.wikipedia.org/wiki/ENIAC - https://en.wikipedia.org/wiki/Kathleen_Antonelli 587 | "mcnulty", 588 | 589 | // Lise Meitner - Austrian/Swedish physicist who was involved in the discovery of nuclear fission. The element meitnerium is named after her - https://en.wikipedia.org/wiki/Lise_Meitner 590 | "meitner", 591 | 592 | // Gregor Johann Mendel - Czech scientist and founder of genetics. https://en.wikipedia.org/wiki/Gregor_Mendel 593 | "mendel", 594 | 595 | // Dmitri Mendeleev - a chemist and inventor. He formulated the Periodic Law, created a farsighted version of the periodic table of elements, and used it to correct the properties of some already discovered elements and also to predict the properties of eight elements yet to be discovered. https://en.wikipedia.org/wiki/Dmitri_Mendeleev 596 | "mendeleev", 597 | 598 | // Carla Meninsky, was the game designer and programmer for Atari 2600 games Dodge 'Em and Warlords. https://en.wikipedia.org/wiki/Carla_Meninsky 599 | "meninsky", 600 | 601 | // Ralph C. Merkle - American computer scientist, known for devising Merkle's puzzles - one of the very first schemes for public-key cryptography. Also, inventor of Merkle trees and co-inventor of the Merkle-Damgård construction for building collision-resistant cryptographic hash functions and the Merkle-Hellman knapsack cryptosystem. https://en.wikipedia.org/wiki/Ralph_Merkle 602 | "merkle", 603 | 604 | // Johanna Mestorf - German prehistoric archaeologist and first female museum director in Germany - https://en.wikipedia.org/wiki/Johanna_Mestorf 605 | "mestorf", 606 | 607 | // Maryam Mirzakhani - an Iranian mathematician and the first woman to win the Fields Medal. https://en.wikipedia.org/wiki/Maryam_Mirzakhani 608 | "mirzakhani", 609 | 610 | // Rita Levi-Montalcini - Won Nobel Prize in Physiology or Medicine jointly with colleague Stanley Cohen for the discovery of nerve growth factor (https://en.wikipedia.org/wiki/Rita_Levi-Montalcini) 611 | "montalcini", 612 | 613 | // Gordon Earle Moore - American engineer, Silicon Valley founding father, author of Moore's law. https://en.wikipedia.org/wiki/Gordon_Moore 614 | "moore", 615 | 616 | // Samuel Morse - contributed to the invention of a single-wire telegraph system based on European telegraphs and was a co-developer of the Morse code - https://en.wikipedia.org/wiki/Samuel_Morse 617 | "morse", 618 | 619 | // May-Britt Moser - Nobel prize winner neuroscientist who contributed to the discovery of grid cells in the brain. https://en.wikipedia.org/wiki/May-Britt_Moser 620 | "moser", 621 | 622 | // Ian Murdock - founder of the Debian project - https://en.wikipedia.org/wiki/Ian_Murdock 623 | "murdock", 624 | 625 | // John Napier of Merchiston - Scottish landowner known as an astronomer, mathematician and physicist. Best known for his discovery of logarithms. https://en.wikipedia.org/wiki/John_Napier 626 | "napier", 627 | 628 | // John Forbes Nash, Jr. - American mathematician who made fundamental contributions to game theory, differential geometry, and the study of partial differential equations. https://en.wikipedia.org/wiki/John_Forbes_Nash_Jr. 629 | "nash", 630 | 631 | // John von Neumann - todays computer architectures are based on the von Neumann architecture. https://en.wikipedia.org/wiki/Von_Neumann_architecture 632 | "neumann", 633 | 634 | // Isaac Newton invented classic mechanics and modern optics. https://en.wikipedia.org/wiki/Isaac_Newton 635 | "newton", 636 | 637 | // Florence Nightingale, more prominently known as a nurse, was also the first female member of the Royal Statistical Society and a pioneer in statistical graphics https://en.wikipedia.org/wiki/Florence_Nightingale#Statistics_and_sanitary_reform 638 | "nightingale", 639 | 640 | // Alfred Nobel - a Swedish chemist, engineer, innovator, and armaments manufacturer (inventor of dynamite) - https://en.wikipedia.org/wiki/Alfred_Nobel 641 | "nobel", 642 | 643 | // Emmy Noether, German mathematician. Noether's Theorem is named after her. https://en.wikipedia.org/wiki/Emmy_Noether 644 | "noether", 645 | 646 | // Poppy Northcutt. Poppy Northcutt was the first woman to work as part of NASA’s Mission Control. http://www.businessinsider.com/poppy-northcutt-helped-apollo-astronauts-2014-12?op=1 647 | "northcutt", 648 | 649 | // Robert Noyce invented silicon integrated circuits and gave Silicon Valley its name. - https://en.wikipedia.org/wiki/Robert_Noyce 650 | "noyce", 651 | 652 | // Panini - Ancient Indian linguist and grammarian from 4th century CE who worked on the world's first formal system - https://en.wikipedia.org/wiki/P%C4%81%E1%B9%87ini#Comparison_with_modern_formal_systems 653 | "panini", 654 | 655 | // Ambroise Pare invented modern surgery. https://en.wikipedia.org/wiki/Ambroise_Par%C3%A9 656 | "pare", 657 | 658 | // Blaise Pascal, French mathematician, physicist, and inventor - https://en.wikipedia.org/wiki/Blaise_Pascal 659 | "pascal", 660 | 661 | // Louis Pasteur discovered vaccination, fermentation and pasteurization. https://en.wikipedia.org/wiki/Louis_Pasteur. 662 | "pasteur", 663 | 664 | // Cecilia Payne-Gaposchkin was an astronomer and astrophysicist who, in 1925, proposed in her Ph.D. thesis an explanation for the composition of stars in terms of the relative abundances of hydrogen and helium. https://en.wikipedia.org/wiki/Cecilia_Payne-Gaposchkin 665 | "payne", 666 | 667 | // Radia Perlman is a software designer and network engineer and most famous for her invention of the spanning-tree protocol (STP). https://en.wikipedia.org/wiki/Radia_Perlman 668 | "perlman", 669 | 670 | // Rob Pike was a key contributor to Unix, Plan 9, the X graphic system, utf-8, and the Go programming language. https://en.wikipedia.org/wiki/Rob_Pike 671 | "pike", 672 | 673 | // Henri Poincaré made fundamental contributions in several fields of mathematics. https://en.wikipedia.org/wiki/Henri_Poincar%C3%A9 674 | "poincare", 675 | 676 | // Laura Poitras is a director and producer whose work, made possible by open source crypto tools, advances the causes of truth and freedom of information by reporting disclosures by whistleblowers such as Edward Snowden. https://en.wikipedia.org/wiki/Laura_Poitras 677 | "poitras", 678 | 679 | // Tat’yana Avenirovna Proskuriakova (Russian: Татья́на Авени́ровна Проскуряко́ва) (January 23 [O.S. January 10] 1909 – August 30, 1985) was a Russian-American Mayanist scholar and archaeologist who contributed significantly to the deciphering of Maya hieroglyphs, the writing system of the pre-Columbian Maya civilization of Mesoamerica. https://en.wikipedia.org/wiki/Tatiana_Proskouriakoff 680 | "proskuriakova", 681 | 682 | // Claudius Ptolemy - a Greco-Egyptian writer of Alexandria, known as a mathematician, astronomer, geographer, astrologer, and poet of a single epigram in the Greek Anthology - https://en.wikipedia.org/wiki/Ptolemy 683 | "ptolemy", 684 | 685 | // C. V. Raman - Indian physicist who won the Nobel Prize in 1930 for proposing the Raman effect. - https://en.wikipedia.org/wiki/C._V._Raman 686 | "raman", 687 | 688 | // Srinivasa Ramanujan - Indian mathematician and autodidact who made extraordinary contributions to mathematical analysis, number theory, infinite series, and continued fractions. - https://en.wikipedia.org/wiki/Srinivasa_Ramanujan 689 | "ramanujan", 690 | 691 | // Ida Rhodes - American pioneer in computer programming, designed the first computer used for Social Security. https://en.wikipedia.org/wiki/Ida_Rhodes 692 | "rhodes", 693 | 694 | // Sally Kristen Ride was an American physicist and astronaut. She was the first American woman in space, and the youngest American astronaut. https://en.wikipedia.org/wiki/Sally_Ride 695 | "ride", 696 | 697 | // Dennis Ritchie - co-creator of UNIX and the C programming language. - https://en.wikipedia.org/wiki/Dennis_Ritchie 698 | "ritchie", 699 | 700 | // Julia Hall Bowman Robinson - American mathematician renowned for her contributions to the fields of computability theory and computational complexity theory. https://en.wikipedia.org/wiki/Julia_Robinson 701 | "robinson", 702 | 703 | // Wilhelm Conrad Röntgen - German physicist who was awarded the first Nobel Prize in Physics in 1901 for the discovery of X-rays (Röntgen rays). https://en.wikipedia.org/wiki/Wilhelm_R%C3%B6ntgen 704 | "roentgen", 705 | 706 | // Rosalind Franklin - British biophysicist and X-ray crystallographer whose research was critical to the understanding of DNA - https://en.wikipedia.org/wiki/Rosalind_Franklin 707 | "rosalind", 708 | 709 | // Vera Rubin - American astronomer who pioneered work on galaxy rotation rates. https://en.wikipedia.org/wiki/Vera_Rubin 710 | "rubin", 711 | 712 | // Meghnad Saha - Indian astrophysicist best known for his development of the Saha equation, used to describe chemical and physical conditions in stars - https://en.wikipedia.org/wiki/Meghnad_Saha 713 | "saha", 714 | 715 | // Jean E. Sammet developed FORMAC, the first widely used computer language for symbolic manipulation of mathematical formulas. https://en.wikipedia.org/wiki/Jean_E._Sammet 716 | "sammet", 717 | 718 | // Mildred Sanderson - American mathematician best known for Sanderson's theorem concerning modular invariants. https://en.wikipedia.org/wiki/Mildred_Sanderson 719 | "sanderson", 720 | 721 | // Satoshi Nakamoto is the name used by the unknown person or group of people who developed bitcoin, authored the bitcoin white paper, and created and deployed bitcoin's original reference implementation. https://en.wikipedia.org/wiki/Satoshi_Nakamoto 722 | "satoshi", 723 | 724 | // Adi Shamir - Israeli cryptographer whose numerous inventions and contributions to cryptography include the Ferge Fiat Shamir identification scheme, the Rivest Shamir Adleman (RSA) public-key cryptosystem, the Shamir's secret sharing scheme, the breaking of the Merkle-Hellman cryptosystem, the TWINKLE and TWIRL factoring devices and the discovery of differential cryptanalysis (with Eli Biham). https://en.wikipedia.org/wiki/Adi_Shamir 725 | "shamir", 726 | 727 | // Claude Shannon - The father of information theory and founder of digital circuit design theory. (https://en.wikipedia.org/wiki/Claude_Shannon) 728 | "shannon", 729 | 730 | // Carol Shaw - Originally an Atari employee, Carol Shaw is said to be the first female video game designer. https://en.wikipedia.org/wiki/Carol_Shaw_(video_game_designer) 731 | "shaw", 732 | 733 | // Dame Stephanie "Steve" Shirley - Founded a software company in 1962 employing women working from home. https://en.wikipedia.org/wiki/Steve_Shirley 734 | "shirley", 735 | 736 | // William Shockley co-invented the transistor - https://en.wikipedia.org/wiki/William_Shockley 737 | "shockley", 738 | 739 | // Lina Solomonovna Stern (or Shtern; Russian: Лина Соломоновна Штерн; 26 August 1878 – 7 March 1968) was a Soviet biochemist, physiologist and humanist whose medical discoveries saved thousands of lives at the fronts of World War II. She is best known for her pioneering work on blood–brain barrier, which she described as hemato-encephalic barrier in 1921. https://en.wikipedia.org/wiki/Lina_Stern 740 | "shtern", 741 | 742 | // Françoise Barré-Sinoussi - French virologist and Nobel Prize Laureate in Physiology or Medicine; her work was fundamental in identifying HIV as the cause of AIDS. https://en.wikipedia.org/wiki/Fran%C3%A7oise_Barr%C3%A9-Sinoussi 743 | "sinoussi", 744 | 745 | // Betty Snyder - one of the original programmers of the ENIAC. https://en.wikipedia.org/wiki/ENIAC - https://en.wikipedia.org/wiki/Betty_Holberton 746 | "snyder", 747 | 748 | // Cynthia Solomon - Pioneer in the fields of artificial intelligence, computer science and educational computing. Known for creation of Logo, an educational programming language. https://en.wikipedia.org/wiki/Cynthia_Solomon 749 | "solomon", 750 | 751 | // Frances Spence - one of the original programmers of the ENIAC. https://en.wikipedia.org/wiki/ENIAC - https://en.wikipedia.org/wiki/Frances_Spence 752 | "spence", 753 | 754 | // Michael Stonebraker is a database research pioneer and architect of Ingres, Postgres, VoltDB and SciDB. Winner of 2014 ACM Turing Award. https://en.wikipedia.org/wiki/Michael_Stonebraker 755 | "stonebraker", 756 | 757 | // Ivan Edward Sutherland - American computer scientist and Internet pioneer, widely regarded as the father of computer graphics. https://en.wikipedia.org/wiki/Ivan_Sutherland 758 | "sutherland", 759 | 760 | // Janese Swanson (with others) developed the first of the Carmen Sandiego games. She went on to found Girl Tech. https://en.wikipedia.org/wiki/Janese_Swanson 761 | "swanson", 762 | 763 | // Aaron Swartz was influential in creating RSS, Markdown, Creative Commons, Reddit, and much of the internet as we know it today. He was devoted to freedom of information on the web. https://en.wikiquote.org/wiki/Aaron_Swartz 764 | "swartz", 765 | 766 | // Bertha Swirles was a theoretical physicist who made a number of contributions to early quantum theory. https://en.wikipedia.org/wiki/Bertha_Swirles 767 | "swirles", 768 | 769 | // Helen Brooke Taussig - American cardiologist and founder of the field of paediatric cardiology. https://en.wikipedia.org/wiki/Helen_B._Taussig 770 | "taussig", 771 | 772 | // Nikola Tesla invented the AC electric system and every gadget ever used by a James Bond villain. https://en.wikipedia.org/wiki/Nikola_Tesla 773 | "tesla", 774 | 775 | // Marie Tharp - American geologist and oceanic cartographer who co-created the first scientific map of the Atlantic Ocean floor. Her work led to the acceptance of the theories of plate tectonics and continental drift. https://en.wikipedia.org/wiki/Marie_Tharp 776 | "tharp", 777 | 778 | // Ken Thompson - co-creator of UNIX and the C programming language - https://en.wikipedia.org/wiki/Ken_Thompson 779 | "thompson", 780 | 781 | // Linus Torvalds invented Linux and Git. https://en.wikipedia.org/wiki/Linus_Torvalds 782 | "torvalds", 783 | 784 | // Youyou Tu - Chinese pharmaceutical chemist and educator known for discovering artemisinin and dihydroartemisinin, used to treat malaria, which has saved millions of lives. Joint winner of the 2015 Nobel Prize in Physiology or Medicine. https://en.wikipedia.org/wiki/Tu_Youyou 785 | "tu", 786 | 787 | // Alan Turing was a founding father of computer science. https://en.wikipedia.org/wiki/Alan_Turing. 788 | "turing", 789 | 790 | // Varahamihira - Ancient Indian mathematician who discovered trigonometric formulae during 505-587 CE - https://en.wikipedia.org/wiki/Var%C4%81hamihira#Contributions 791 | "varahamihira", 792 | 793 | // Dorothy Vaughan was a NASA mathematician and computer programmer on the SCOUT launch vehicle program that put America's first satellites into space - https://en.wikipedia.org/wiki/Dorothy_Vaughan 794 | "vaughan", 795 | 796 | // Cédric Villani - French mathematician, won Fields Medal, Fermat Prize and Poincaré Price for his work in differential geometry and statistical mechanics. https://en.wikipedia.org/wiki/C%C3%A9dric_Villani 797 | "villani", 798 | 799 | // Sir Mokshagundam Visvesvaraya - is a notable Indian engineer. He is a recipient of the Indian Republic's highest honour, the Bharat Ratna, in 1955. On his birthday, 15 September is celebrated as Engineer's Day in India in his memory - https://en.wikipedia.org/wiki/Visvesvaraya 800 | "visvesvaraya", 801 | 802 | // Christiane Nüsslein-Volhard - German biologist, won Nobel Prize in Physiology or Medicine in 1995 for research on the genetic control of embryonic development. https://en.wikipedia.org/wiki/Christiane_N%C3%BCsslein-Volhard 803 | "volhard", 804 | 805 | // Marlyn Wescoff - one of the original programmers of the ENIAC. https://en.wikipedia.org/wiki/ENIAC - https://en.wikipedia.org/wiki/Marlyn_Meltzer 806 | "wescoff", 807 | 808 | // Sylvia B. Wilbur - British computer scientist who helped develop the ARPANET, was one of the first to exchange email in the UK and a leading researcher in computer-supported collaborative work. https://en.wikipedia.org/wiki/Sylvia_Wilbur 809 | "wilbur", 810 | 811 | // Andrew Wiles - Notable British mathematician who proved the enigmatic Fermat's Last Theorem - https://en.wikipedia.org/wiki/Andrew_Wiles 812 | "wiles", 813 | 814 | // Roberta Williams, did pioneering work in graphical adventure games for personal computers, particularly the King's Quest series. https://en.wikipedia.org/wiki/Roberta_Williams 815 | "williams", 816 | 817 | // Malcolm John Williamson - British mathematician and cryptographer employed by the GCHQ. Developed in 1974 what is now known as Diffie-Hellman key exchange (Diffie and Hellman first published the scheme in 1976). https://en.wikipedia.org/wiki/Malcolm_J._Williamson 818 | "williamson", 819 | 820 | // Sophie Wilson designed the first Acorn Micro-Computer and the instruction set for ARM processors. https://en.wikipedia.org/wiki/Sophie_Wilson 821 | "wilson", 822 | 823 | // Jeannette Wing - co-developed the Liskov substitution principle. - https://en.wikipedia.org/wiki/Jeannette_Wing 824 | "wing", 825 | 826 | // Steve Wozniak invented the Apple I and Apple II. https://en.wikipedia.org/wiki/Steve_Wozniak 827 | "wozniak", 828 | 829 | // The Wright brothers, Orville and Wilbur - credited with inventing and building the world's first successful airplane and making the first controlled, powered and sustained heavier-than-air human flight - https://en.wikipedia.org/wiki/Wright_brothers 830 | "wright", 831 | 832 | // Chien-Shiung Wu - Chinese-American experimental physicist who made significant contributions to nuclear physics. https://en.wikipedia.org/wiki/Chien-Shiung_Wu 833 | "wu", 834 | 835 | // Rosalyn Sussman Yalow - Rosalyn Sussman Yalow was an American medical physicist, and a co-winner of the 1977 Nobel Prize in Physiology or Medicine for development of the radioimmunoassay technique. https://en.wikipedia.org/wiki/Rosalyn_Sussman_Yalow 836 | "yalow", 837 | 838 | // Ada Yonath - an Israeli crystallographer, the first woman from the Middle East to win a Nobel prize in the sciences. https://en.wikipedia.org/wiki/Ada_Yonath 839 | "yonath", 840 | 841 | // Nikolay Yegorovich Zhukovsky (Russian: Никола́й Его́рович Жуко́вский, January 17 1847 – March 17, 1921) was a Russian scientist, mathematician and engineer, and a founding father of modern aero- and hydrodynamics. Whereas contemporary scientists scoffed at the idea of human flight, Zhukovsky was the first to undertake the study of airflow. He is often called the Father of Russian Aviation. https://en.wikipedia.org/wiki/Nikolay_Yegorovich_Zhukovsky 842 | "zhukovsky", 843 | } 844 | ) 845 | 846 | // GetRandomName generates a random name from the list of adjectives and surnames in this package 847 | // formatted as "adjective_surname". For example 'focused_turing'. If retry is non-zero, a random 848 | // integer between 0 and 10 will be added to the end of the name, e.g `focused_turing3` 849 | func GetRandomName(retry int) string { 850 | begin: 851 | name := left[rand.Intn(len(left))] + "_" + right[rand.Intn(len(right))] //nolint:gosec // G404: Use of weak random number generator (math/rand instead of crypto/rand) 852 | if name == "boring_wozniak" /* Steve Wozniak is not boring */ { 853 | goto begin 854 | } 855 | 856 | if retry > 0 { 857 | name += strconv.Itoa(rand.Intn(10)) //nolint:gosec // G404: Use of weak random number generator (math/rand instead of crypto/rand) 858 | } 859 | return name 860 | } 861 | -------------------------------------------------------------------------------- /pkg/openai/query.go: -------------------------------------------------------------------------------- 1 | package openai_dbchaos 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | openai "github.com/sashabaranov/go-openai" 7 | ) 8 | 9 | type OpenAI struct { 10 | APIkey string 11 | Model string 12 | } 13 | 14 | func (o *OpenAI) Prompt(query string) (string, error) { 15 | if o.Model == "" { 16 | o.Model = openai.GPT3Dot5Turbo 17 | } 18 | 19 | client := openai.NewClient(o.APIkey) 20 | resp, err := client.CreateChatCompletion( 21 | context.Background(), 22 | openai.ChatCompletionRequest{ 23 | Model: openai.GPT3Dot5Turbo, 24 | Messages: []openai.ChatCompletionMessage{ 25 | { 26 | Role: openai.ChatMessageRoleUser, 27 | Content: query, 28 | }, 29 | }, 30 | }, 31 | ) 32 | 33 | if err != nil { 34 | fmt.Printf("ChatCompletion error: %v\n", err) 35 | return "", err 36 | } 37 | 38 | return resp.Choices[0].Message.Content, nil 39 | } 40 | -------------------------------------------------------------------------------- /pkg/openai/query_test.go: -------------------------------------------------------------------------------- 1 | package openai_dbchaos 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func TestPrompt(t *testing.T) { 9 | query := "Generate Schema in SQL for Webshop database. Give me only SQL Commands No text." 10 | o := &OpenAI{ 11 | APIkey: "", 12 | } 13 | val, err := o.Prompt(query) 14 | if err != nil { 15 | t.Errorf("Prompt() returned an error: %v", err) 16 | } 17 | 18 | val, err = o.Prompt("Also give me the some SQL commands insert same data into the " + val + ". Give me only SQL Commands No text.") 19 | if err != nil { 20 | t.Errorf("Prompt() returned an error: %v", err) 21 | } 22 | fmt.Println(val) 23 | } 24 | -------------------------------------------------------------------------------- /pkg/runner/runner.go: -------------------------------------------------------------------------------- 1 | package runner 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "log" 7 | "strings" 8 | "sync" 9 | "time" 10 | 11 | "github.com/google/uuid" 12 | "go.mongodb.org/mongo-driver/bson" 13 | "go.mongodb.org/mongo-driver/mongo" 14 | "gorm.io/gorm" 15 | ) 16 | 17 | type DurationRunner struct { 18 | RunFor string 19 | Query string 20 | ParallelRuns int 21 | CoolOffTime int 22 | DB *gorm.DB 23 | MongoDB *mongo.Client 24 | RequestPerSecond int64 25 | DbType string 26 | DbName string // NoSQL Databases Only 27 | } 28 | 29 | func (d *DurationRunner) Run() error { 30 | 31 | runID := uuid.New().String() 32 | 33 | t := time.Now() 34 | d1, err := time.ParseDuration(d.RunFor) 35 | if err != nil { 36 | return err 37 | } 38 | 39 | var v struct{} 40 | var totalQueryCount int64 41 | c := time.Duration(d.CoolOffTime) * time.Second 42 | for time.Since(t) <= d1 { 43 | if totalQueryCount%1000 == 0 { 44 | fmt.Println("["+runID+"] : total queries executed so far = ", totalQueryCount) 45 | } 46 | var wg sync.WaitGroup 47 | wg.Add(d.ParallelRuns) 48 | for i := 0; i < d.ParallelRuns; i++ { 49 | totalQueryCount++ 50 | go func() { 51 | a := strings.Split(d.Query, ";") 52 | for _, a1 := range a { 53 | if strings.TrimSpace(a1) != "" { 54 | if d.DbType == "mongodb" { 55 | var filter interface{} 56 | if d.Query != "" { 57 | err := bson.UnmarshalExtJSON([]byte(d.Query), true, &filter) 58 | if err != nil { 59 | log.Println(err) 60 | } 61 | } 62 | d.MongoDB.Database(d.DbName).RunCommand(context.TODO(), filter) 63 | } else { 64 | if err := d.DB.Raw(a1).Scan(&v).Error; err != nil { 65 | log.Println(err) 66 | } 67 | } 68 | } 69 | } 70 | wg.Done() 71 | }() 72 | } 73 | wg.Wait() 74 | 75 | time.Sleep(c) 76 | } 77 | fmt.Println("["+runID+"] finished running chaos. total queries executed = ", totalQueryCount) 78 | 79 | return nil 80 | } 81 | -------------------------------------------------------------------------------- /pkg/utils/random.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "math/rand" 5 | "time" 6 | ) 7 | 8 | type Charset string 9 | 10 | const ( 11 | CharsetAlphaNumeric Charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" 12 | CharsetAlphabet Charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" 13 | CharsetLower Charset = "abcdefghijklmnopqrstuvwxyz" 14 | CharsetUpper Charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 15 | ) 16 | 17 | func RandomString(charset Charset, length int) string { 18 | seededRand := rand.New(rand.NewSource(time.Now().UnixNano())) 19 | 20 | b := make([]byte, length) 21 | for i := range b { 22 | b[i] = charset[seededRand.Intn(len(charset))] 23 | } 24 | return string(b) 25 | } 26 | -------------------------------------------------------------------------------- /samples/mysql/README.md: -------------------------------------------------------------------------------- 1 | Queries for the Employees MySQL sample database - https://dev.mysql.com/doc/employee/en/ 2 | -------------------------------------------------------------------------------- /samples/postgres/README.md: -------------------------------------------------------------------------------- 1 | Queries for the Pagila sample Postgres Database - https://www.postgresql.org/ftp/projects/pgFoundry/dbsamples/pagila/pagila/ 2 | --------------------------------------------------------------------------------