Skip to main content

A Treasure Data query shell

Project description

Downloads PyPI version

tdq

Treasure Data Query shell

Install

pip install tdq

Features

A wrapper for td-client that focus on SQL query with following features

  • bash-like history-list editing (e.g. Control-P scrolls back to the last command, Control-N forward to the next one, Control-F moves the cursor to the right non-destructively, Control-B moves the cursor to the left non-destructively, etc.).
  • directly execute SQL to the remote TD endpoint
  • support multi-line queries
  • support horizontal, vertical and CSV format ouput

Usage

Start the shell with default configuration

tdq

or start the shell with a specific database

tdq -d sample_database

Exit the shell by quit command or Ctrl-D

See all the command parameters:

tdq --help

Run the shell with predefined sql queries and write the result ot a CSV file

tdq -f input.sql -o output.csv --output-format CSV_HEADER

Besides valid commands, all user's inputs are considered SQL queries.

Currently, below commands are supported:

  • use : change current database. This could be set by -d option or read from default TD client config file
  • display : change current display mode. Value is among horizontal,vertical or None(auto)
  • quit: quit the shell (same with Ctrl-D)

Use -h to see all options

Configuration

tdq will utilize the file ~/.td/td.conf created by td-client for default configuration

For example, a typical td.conf looks like below:

[account]
  apikey = <apikey>
  endpoint = https://api.treasuredata.co.jp/
  database = <default database>

Alternately, apikey and endpoint could be defined by environmental variables TD_API_KEY and TD_SERVER Endpoint also could be defined by -e option from command line.

Other

  • see here for details about Treasure Data Python client

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

tdq-0.1.8-py3-none-any.whl (11.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page