Download the PHP package automattic/php-thrift-sql without Composer
On this page you can find all versions of the php package automattic/php-thrift-sql. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
All versions of php-thrift-sql with dependencies
Informations about the package php-thrift-sql
ThriftSQL.phar archive aims to provide access to SQL-on-Hadoop frameworks for PHP. It bundles Thrift and various service packages together and exposes a common interface for running queries over the various frameworks.
Currently the following engines are supported:
- Hive -- Over the HiveServer2 Thrift interface, SASL is enabled by default so username and password must be provided however this can be turned off with the
setSasl()method before calling
- Impala -- Over the Impala Service Thrift interface which extends the Beeswax protocol.
This library is currently compiled against the Thrift definitions of the following database versions:
Using the compiler and base PHP classes of:
- Apache Thrift
The recommended way to use this library is to get results from Hive/Impala via the memory efficient iterator which will keep the connection open and scroll through the results a couple rows at a time. This allows the processing of large result datasets one record at a time minimizing PHP's memory consumption.
The downside to using the memory efficient iterator is that we can only iterate over the result set once. If a second
foreach is called on the same iterator object an exception is thrown by default to prevent the same query from executing on Hive/Impala again as results are not cached within the PHP client. This can be turned off however be aware iterating over the same iterator object may produce different results as the query is rerun.
Consider the following example:
Which will output something like:
If the result set is small and it would be easier to load all of it into PHP memory the
queryAndFetchAll() method can be used which will return a plain numeric multidimensional array of the full result set.
Developing & Contributing
Once dev tools are installed, make sure you get all git submodules:
And then the phar can be rebuilt using
NOTE: If you get a
BadMethodCallException, it may come from any of the reasons mentioned in the PHP doc, or even a low soft limit on open file descriptors since
Phar::compressfiles keeps all files opened until it writes the compressed phar.