mzmcbride@tools-bastion-03:~$ echo "select dbname from wiki limit 3" | sql -vv meta Connecting to s7.analytics.db.svc.eqiad.wmflabs ['mysql', '--defaults-file=/home/mzmcbride/replica.my.cnf', '-h', 's7.analytics.db.svc.eqiad.wmflabs', 'meta_p'] dbname aawiki aawikibooks aawiktionary
Including the column header can sometimes be kind of annoying behavior, so let's leverage mysql's -N/--skip-column-names flag!
Using my patched version:
mzmcbride@tools-bastion-03:~$ echo "select dbname from wiki limit 3" | ./sql -N -vv meta Connecting to s7.analytics.db.svc.eqiad.wmflabs ['mysql', '--defaults-file=/home/mzmcbride/replica.my.cnf', '-N', '-h', 's7.analytics.db.svc.eqiad.wmflabs', 'meta_p'] aawiki aawikibooks aawiktionary
mzmcbride@tools-bastion-03:~$ diff -u /usr/bin/sql ./sql --- /usr/bin/sql 2018-03-05 18:29:19.000000000 +0000 +++ ./sql 2018-03-12 03:39:32.331253946 +0000 @@ -47,6 +47,9 @@ '-v', '--verbose', action='count', default=0, dest='loglevel', help='increase logging verbosity') parser.add_argument( + '-N', '--skip-column-names', default=None, + action='store_true', help='do not write column names in results') +parser.add_argument( '--cluster', default='analytics', choices=['analytics', 'web'], help='cluster to connect to') @@ -77,6 +80,9 @@ 'There is no configuration file for mysql to use, ' + 'you will probably be unable to access the database') +if args.skip_column_names: + exec_args.append('-N') + db = ALIASES.get(args.dbname, args.dbname) if db == 'meta_p':