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

Handle table aliases for MySQL queries #30

Open
kianris opened this issue Jun 25, 2019 · 4 comments
Open

Handle table aliases for MySQL queries #30

kianris opened this issue Jun 25, 2019 · 4 comments

Comments

@kianris
Copy link

kianris commented Jun 25, 2019

I've been testing out Shiba with queries in a log file for a non-Ruby project. It seems like some queries are working with aliases but not others. Is this because there is no SQL parsing performed within Shiba yet?

Alternatively I could list the aliases as part of the /*shiba*/ metadata with each query.

@eac
Copy link
Contributor

eac commented Jun 26, 2019

I'll take a look at this. Can you include a sample from your log file of a query or two that aren't working?

@kianris
Copy link
Author

kianris commented Jun 27, 2019

In MySQL:

create table Shiba(id bigint not null auto_increment, primary key(id), value varchar(255));

Explain and review without alias
select * from Shiba

select * from Shiba:-2 ()
 * Table Scan: mysql reads 100% (1000) of the of the rows in **Shiba**, skipping any indexes.
 * Estimated query time: 0.01s

Explain and review with alias
select * from Shiba s

<No output>

@eac
Copy link
Contributor

eac commented Jul 2, 2019

Fix is almost ready, I'll try to get a release out in the next few days.

@eac
Copy link
Contributor

eac commented Jul 2, 2019

I've released support for capitalized table names and aliases for simple queries on mysql. More complex queries featuring joins aren't supported.

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