KBC Docker app for extracting data from IBM Informix database.
See Extractors for SQL Databases for more documentation.
The configuration config.json contains following properties in parameters key:
Note: query or table must be specified.
Note: Parameters db.serverName, db.protocol, db.dbLocale are in addition to other extractors.
db- object (required): Connection settingshost- string (required): IP address or hostname of Apache Hive DB serverserverName- string (required): Informix database server name, read more.protocol- enum (optional): protocolonsoctcporonsocssl, defaultonsoctcp, read more.dbLocale- string (optional): InformixDB_LOCALE, defaulten_US.utf8.port- integer (required): Server port (default port is10000)user- string (required): User with correct access rights#password- string (required): Password for givenuserdatabase- string (required): Database to connect tossh- object (optional): Settings for SSH tunnelenabled- bool (required): Enables SSH tunnelsshHost- string (required): IP address or hostname of SSH serversshPort- integer (optional): SSH server port (default port is22)localPort- integer (required): SSH tunnel local port in Docker container (default33006)user- string (optional): SSH user (default same asdb.user)compression- bool (optional): Enables SSH tunnel compression (defaultfalse)keys- object (optional): SSH keyspublic- string (optional): Public SSH key#private- string (optional): Private SSH key
query- string (optional): SQL query whose output will be extractedtable- object (optional): Table whose will be extractedtableName- string (required)schema- string (required)
columns- array (optional): List of columns to export (default all columns)outputTable- string (required): Name of the output tableincremental- bool (optional): Enables Incremental LoadingincrementalFetchingColumn- string (optional): Name of column for Incremental FetchingincrementalFetchingLimit- integer (optional): Max number of rows fetched per one runprimaryKey- string (optional): Sets primary key to specified column in output tableretries- integer (optional): Number of retries if an error occurred
Full export:
{
"parameters": {
"db": {
"host": "my-informix.com",
"serverName": "informix",
"port": "9088",
"database": "test",
"user": "informix",
"#password": "*****"
},
"outputTable": "output",
"table": {
"tableName": "simple",
"schema": "informix"
}
}
}Custom query:
{
"parameters": {
"db": "...",
"outputTable": "output",
"query": "SELECT name, date, id FROM simple",
"primaryKey": ["id"]
}
}Incremental fetching + load only defined columns:
{
"parameters": {
"db": "...",
"outputTable": "output",
"table": {
"tableName": "incremental",
"schema": "${DEFAULT_SCHEMA}"
},
"columns": ["id", "name", "datetime"],
"incremental": true,
"incrementalFetchingColumn": "datetime"
}
}Create .env file with AWS credentials. They are needed to download the driver from the keboola-drivers bucket.
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
Clone this repository and init the workspace with following command:
git clone https://github.com/keboola/db-extractor-informix
cd db-extractor-informix
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
This repository can be used as a template for any ODBC driver.
All operations are well covered by unit and functional tests.
Database-specific code is delimited and defined in one place -
eg. escaping, SQL generation, DB connection, ...
- Install a new ODBC driver in the
Dockerfile- It can be downloaded from the public sources.
- Or from a private S3 if a driver is not publicly available.
- If you need to use a CDATA driver, you can be inspired by db-extractor-netsuite Dockerfile
- By default, CDATA drivers are licensed for only one computer.
- Container always looks like a different computer for the driver.
- So for CDATA is needed RTK - runtime license key.
- Run
docker-compose buildto build modifiedDockerfile.
- Set up a test database in
docker-compose.yml- Configure
dbservice and modify the environment, eg.DB_USER,DB_HOST... - If it is not possible to run the database in a container, then remove the
dbservice.- And set the environment variables to a test database connection.
- In this case,
docker-compose.ymlcontains only the names of environment variables. - The values are defined in the local environment and in the CI.
- Configure
- Modify
OdbcDsnFactoryclass to create the correct DSN connection string- You may need to modify the configuration definition
OdbcDbNodeandOdbcDatabaseConfigclasses. - In these classes:
- Remove configuration nodes that are not needed.
- Add the new nodes needed to configure the ODBC driver.
- Don't forget to write these changes into
README.md.
- You may need to modify the configuration definition
- Prepare test environment
- Modify
getDbConfigArraymethod inOdbcTestConnectionFactoryto matchOdbcDbNodeanddocker-compose.yml. - Modify SQL in
RemoveAllTablesTrait::removeAllTables.
- Modify
- Test connection
- Everything should be ready for the driver to connect to the database.
- Run
docker-compose run --rm dev ./vendor/bin/phpunit ./tests/phpunit/OdbcDriverTest.php
- Modify the database-specific code in the extractor
- Go through these classes and modify them if needed:
QuoteIdentifierTraitandQuoteTraitOdbcConnection::testConnectionandOdbcQueryFactoryMetadataQueryFactoryandOdbcMetadataProcessorOdbcManifestSerializerandOdbcDataType
- Go through these classes and modify them if needed:
- Modify the database-specific code in the tests
- Go through these classes and modify them if needed:
CreateTableTrait,DefaultSchemaTrait,InsertRowsTraitComplexTableTrait,EscapingTableTrait,IncrementalTableTrait,PkAndFkTablesTrait,SimpleTableTrait
- Go through these classes and modify them if needed:
- Run all tests
- Run
docker-compose run --rm dev composer cia and fix errors found.
- Run
- Setup continuous integration
For information about deployment and integration with KBC, please refer to the deployment section of developers documentation
MIT licensed, see LICENSE file.