Giter VIP home page Giter VIP logo

go-randgen's People

Contributors

alivxxx avatar cyliu0 avatar deardrops avatar dqinyuan avatar hawkingrei avatar zhangysh1995 avatar zhouqiang-cl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-randgen's Issues

In the sqls we generated, does it have same sql ?

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.

_field selects non-existing columns in a table

t2 doesn't have an a column, but ais 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

Test failed `gendata/generators/letter.go:7:`

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 supports TiFlash

go-randgen exec will execute the query sql after generate data, and no option is provided to the users to set the TiFlash replica.

[Proposal] Add Support for PostgreSQL

I want to use this tool to test PostgreSQL compatible databases.

  • Support PostgreSQL syntax
  • Support to connect to the database
  • Support to run the generated queries
  • Provide an example yy file

I 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

环境

  • ubuntu 18.04
  • go version go1.10.4 linux/amd64

Call yy keyword from lua

Like this:

update_select:{table = _table()}
    BEIGIN ; UPDATE {print(table)}  ; SELECT {print(table)} ; ROLLBACK

Questions about general usage

Hi I'm interested in using this tool for my implementation. I have several questions:
我希望可以基于此工具开发我的软件。我有几个问题想要请教:

  1. How automatic is this tool? Could it run without any given 'zz' or 'yy' file?
    在不给定 zz 或者 yy 文件的情况下,这个工具能够自动生成语句吗?

  2. Is this tool compatible with other DBMSs such as MySQL, SQLite or PostgreSQL?
    此工具是否兼容其他的数据库系统,比如 MySQL?

Thank you :) 十分感谢

Failed SQL generation when encountering invalid tokens for a table

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

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.