DB API
tdclient
- tdclient.connect(*args: Any, **kwargs: Any) Connection[source]
Returns a DBAPI compatible connection object
- Parameters:
type (str) – query engine type. “hive” by default.
db (str) – the name of database on Treasure Data
result_url (str) – result output URL
priority (str) – job priority
retry_limit (int) – job retry limit
wait_interval (int) – job wait interval to check status
wait_callback (callable) – a callback to be called on every ticks of job wait
- Returns:
tdclient.connection
- class tdclient.connection.Connection(type: str | None = None, db: str | None = None, result_url: str | None = None, priority: Literal[-2, -1, 0, 1, 2, 'VERY LOW', 'LOW', 'NORMAL', 'HIGH', 'VERY HIGH'] | None = None, retry_limit: int | None = None, wait_interval: int | None = None, wait_callback: Callable[[Cursor], None] | None = None, **kwargs: Any)[source]
Bases:
object
tdclient.cursor
- class tdclient.cursor.Cursor(api: API, wait_interval: int = 5, wait_callback: Callable[[Cursor], None] | None = None, **kwargs: Any)[source]
Bases:
object- fetchall() list[Any][source]
Fetch all (remaining) rows of a query result, returning them as a sequence of sequences (e.g. a list of tuples). Note that the cursor’s arraysize attribute can affect the performance of this operation.
- fetchmany(size: int | None = None) list[Any][source]
Fetch the next set of rows of a query result, returning a sequence of sequences (e.g. a list of tuples). An empty sequence is returned when no more rows are available.
- fetchone() Any | None[source]
Fetch the next row of a query result set, returning a single sequence, or None when no more data is available.
- job_status() str[source]
Show job status
- Returns:
The status information of the given job id at last execution.
- show_job() dict[str, Any][source]
Returns detailed information of a Job
- Returns:
Detailed information of a job
- Return type:
dict
- property description: list[Any]
- property rowcount: int