MySQLBatchFetcher

Extends \PhpDruidIngest\Abstracts\BaseFetcher Implements \PhpDruidIngest\Interfaces\IFetcher

Class MySQLBatchFetcher fetches data from an app MySQL database using a query.

package

PhpDruidIngest\Fetcher

Methods

Fetch data.

fetch() : array|mixed
throws

Response

array|mixed

getMysqli

getMysqli( $host,  $user,  $pass,  $db) : \mysqli

Arguments

$host

$user

$pass

$db

Response

\mysqli

getOutput

getOutput() : \Psr\Log\LoggerInterface

Response

\Psr\Log\LoggerInterface

Bind the start and end ingestion date windows to a query.

prepareQuery(String $query, String $start, String $end) : String

Arguments

$query

String

Query with {STARTDATE} and {ENDDATE} for value substituion

$start

String

ISO Date Time string

$end

String

ISO Date Time string

Response

String

Prepared query string

Process an item in the fetched items array

processRow( $row) : mixed

Arguments

$row

Response

mixed

Set the interval boundaries for this query.

setIntervals(string $intervalStart = "1970-01-01 01:30:00", string $intervalEnd = "3030-01-01 01:30:00") 

Arguments

$intervalStart

string

$intervalEnd

string

Set the MySQL DB credentials for fetching.

setMySqlCredentials( $host,  $user,  $pass,  $db) 

Arguments

$host

$user

$pass

$db

setOutput

setOutput(\Psr\Log\LoggerInterface $output) 

Arguments

$output

\Psr\Log\LoggerInterface

Set the time window for fetching.

setTimeWindow(string $start, string $end) : string

Arguments

$start

string

ISO DateTime for start of ingestion window

$end

string

ISO DateTime for end of ingestion window

Response

string

Properties

MySQL Query Template that is expecting to receive a start and end date as parameters via prepareQuery.

query : string

The parameters are inserted via string replacement: {STARTDATE} and {ENDDATE}

An example template: "SELECT id FROM things WHERE date BETWEEN '{STARTDATE}' AND '{ENDDATE}';"

var

Type(s)

string

intervals

intervals : \DruidFamiliar\Interval

host

host : 

Type(s)

user

user : 

Type(s)

pass

pass : 

Type(s)

db

db : 

Type(s)

output

output : \Psr\Log\LoggerInterface
var

Type(s)

\Psr\Log\LoggerInterface