https://github.com/ytake/php-presto-client
prestdb client for php
https://github.com/ytake/php-presto-client
facebook php7 prestodb
Last synced: 24 days ago
JSON representation
prestdb client for php
- Host: GitHub
- URL: https://github.com/ytake/php-presto-client
- Owner: ytake
- License: bsd-3-clause
- Created: 2017-06-18T16:38:21.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-03-25T11:01:00.000Z (about 1 year ago)
- Last Synced: 2025-04-14T22:02:38.484Z (about 1 month ago)
- Topics: facebook, php7, prestodb
- Language: PHP
- Size: 33.2 KB
- Stars: 17
- Watchers: 4
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ytake\PrestoClient
[](https://travis-ci.org/ytake/php-presto-client)
[](https://coveralls.io/r/ytake/php-presto-client?branch=master)
[](https://scrutinizer-ci.com/g/ytake/php-presto-client/?branch=master)[](https://packagist.org/packages/ytake/php-presto-client)
[](https://packagist.org/packages/ytake/php-presto-client)
[](https://packagist.org/packages/ytake/php-presto-client)
[](https://styleci.io/repos/94699825)[](https://insight.sensiolabs.com/projects/9a13a5c0-7588-459f-835e-d73dabd22843)
prestodb http protocol client for php
[prestodb](https://prestodb.io/)
## What is Presto
Presto is an open source distributed SQL query engine for running interactive analytic queries against data sources of all sizes ranging from gigabytes to petabytes.
## Install
*required >= PHP 7.0*
```bash
$ composer require ytake/php-presto-client
```## Usage
### Standard
```php
execute();
// next call uri
$client->advance();/** @var \Ytake\PrestoClient\QueryResult $result */
// current result
$result = $client->current();// request cancel
$client->cancelLeafStage();
```### bulk operations
```php
execute()->yieldResults();// array
$result = $resultSession->execute()->getResults();
```## Fetch Styles
### FixData Object
```php
execute()->yieldResults();
/** @var \Ytake\PrestoClient\QueryResult $row */
foreach ($result as $row) {
foreach ($row->yieldData() as $yieldRow) {
if ($yieldRow instanceof \Ytake\PrestoClient\FixData) {
var_dump($yieldRow->offsetGet('column_name'), $yieldRow['column_name']);
}
}
}
```### Array Keys
```php
execute()->yieldResults();
/** @var \Ytake\PrestoClient\QueryResult $row */
foreach ($result as $row) {
/** @var array $item */
foreach ($row->yieldDataArray() as $item) {
if (!is_null($item)) {
var_dump($item);
}
}
}
```### Mapping Class
```php
execute()->yieldResults();
/** @var \Ytake\PrestoClient\QueryResult $row */
foreach ($result as $row) {
foreach($row->yieldObject(Testing::class) as $object) {
if ($object instanceof Testing) {
var_dump($object);
}
}
}
```