The following query is working in Sequel:
table_sizes = db_config["SELECT table_name,table_rows / 1000000 as table_rows, data_length / 1000000 as data_length, index_length / 1000000 as index_length,round(((data_length + index_length) / 1024 / 1024 / 1024),5) 'size'
FROM information_schema.TABLES
WHERE table_schema = '#{db_name}' and table_name in ('table1','table2','table3'....'table20')"]
But, when I do something like this, neither of the queries work:
arr = ['table1','table2','table3'...'table20']
table_sizes = db_config["SELECT table_name,table_rows / 1000000 as table_rows, data_length / 1000000 as data_length, index_length / 1000000 as index_length,round(((data_length + index_length) / 1024 / 1024 / 1024),5) 'size'
FROM information_schema.TABLES
WHERE table_schema = '#{db_name}'"].filter(:table_name => arr)
or:
table_sizes = db_config["SELECT table_name,table_rows / 1000000 as table_rows, data_length / 1000000 as data_length, index_length / 1000000 as index_length,round(((data_length + index_length) / 1024 / 1024 / 1024),5) 'size'
FROM information_schema.TABLES
WHERE table_schema = '#{db_name}'"].where(:table_name => arr)
What's the best way I should go about this? Does Sequel not support filtering after results?