shiba
shiba copied to clipboard
Handle table aliases for MySQL queries
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.
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?
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>
Fix is almost ready, I'll try to get a release out in the next few days.
I've released support for capitalized table names and aliases for simple queries on mysql. More complex queries featuring joins aren't supported.