Skip to content

[source]

SQL Table#

The SQL table extractor iterates over the rows of a relational database table. It works with the PHP Data Objects (PDO) interface to connect to a broad selection of databases such MySQL, PostgreSQL, and Sqlite.

Note

This extractor requires the PDO extension.

Note

The order in which the rows are iterated over is not guaranteed. Use a custom query with ORDER BY statement if ordering matters.

Interfaces: Extractor

Parameters#

# Name Default Type Description
1 connection PDO The PDO connection to the database.
2 table string The name of the table to select from.
3 batch size 256 int The number of rows of the table to load in a single query.

Example#

use Rubix\ML\Extractors\SQLTable;
use PDO;

$connection = new PDO('sqlite:/example.sqlite');

$this->extractor = new SQLTable($connection, 'users', 256);

Additional Methods#

Return the column titles of the data table.

public header() : array