axm-sysdev / td-client-php
Treasure Data API library for PHP
v2.0.1
2023-11-21 10:26 UTC
Requires
- php: >=8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.0.0
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.5
README
Treasure Data API library for PHP
Requirements
- PHP 8.0+
Installation
composer require axm-sysdev/td-client-php
Usage
<?php require_once 'vendor/autoload.php'; use AXM\TD\Client; use AXM\TD\Job; $client = new Client('YOUR-API-KEY-HERE'); $jobId = $client->query('mydatabase', 'hive', 'SELECT * FROM mytable WHERE value >= 500'); while (true) { $status = $client->jobStatus($jobId); if (Job::isFinished($status)) { break; } sleep(1); } $result = $client->jobResult($jobId);
Query options
$client->hiveQuery($dbName, $query, ['priority' => Job::PRIORITY_VERY_HIGH, 'engine_version' => 'stable']);
Client Options
Use the guzzle option.
Document.
$options['client_config'] = ['timeout' => 1]; $client = new Client('YOUR-API-KEY-HERE', $options);