pingcap / go-randgen Goto Github PK
View Code? Open in Web Editor NEWa QA tool to random generate sql by bnf pattern
a QA tool to random generate sql by bnf pattern
we use the yy example file of windows.yy, and in the command we set the --queries 100000. In the sqls we generated, does it have the same sql ? If it has the same sql,how to control to get less same sql.
Generate all possible sqls by a specified yy.
t2
doesn't have an a
column, but a
is selected in the generated SQLs:
mysql> desc t1;
+-------+---------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+------+---------+-------+
| a | int(11) | YES | | NULL | |
+-------+---------+------+------+---------+-------+
1 row in set (0.00 sec)
mysql> desc t2;
+-------+---------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+------+---------+-------+
| b | int(11) | YES | | NULL | |
+-------+---------+------+------+---------+-------+
1 row in set (0.00 sec)
--- SELECT `a` FROM t2; // wrong
--- SELECT `a` FROM t1 WHERE `a` > 7; // correct
Run the following
$ cd go-randgen && make all
Test failed
gendata/generators/letter.go:7: conversion from int to string yields a string of one rune, not a string of digits (did you mean fmt.Sprint(x)?)
Version
ubuntu@VM-0-15-ubuntu:~/go-randgen$ go version
go version go1.15 linux/amd64
go-randgen exec
will execute the query sql after generate data, and no option is provided to the users to set the TiFlash replica.
I want to use this tool to test PostgreSQL
compatible databases.
PostgreSQL
syntaxyy
fileI will submit a PR to implement this feature.
执行
go get -u github.com/pingcap/go-randgen/cmd/go-randgen
报错
# github.com/pingcap/go-randgen/grammar/sql_generator
../go/src/github.com/pingcap/go-randgen/grammar/sql_generator/sql_generator.go:330:86: undefined: io.StringWriter
Like this:
update_select:{table = _table()}
BEIGIN ; UPDATE {print(table)} ; SELECT {print(table)} ; ROLLBACK
how can I define relational tables ?
Hi I'm interested in using this tool for my implementation. I have several questions:
我希望可以基于此工具开发我的软件。我有几个问题想要请教:
How automatic is this tool? Could it run without any given 'zz' or 'yy' file?
在不给定 zz 或者 yy 文件的情况下,这个工具能够自动生成语句吗?
Is this tool compatible with other DBMSs such as MySQL, SQLite or PostgreSQL?
此工具是否兼容其他的数据库系统,比如 MySQL?
Thank you :) 十分感谢
Description:
If I have a table without int
type columns, and the grammar uses _field_int
, it will throw an error and exit directly:
Example:
zhangys@xxx:~/go/bin$ ./go-randgen gensql -Y ../src/github.com/pingcap/go-randgen/examples/functions.yy --dsn "root:@tcp(127.0.0.1:3000)/test" -Q 50
2020/07/08 07:07:50 Cache database meta info...
2020/07/08 07:07:50 Cache database meta info ok, start generate sqls by yy
2020/07/08 07:07:50 load yy from ../src/github.com/pingcap/go-randgen/examples/functions.yy
2020/07/08 07:07:50 Fatal Error: there is no int fields
Expected behavior:
It should roll back to the rule expansion to choose another one, then proceed to normal generation.
Diagnosis:
Please check for the root cause
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.