Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed SQL generation when encountering invalid tokens for a table #25

Open
zhangysh1995 opened this issue Jul 8, 2020 · 5 comments
Open

Comments

@zhangysh1995
Copy link
Contributor

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

@cyliu0
Copy link
Contributor

cyliu0 commented Aug 31, 2020

I don't really get it. Do you mean that we should not raise the error even if it's an illegal usage? I think this action is by design...

@zhangysh1995
Copy link
Contributor Author

@cyliu0 This issue is quite old, I suppose I could convert it into a feature request.

The current assumption is that all tables should have the same schema to run gosql. This is the reason why error is raised as 2020/07/08 07:07:50 Fatal Error: there is no int fields.

I think it helps to remove this assumption and support diverse table scheme, to make gosql run a any given database.

@cyliu0
Copy link
Contributor

cyliu0 commented Aug 31, 2020

Oh... I get your idea now... But some of our users may still need this. I got a quick solution to your request. Add an option to ignore the error or skip the check. Will this meet your requirement?

@cyliu0
Copy link
Contributor

cyliu0 commented Aug 31, 2020

And we have a plan to improve this tool recently. You are welcomed to touch me on slack workspace TiDB Community if you have more enhancement requirements.

@zhangysh1995
Copy link
Contributor Author

But some of our users may still need this.

I think to enable scan different table schema is not conflicting with scanning tables with the same scheme. The assumption is a special case of table schema, so may be it can be handled uniformly with different schema?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants