aliyun / aliyun-odps-console

ODPS Console Source Code.
http://www.aliyun.com/product/odps
93 stars 26 forks source link

Add silent mode to odpscmd #5

Open kn45 opened 5 years ago

kn45 commented 5 years ago

Could we add silent mode to odpscmd as mysql and hive do? i.e. Make the stdout output of odpscmd -e "sql" the pure query result without table pattern like: (a weird newline here in stdout) +----+ | | +----+ This would really help if I want to save query result to local disk since odpscmd provides no query result -> local_disk command.

lyman commented 5 years ago

This would really help if I want to save query result to local disk since odpscmd provides no query result -> local_disk command.

Actually there is. Every query will generate a instance id. Use tunnel download instance://project_name/instance_id log.txt to download that query result into a local disk file.

kn45 commented 5 years ago

How can i get the instance id using odpscmd? Besides, is this method a kind of hack or a persistent feature provided officially? It seems not to be found in official manual.

guozhenhong commented 5 years ago

Could we add silent mode to odpscmd as mysql and hive do? i.e. Make the stdout output of odpscmd -e "sql" the pure query result without table pattern like: (a weird newline here in stdout) +----+ | | +----+ This would really help if I want to save query result to local disk since odpscmd provides no query result -> local_disk command.

Please try -M option . The stdout output of odpscmd -M -e "sql" is the CSV mode of the pure query result .

kn45 commented 5 years ago

Could we add silent mode to odpscmd as mysql and hive do? i.e. Make the stdout output of odpscmd -e "sql" the pure query result without table pattern like: (a weird newline here in stdout) +----+ | | +----+ This would really help if I want to save query result to local disk since odpscmd provides no query result -> local_disk command.

Please try -M option . The stdout output of odpscmd -M -e "sql" is the CSV mode of the pure query result .

I've tried 0.30.2-public(newest by now) 0.29.6 and 0.27.1 but it doesn't work still with table patterns. Should i make specific configuration or use client of a certain version?

guozhenhong commented 5 years ago

Could we add silent mode to odpscmd as mysql and hive do? i.e. Make the stdout output of odpscmd -e "sql" the pure query result without table pattern like: (a weird newline here in stdout) +----+ | | +----+ This would really help if I want to save query result to local disk since odpscmd provides no query result -> local_disk command.

Please try -M option . The stdout output of odpscmd -M -e "sql" is the CSV mode of the pure query result .

I've tried 0.30.2-public(newest by now) 0.29.6 and 0.27.1 but it doesn't work still with table patterns. Should i make specific configuration or use client of a certain version?

Have you try -M option?

./bin/odpscmd  -M  -e "select * from zhenhong_dual limit 2;"

ID = 20190319025015185g3758pzt2
Log view:
http://logview.odps.aliyun-inc.com:8080/logview/?...
Job Queueing.
Summary:

"key","value"
342,"v"
12,"v"

As shown above , the result is in csv mode. Is that what you want?

kn45 commented 5 years ago

Could we add silent mode to odpscmd as mysql and hive do? i.e. Make the stdout output of odpscmd -e "sql" the pure query result without table pattern like: (a weird newline here in stdout) +----+ | | +----+ This would really help if I want to save query result to local disk since odpscmd provides no query result -> local_disk command.

Please try -M option . The stdout output of odpscmd -M -e "sql" is the CSV mode of the pure query result .

I've tried 0.30.2-public(newest by now) 0.29.6 and 0.27.1 but it doesn't work still with table patterns. Should i make specific configuration or use client of a certain version?

Have you try -M option?

./bin/odpscmd  -M  -e "select * from zhenhong_dual limit 2;"

ID = 20190319025015185g3758pzt2
Log view:
http://logview.odps.aliyun-inc.com:8080/logview/?...
Job Queueing.
Summary:

"key","value"
342,"v"
12,"v"

As shown above , the result is in csv mode. Is that what you want?

Yeah i try with -M option. It seems that you're using internal(aliyun-inc) version which may be different with public version. I download client here http://repo.aliyun.com/odpscmd/?spm=a2c4g.11186623.2.19.52755c232q8c6B and try 0.30.2-public, 0.29.6 and 0.27.1. Or any tips on configuration?

./odpscmd -M -e "select * from test limit 1;"
ID = 20190320031759629gqop46pr2
Log view:
http://logview.odps.aliyun.com/logview/?h=http://service.odps.aliyun.com/...
Job Queueing.
+------------+------------+
| c1         | c2         | 
+------------+------------+
| a          | b          | 
+------------+------------+
1 records (at most 10000 supported) fetched by instance tunnel.
guozhenhong commented 5 years ago

Could we add silent mode to odpscmd as mysql and hive do? i.e. Make the stdout output of odpscmd -e "sql" the pure query result without table pattern like: (a weird newline here in stdout) +----+ | | +----+ This would really help if I want to save query result to local disk since odpscmd provides no query result -> local_disk command.

Please try -M option . The stdout output of odpscmd -M -e "sql" is the CSV mode of the pure query result .

I've tried 0.30.2-public(newest by now) 0.29.6 and 0.27.1 but it doesn't work still with table patterns. Should i make specific configuration or use client of a certain version?

Have you try -M option?

./bin/odpscmd  -M  -e "select * from zhenhong_dual limit 2;"

ID = 20190319025015185g3758pzt2
Log view:
http://logview.odps.aliyun-inc.com:8080/logview/?...
Job Queueing.
Summary:

"key","value"
342,"v"
12,"v"

As shown above , the result is in csv mode. Is that what you want?

Yeah i try with -M option. It seems that you're using internal(aliyun-inc) version which may be different with public version. I download client here http://repo.aliyun.com/odpscmd/?spm=a2c4g.11186623.2.19.52755c232q8c6B and try 0.30.2-public, 0.29.6 and 0.27.1. Or any tips on configuration?

./odpscmd -M -e "select * from test limit 1;"
ID = 20190320031759629gqop46pr2
Log view:
http://logview.odps.aliyun.com/logview/?h=http://service.odps.aliyun.com/...
Job Queueing.
+------------+------------+
| c1         | c2         | 
+------------+------------+
| a          | b          | 
+------------+------------+
1 records (at most 10000 supported) fetched by instance tunnel.

I found the difference. image

Not because of the public version problem, but because you are using instance tunnel . Actually, in the instance tunnel mode, CSV format is not supported yet.

Try to edit odps_config.ini file, and disable the instance tunnel.

use_instance_tunnel=false