Skip to content

Napas/php-thrift-sql

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP ThriftSQL

The 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 connect().
  • Impala -- Over the Impala Service Thrift interface which extends the Beeswax protocol.

Usage Example

// Load this lib
require_once __DIR__ . '/ThriftSQL.phar';

// Try out a Hive query
$hive = new \ThriftSQL\Hive( 'hive.host.local', 10000, 'user', 'pass' );
$hiveTables = $hive
  ->connect()
  ->queryAndFetchAll( 'SHOW TABLES' );
print_r( $hiveTables );

// Try out an Impala query
$impala = new \ThriftSQL\Impala( 'impala.host.local' );
$impalaTables = $impala
  ->connect()
  ->queryAndFetchAll( 'SHOW TABLES' );
print_r( $impalaTables );

// Don't forget to clear the client and close socket.
$hive->disconnect();
$impala->disconnect();

About

PHP lib for connecting to Hive and Impala over Thrift

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%