问题
I am trying to export a query from Teradata Studio 14.10
/ Aster
using the ncluster_export
command line function. I can't find a working example to go off of. Does anyone have one they could share? Also how would I actually run the script (ie ncluster_export myScript1.bat
)?
Assume the following :
File location: 'myhomedir'
Username: 'user1'
Password: 'pass1'
Outfile name: 'outFile1.csv'
回答1:
If you want to export a result set from Teradata Studio then you can do that from the "Teradata Result Set Viewer" window. There's an export icon on the top right corner.
If you want to run a SQL script then export the results to a file then you should use ACT rather than ncluster_export
The syntax is -
act -h QueenIPaddress -U user1 -w pass1 -f myscript.sql -o $myhomedir/outFile.csv -F ','
This will pass a SQL script to Aster and redirect the output to the specified file. The -F
parameter specifies the delimiter.
There are other parameters you can use. act --help will list them
回答2:
I can't test it right now, but I don't think you can use a ncluster_export directly within TD Studio, you need to run it on your PC's command line.
Did you install the Aster Client Tools on your PC running TD Studio?
Then it should be (you seem to be on Windows):
- start the command line (cmd) and enter
- cd myhomedir
- ncluster_export --hostname ip_of_asterqueen --username user1 --password pass1 --csv schemaname.tablename outFile1.csv
Regarding running the script, you can't pass the parameters to cluster_export (afaik) in a file, but you can put the commands in a bat-file and then execute this.
来源:https://stackoverflow.com/questions/24499115/teradata-aster-fast-export-ncluster-export-using-query