spiritloose / Net-Presto

Presto client library for Perl
https://metacpan.org/release/Net-Presto
Other
3 stars 2 forks source link

NAME

Net::Presto - Presto client library for Perl

SYNOPSIS

use Net::Presto;

my $presto = Net::Presto->new(
    server    => 'localhost:8080',
    catalog   => 'hive',
    schema    => 'mydb',
    user      => 'scott',
    source    => 'myscript',   # defaults to Net::Presto/$VERSION
    time_zone => 'US/Pacific', # optional
    language  => 'English',    # optional
);

# easy to use interfaces
my $rows = $presto->select_all('SELECT * FROM ...');
my $row = $presto->select_row('SELECT * FROM ... LIMIT 1');
my $col = $presto->select_one('SELECT COUNT(1) FROM ...');

$presto->do('CREATE TABLE ...');

# See Net::Presto::Statament for more details of low level interfaces
my $sth = $presto->execute('SELECT * FROM ...');
while (my $rows = $sth->fetch_hashref) {
    for my $row (@$rows) {
        $row->{column_name};
    }
}

DESCRIPTION

Presto is a distributed SQL query engine for big data.

https://prestodb.io/

Net::Presto is a client library for Perl to run queries on Presto.

CONSTRUCTOR

Net::Presto->new(%options) :Net::Presto

Creates and return a new Net::Presto instance with options.

%options might be:

METHODS

$presto->select_all($query) :ArrayRef[HashRef[Str]]

Shortcut for execute and fetchrow_hashref

$presto->select_row($query) :HashRef[Str]

Shortcut for execute and fetchrow_hashref->[0]

$presto->select_one($query) :Str

Shortcut for execute and fetch->[0]

$presto->do($query) :Int

Execute a single statement.

$presto->execute($query) :Net::Presto::Statement

Execute a statement and returns a Net::Presto::Statement object.

LICENSE

Copyright (C) Jiro Nishiguchi.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Jiro Nishiguchi jiro@cpan.org