Created
July 24, 2015 06:49
-
-
Save anonymous/7ab55a033c659586641d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client = Mysql2::Client.new(:default_file => 'my-client.cnf', :default_group => 'client'") | |
results = client.query("SHOW DATABASES") | |
results.each do |row| | |
puts "#{row['Database']}" | |
end | |
--- | |
Output | |
information_schema | |
monitoring | |
mysql | |
notification | |
--- | |
What I want to do is then loop through the output and run this query, but exclude mysql and information_schema | |
mysql> SELECT COUNT(DISTINCT `table_name`) FROM `information_schema`.`columns` WHERE `table_schema` = 'monitoring'; | |
+------------------------------+ | |
| COUNT(DISTINCT `table_name`) | | |
+------------------------------+ | |
| 4 | | |
+------------------------------+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment