Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
%td_job [--pivot] [--plot] [--dry-run] [--verbose]
        [--connection <connection>] [--dropna] [--out <out>]
        [--out-file <out_file>] [--quiet] [--timezone <timezone>]
        job_id

Parameters

  • <job_id> (integer) – Job ID.

  • --pivot (optional) – Run pivot_table against dimensions.

  • --plot (optional) – Plot the query result.

  • -n (--dry_run,) – Output translated code without running query.

  • -v (--verbose,) – Verbose output.

  • <connection>, -c <connection> (--connection) – Use specified connection.

  • d (--dropna,) – Drop columns if all values are NA.

  • <out>, -o <out> (--out) – Store the result to variable.

  • <out_file>, -O <out_file> (--out-file) – Store the result to file.

  • q (--quiet,) – Disable progress output.

  • <timezone>, -T <timezone> (--timezone) – Set timezone to time index.

Returns

Return type

pandas.DataFrame

Examples

Code Block
In [1]: %load_ext pytd.pandas_td.ipython

In [2]: %td_job 451709460  # select * from sample_datasets.nasdaq limit 5
Out[2]:
                    symbol  open  volume     high      low    close
time
1992-08-25 16:00:00   ATRO   0.0    3900   0.7076   0.7076   0.7076
1992-08-25 16:00:00   ALOG   0.0   11200  11.0000  10.6250  11.0000
1992-08-25 16:00:00   ATAX   0.0   11400  11.3750  11.0000  11.0000
1992-08-25 16:00:00   ATRI   0.0    5400  14.3405  14.0070  14.2571
1992-08-25 16:00:00   ABMD   0.0   38800   5.7500   5.2500   5.6875

td_hive

td_hive(line, cell)

Run a Hive query.

Code Block
%%td_hive [<database>] [--pivot] [--plot] [--dry-run] [--verbose]
          [--connection <connection>] [--dropna] [--out <out>]
          [--out-file <out_file>] [--quiet] [--timezone <timezone>]

<query>

Parameters

  • <query> (string) – Hive query.

  • <database> (string, optional) – Database name.

  • --pivot (optional) – Run pivot_table against dimensions.

  • --plot (optional) – Plot the query result.

  • -n (--dry_run,) – Output translated code without running query.

  • -v (--verbose,) – Verbose output.

  • <connection>, -c <connection> (--connection) – Use specified connection.

  • -d (--dropna,) – Drop columns if all values are NA.

  • <out>, -o <out> (--out) – Store the result to variable.

  • <out_file>, -O <out_file> (--out-file) – Store the result to file.

  • -q (--quiet,) – Disable progress output.

  • <timezone>, -T <timezone> (--timezone) – Set timezone to time index.

Returns

Return type

pandas.DataFrame

Examples

Code Block
In [1]: %load_ext pytd.pandas_td.ipython

In [2]: %%td_hive
   ...: select hivemall_version()
   ...:
Out[2]:
                         _c0
0  0.6.0-SNAPSHOT-201901-r01

td_presto

td_presto(line,cell)

Run a Presto query.

Code Block
%%td_presto [<database>] [--pivot] [--plot] [--dry-run] [--verbose]
            [--connection <connection>] [--dropna] [--out <out>]
            [--out-file <out_file>] [--quiet] [--timezone <timezone>]

<query>

Parameters

  • <query> (string) – Presto query.

  • <database> (string, optional) – Database name.

  • --pivot (optional) – Run pivot_table against dimensions.

  • --plot (optional) – Plot the query result.

  • -n (--dry_run,) – Output translated code without running query.

  • -v (--verbose,) – Verbose output.

  • <connection>, -c <connection> (--connection) – Use specified connection.

  • -d (--dropna,) – Drop columns if all values are NA.

  • <out>, -o <out> (--out) – Store the result to variable.

  • <out_file>, -O <out_file> (--out-file) – Store the result to file.

  • -q (--quiet,) – Disable progress output.

  • <timezone>, -T <timezone> (--timezone) – Set timezone to time index.

Returns

Return type

pandas.DataFrame

Examples

Code Block
In [1]: %load_ext pytd.pandas_td.ipython

In [2]: %%td_presto
   ...: select * from sample_datasets.nasdaq limit 5
   ...:
Out[2]:
                    symbol  open  volume     high      low    close
time
1989-01-26 16:00:00   SMTC   0.0    8000   0.4532   0.4532   0.4532
1989-01-26 16:00:00   SEIC   0.0  163200   0.7077   0.6921   0.7025
1989-01-26 16:00:00   SIGI   0.0    2800   3.9610   3.8750   3.9610
1989-01-26 16:00:00   NAVG   0.0    1800  14.6740  14.1738  14.6740
1989-01-26 16:00:00   MOCO   0.0   71101   3.6722   3.5609   3.5980

magics= {'cell': {'td_hive': 'td_hive', 'td_presto': 'td_presto'}, 'line': {'td_job': 'td_job'}}

registered= True