Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add silent mode to odpscmd #5

Open
kn45 opened this issue Nov 1, 2018 · 7 comments
Open

Add silent mode to odpscmd #5

kn45 opened this issue Nov 1, 2018 · 7 comments

Comments

@kn45
Copy link

kn45 commented Nov 1, 2018

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
Copy link
Member

lyman commented Nov 1, 2018

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
Copy link
Author

kn45 commented Nov 26, 2018

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
Copy link
Collaborator

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
Copy link
Author

kn45 commented Mar 18, 2019

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
Copy link
Collaborator

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
Copy link
Author

kn45 commented Mar 20, 2019

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants