Skip to content

Commit 1b0ecb4

Browse files
Merge pull request #2 from jcarouth/fix-postgres-import
Fix broken Postgres support
2 parents 9376533 + c5472ef commit 1b0ecb4

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

README.md

+44-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,48 @@ Define ETL pipelines to extract, transform, and load data from one source to ano
44

55
# Installation
66

7-
composer require ralphschindler/php-etl-pipeliner
7+
composer require ralphschindler/etl-pipeliner
88

9-
#
9+
# Usage
10+
11+
To build an ETL pipeline you need the ETL, an Extractor, a Loader and an Executor.
12+
13+
## ETL object
14+
15+
Implement a class extending `\EtlPipeliner\AbstractEtl`. This package ships with an extractor and a loader for use within Laravel application.
16+
17+
```php
18+
class MyEtlObject extends \EtlPipeline\AbstractEtl
19+
{
20+
public function extractor(): \EtlPipeliner\AbstractExtractor
21+
{
22+
return new \EtlPipeliner\Laravel\DbExtractor(app('db')->connection());
23+
}
24+
25+
public function transform(array $data)
26+
{
27+
return $data;
28+
}
29+
30+
public function loader(): \EtlPipeliner\AbstractLoader
31+
{
32+
return new \EtlPipeliner\Laravel\DbLoader(app('db')->connection());
33+
}
34+
}
35+
```
36+
37+
## Execute the ETL
38+
39+
```php
40+
$executor = new \EtlPipeliner\EtlExecutor();
41+
42+
$executor->execute(new MyEtlObject());
43+
```
44+
45+
# Database support
46+
47+
The Laravel extractor and loader currently support:
48+
49+
- [x] Mysql
50+
- [x] SQL Server
51+
- [x] Postgres

src/Laravel/DbExtractor.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use EtlPipeliner\AbstractExtractor;
66
use Illuminate\Database\Connection;
77
use Illuminate\Database\MySqlConnection;
8+
use Illuminate\Database\PostgresConnection;
89
use Illuminate\Database\SqlServerConnection;
910

1011
class DbExtractor extends AbstractExtractor
@@ -106,7 +107,7 @@ protected function createHashedQuery()
106107
)
107108
);
108109
} else {
109-
throw new \RuntimeException('Currently only MySQL and SqlServer are supported inside the ' . __CLASS__);
110+
throw new \RuntimeException('Currently only MySQL, Postgres, and SqlServer are supported inside the ' . __CLASS__);
110111
}
111112

112113
$hashedQuery = $this->connection->query();

0 commit comments

Comments
 (0)