datadistillr/drill-sdk-php
Composer 安装命令:
composer require datadistillr/drill-sdk-php
包简介
PHP SDK for programmatically connecting to Apache Drill.
关键字:
README 文档
README
PHP SDK Library for Connecting to Apache Drill.
This library allows you to connect to and query Apache Drill programmatically. It is loosely modeled after PHP's mysql interface, so if you are familiar with that, you already pretty much know how to use the Drill connector.
Installing the Library
This library can be installed using Composer by using the following command:
composer require "datadistillr/drill-sdk-php:^0.7.17"
The current pre-release version is: 0.7.17
Using the Connector
The first step is to make a Drill connection handle. The module uses Drill's RESTful interface, so it will not maintain an open connection like a typical JDBC/ODBC connection would.
$drillHandle = new DrillConnection( 'localhost', 8047 );
You can use the is_active() menthod to verify that your connection is active.
if( $drillHandle->is_active() ) { print( "Connection Active" ); } else { print( "Connection Inactive" ); }
Querying Drill
Now that you've created your Drill connection handle, you can query Drill in a similar fashion as MySQL by calling
the query() method. Once you've called the query() method, you can use one of the fetch() methods to retrieve
the results, in a similar manner as MySQL. Currently, the Drill connector currently has:
fetchAll(): Returns all query results in an associative array.fetchAssoc(): Returns a single query row as an associative array.fetchObject(): Returns a single row as a PHP Object.
You might also find these functions useful:
dataSeek($n): Returns the row at index$nand sets the current row to$n.numEows(): Returns the number of rows returned by the query.fieldCount(): Returns the number of columns returned by the query.
Thus, if you want to execute a query in Drill, you can do so as follows:
$query_result = $drillHandle->query( "SELECT * FROM cp.`employee.json` LIMIT 20" ); while( $row = $query_result->fetch_assoc() ) { print( "Field 1: {$row['field1']}\n" ); print( "Field 2: {$row['field2']}\n" ); }
Interacting with Drill
You can also use the connector to activate/deactivate Drill's storage as well as get information about Drill's plugins.
disablePlugin( $plugin )Disables the given plugin. Returns true if successful, false if not.enablePlugin( $plugin )Enables the given plugin. Returns true if successful, false if not.getAllStoragePlugins()Returns an array of all storage plugins.getDisabledStoragePlugins()Returns an array of all disabled plugins.getEnabledStoragePlugins()Returns an array of all enabled plugins.getStoragePlugins()Returns an associative array of plugins and associated configuration options for all plugins.getStoragePluginInfo( $plugin )Returns an associative array of configuration options for a given plugin.saveStoragePlugin( $plugin_name, $config )Creates or edits a storage plugin. Returns true if successful, throws exception if not.deleteStoragePlugin( $plugin_name )Deletes a storage plugin. Returns true if successful, throws exception if not.
datadistillr/drill-sdk-php 适用场景与选型建议
datadistillr/drill-sdk-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.02k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 12 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「sql」 「views」 「data analysis」 「big data」 「data science」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 datadistillr/drill-sdk-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 datadistillr/drill-sdk-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 datadistillr/drill-sdk-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
The tenancy/tenancy views mutations
The "View Counter" bundle
Store your language lines in the database, yaml or other sources
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Query filtering in your frontend
统计信息
- 总下载量: 1.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2021-12-14