PHPackages                             keboola/db-extractor-common - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. keboola/db-extractor-common

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

keboola/db-extractor-common
===========================

Common library from Keboola Database Extractors

17.2.3(5mo ago)013.9k↑88.2%[17 issues](https://github.com/keboola/db-extractor-common/issues)MITPHPPHP &gt;=8.2CI failing

Since Feb 11Pushed 5mo ago16 watchersCompare

[ Source](https://github.com/keboola/db-extractor-common)[ Packagist](https://packagist.org/packages/keboola/db-extractor-common)[ RSS](/packages/keboola-db-extractor-common/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (24)Versions (155)Used By (0)

Database Extractor Common \[DBC\]
=================================

[](#database-extractor-common-dbc)

---

Common classes for creating vendor specific database extractors.

Extractors using DBC
--------------------

[](#extractors-using-dbc)

- [MySQL](https://github.com/keboola/db-extractor-mysql)
- [MSSQL](https://github.com/keboola/db-extractor-mssql)
- [PgSQL](https://github.com/keboola/db-extractor-pgsql)
- [Oracle](https://github.com/keboola/db-extractor-oracle) (private repository)
- [Impala](https://github.com/keboola/db-extractor-impala)
- [Firebird](https://github.com/keboola/db-extractor-firebird)
- [DB2](https://github.com/keboola/db-extractor-db2)
- [Redshift](https://github.com/keboola/db-extractor-redshift)
- [Snowflake](https://github.com/keboola/db-extractor-snowflake)

Development and running tests
-----------------------------

[](#development-and-running-tests)

```
docker compose build
docker compose run --rm tests  # runs the tests

```

Usage
-----

[](#usage)

Add the library to your component's composer:

```
php composer.phar require db-extractor-common

```

composer.json

```
{
  "require": "db-extractor-common": ^8.0
}

```

Usage
-----

[](#usage-1)

Create entrypoint script file `run.php` like this one for Mysql extractor:

Note that as of version 7, configuration rows are supported so it is not necessary to support .yml configs or table array configurations.

The $config is loaded from the `config.json` file. You have to provide values for the `data_dir` and `extractor_class` keys. `extractor_class` is the main class of derived extractor, it should extend `Keboola\DbExtractor\Extractor\Extractor`.

You will need to implement the following methods:

- `createConnection(array $params)`
- `testConnection()`
- `simpleQuery(array $table, array $columns = array()): string`
- `getTables(?array $tables = null): array;`

Note that to support identifier sanitation, the getTables method should return a `sanitizedName` property for each column. This `sanitizedName` should be created using `Keboola\php-utils\sanitizeColumnName`

If you want to implement incremental fetching, you must implement
`validateIncrementalFetching(array $table, string $columnName, ?int $limit = null): void`
Please see the sample in the `Common` class:

The namespace of your extractor class shoud be `Keboola\DbExtractor\Extractor` and the name of the class should corespond to DB vendor name i.e. PgSQL, Oracle, Impala, Firebrid, DB2 and so on.

Please check the existing implementations above for help getting started.

Check username
--------------

[](#check-username)

Check username functionality compares - value of the `KBC_REALUSER` environment variable - and username of the database user from the configuration.

If enabled, values must be same to run the component.

If a service account is used, check is skipped. For more information see `UsernameChecker` class.

**Example image / stack parameters**

```
{
  "checkUsername": {
    "enabled": true
  }
}
```

Service account can be defined by regular expression:

```
{
  "checkUsername": {
    "enabled": true,
    "serviceAccountRegexp": "~^service_~i"
  }
}
```

Or user account can be defined by regular expression (inverted logic):

```
{
  "checkUsername": {
    "enabled": true,
    "userAccountRegexp": "~^[0-9]{3}_"
  }
}
```

License
-------

[](#license)

MIT licensed, see [LICENSE](./LICENSE) file.

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance72

Regular maintenance activity

Popularity25

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity94

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~26 days

Recently: every ~104 days

Total

141

Last Release

158d ago

Major Versions

12.2.0 → 13.0.02020-04-23

13.3.0 → 14.0.02020-08-14

14.6.0 → 15.0.02021-12-13

15.0.1 → 16.0.02022-08-05

16.2.2 → 17.0.02024-06-05

PHP version history (5 changes)0.0.1PHP &gt;=5.6

9.0.0PHP &gt;=7.1

13.0.0PHP &gt;=7.4

16.2.0PHP &gt;=8.1

16.2.1PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/101dbf2551a0709ddab522f97669f13a2c4cc2d0a1e8d009f3af6ba80accb1a9?d=identicon)[Keboola](/maintainers/Keboola)

---

Top Contributors

[![pivnicek](https://avatars.githubusercontent.com/u/569139?v=4)](https://github.com/pivnicek "pivnicek (276 commits)")[![ondrajodas](https://avatars.githubusercontent.com/u/12143866?v=4)](https://github.com/ondrajodas "ondrajodas (164 commits)")[![MiroCillik](https://avatars.githubusercontent.com/u/1488015?v=4)](https://github.com/MiroCillik "MiroCillik (99 commits)")[![michaljurecko](https://avatars.githubusercontent.com/u/19371734?v=4)](https://github.com/michaljurecko "michaljurecko (75 commits)")[![AdamVyborny](https://avatars.githubusercontent.com/u/27994036?v=4)](https://github.com/AdamVyborny "AdamVyborny (43 commits)")[![odinuv](https://avatars.githubusercontent.com/u/4319320?v=4)](https://github.com/odinuv "odinuv (32 commits)")[![Actimel](https://avatars.githubusercontent.com/u/4041679?v=4)](https://github.com/Actimel "Actimel (13 commits)")[![romantmb](https://avatars.githubusercontent.com/u/228957?v=4)](https://github.com/romantmb "romantmb (7 commits)")[![tomasfejfar](https://avatars.githubusercontent.com/u/642928?v=4)](https://github.com/tomasfejfar "tomasfejfar (7 commits)")[![ujovlado](https://avatars.githubusercontent.com/u/419849?v=4)](https://github.com/ujovlado "ujovlado (6 commits)")[![Halama](https://avatars.githubusercontent.com/u/903531?v=4)](https://github.com/Halama "Halama (5 commits)")[![kacurez](https://avatars.githubusercontent.com/u/1412120?v=4)](https://github.com/kacurez "kacurez (4 commits)")[![ErikZigo](https://avatars.githubusercontent.com/u/1726727?v=4)](https://github.com/ErikZigo "ErikZigo (2 commits)")[![ondrejhlavacek](https://avatars.githubusercontent.com/u/497675?v=4)](https://github.com/ondrejhlavacek "ondrejhlavacek (1 commits)")[![sykora-ji](https://avatars.githubusercontent.com/u/29491790?v=4)](https://github.com/sykora-ji "sykora-ji (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/keboola-db-extractor-common/health.svg)

```
[![Health](https://phpackages.com/badges/keboola-db-extractor-common/health.svg)](https://phpackages.com/packages/keboola-db-extractor-common)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[keboola/storage-api-client

Keboola Storage API PHP Client

10405.9k40](/packages/keboola-storage-api-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
