Treasure Data command line tool
This CUI utility wraps the td-client-ruby (github.com/treasure-data/td-client-ruby), the REST API for managing databases and jobs on the Treasure Data Cloud.
For more about Treasure Data, see <treasure-data.com/>.
For full documentation see <docs.treasure-data.com/>.
Getting Started
Install td command as a gem.
> gem install td
See help message for details.
> td
You need to authorize the account, before executing any other commands.
> td account
Sample Workflow
> td account -f # authorize an account
user: [email protected]
password: **********
> td database:create mydb # create a database
> td table:create mydb www_access # create a table
Packaging
Mac OS X
Disable RVM or rbenv and use ruby.pkg’s ruby (/usr/local/td/ruby/bin/ruby). And then run following commands:
$ /usr/local/td/ruby/bin/gem install bundler rubyzip
$ /usr/local/td/ruby/bin/bundle install
$ /usr/local/td/ruby/bin/rake pkg:build
Windows
Install following binary packages:
* MinGW with MSYS Basic System and using mingw-get-inst
* Git for Windows, with Windows Command Prompt support
* Ruby ruby-1.9.3p327 using RubyInstaller for Windows, with PATH update
* Inno Setup 5
Then run following commands on MinGW Shell:
$ mingw-get install msys-vim
$ mingw-get install msys-wget
$ gem install bundler rubyzip
$ bundle install # don't use "--path" option
$ rake exe:build # don't use "bundle exec"
Testing Hooks
The CLI implements several hooks to enable/disable/trigger special behaviors. These hooks are expressed as environment variables and can therefore be provided in several ways:
How to Use
-
Unix / Linux / MacOSX
-
environment variable export in the shell the command is executed. The setting remains active until the shell is closed. E.g.:
$ export TD_TOOLBELT_DEBUG=1
-
in the shell configuration file, to be active in any new shell that is opened. E.g.: add
export TD_TOOLBELT_DEBUG=1
to
~/.bashrc
or equivalent shell configuration file. To make the setting active in the current shell, source the configuration file, e.g.:$ source ~/.bashrc
-
on the command line at runtime (active only for the duration of the command). E.g.:
$ TD_TOOLBELT_DEBUG=1 td ....
-
as alias on in the current shell. The setting remains active until the shell is closed. E.g.:
$ alias td='TD_TOOLBELT_DEBUG=1 td'
-
as alias in configuration file, to be active in any new shell that is opened. E.g.:
alias td='TD_TOOLBELT_DEBUG=1 td'`
to
~/.bashrc
or equivalent shell configuration file. To make the setting active in the current shell, source the configuration file, e.g.:$ source ~/.bashrc
-
-
Windows
-
in the command prompt the command is executed. The setting remains active until the command prompt window is closed. E.g.:
cmd> set TD_TOOLBELT_DEBUG=1
-
as a global environment variable in the system settings. It will be active for all new command prompt windows.
-
These are the available hooks:
-
Enable debugging mode:
$ TD_TOOLBELT_DEBUG=1
-
JAR auto update (enabled by default is not specified). This setting does not affect
import:jar_update
:-
Enable:
$ TD_TOOLBELT_JAR_UPDATE=1
-
Disable:
$ TD_TOOLBELT_JAR_UPDATE=0
-
-
Specify an alternative endpoint to use to update the toolbelt (default: toolbelt.treasuredata.com):
$ TD_TOOLBELT_UPDATE_ROOT="http://toolbelt.treasuredata.com"
Copyright
- Copyright
-
Copyright © 2014 Treasure Data Inc.
- License
-
Apache License, Version 2.0