Page tree
Skip to end of metadata
Go to start of metadata

The TD Python Client allows you to run queries that use Hive 2 if you use the following syntax in your Python code:

You can schedule a job with the following Python code:

import tdclient

with tdclient.Client() as td:
    job = td.query(
        "sample_datasets",
        "SELECT COUNT(1) FROM www_access",
        type="hive",
        engine_version="stable",
    )

    job.wait()
    for row in job.result():
        print(repr(row))
import tdclient

with tdclient.Client() as td:
    td.create_schedule(
        "sched-example",
        {
            "type": "hive",
            "engine_version": "stable",
            "query": "select count(1) from www_access",
            "database": "sample_datasets",
            "cron": "0 13 * * *",
        },
    )

It’s recommended not to use engine_version tag at all and leave it to the default (unspecified) which allows TreasureData to switch the underlying engine if needed.

  • No labels