Set of connection adapters for DB extractors.
This library contains a common interface for connecting to and data extracting from, various sources:
- It is intended for use with db-extractor-common.
- It supports PDO and ODBC connections for now.
- The interfaces defined in this library can be easily used to support other methods, e.g. cli BCP tool.
DbConnectionis an abstraction that represents a connection to the database.
QueryResultis an abstraction that represents query result - rows returned from database.
ExportAdapteris an abstraction which defines how the data is to be extracted.
- Based on
ExportResultis generated. The rows are written to the specified CSV file.
- By implementing this interface, it is possible to add support for CLI tools for export.
- Abstract class
BaseExportAdaptercontains common code.
PdoExportAdapterimplements export for PDO connection.
OdbcExportAdapterimplements export for ODBC connection.
FallbackExportAdapterallows you to use multiple adapters. If one fails, then fallback adapter is used.
- Based on
QueryFactoryused to generate SQL query from
ExportConfig. It is used if query is not set in the config.
DefaultQueryFactoryis base implementation for MySQL/MariaDb compatible SQL dialects.
QueryResultCsvWriterused to write rows from the
QueryResultto the specified CSV file.
Clone this repository and init the workspace with following command:
git clone https://github.com/keboola/db-extractor-adapter cd db-extractor-adapter docker-compose build docker-compose run --rm dev composer install --no-scripts
Run the test suite using this command:
docker-compose run --rm dev composer tests
MIT licensed, see LICENSE file.