Co-authored-by: Eugene Kulak <kulak.eugene@gmail.com> Co-authored-by: Eugene K <34233075+eugene-kulak@users.noreply.github.com>
Drift Source
This is the repository for the Drift source connector, written in Python. For information about how to use this connector within Airbyte, see the documentation.
Local development
Prerequisites
To iterate on this connector, make sure to complete this prerequisites section.
Build & Activate Virtual Environment
First, build the module by running the following from the airbyte project root directory:
./gradlew :airbyte-integrations:connectors:source-drift:build
This will generate a virtualenv for this module in source-drift/.venv. Make sure this venv is active in your
development environment of choice. To activate the venv from the terminal, run:
cd airbyte-integrations/connectors/source-drift # cd into the connector directory
source .venv/bin/activate
If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
Create credentials
If you are a community contributor, follow the instructions in the documentation
to generate the necessary credentials. Then create a file secrets/config.json conforming to the source_drift/spec.json file.
See sample_files/sample_config.json for a sample config file.
If you are an Airbyte core member, copy the credentials in RPass under the secret name source-drift-integration-test-config
and place them into secrets/config.json.
Locally running the connector
python main_dev.py spec
python main_dev.py check --config secrets/config.json
python main_dev.py discover --config secrets/config.json
python main_dev.py read --config secrets/config.json --catalog sample_files/configured_catalog.json
Unit Tests
To run unit tests locally, from the connector directory run:
pytest unit_tests
Locally running the connector docker image
# in airbyte root directory
./gradlew :airbyte-integrations:connectors:source-drift:airbyteDocker
docker run --rm airbyte/source-drift:dev spec
docker run --rm -v $(pwd)/airbyte-integrations/connectors/source-drift/secrets:/secrets airbyte/source-drift:dev check --config /secrets/config.json
docker run --rm -v $(pwd)/airbyte-integrations/connectors/source-drift/secrets:/secrets airbyte/source-drift:dev discover --config /secrets/config.json
docker run --rm -v $(pwd)/airbyte-integrations/connectors/source-drift/secrets:/secrets -v $(pwd)/airbyte-integrations/connectors/source-drift/sample_files:/sample_files airbyte/source-drift:dev read --config /secrets/config.json --catalog /sample_files/configured_catalog.json
Integration Tests
- From the airbyte project root, run
./gradlew :airbyte-integrations:connectors:source-drift:standardSourceTestPythonto run the standard integration test suite. - To run additional integration tests, place your integration tests in the
integration_testsdirectory and run them withpytest integration_tests. Make sure to familiarize yourself with pytest test discovery to know how your test files and methods should be named.
Dependency Management
All of your dependencies should go in setup.py, NOT requirements.txt. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development.
Populating account with the data
The following will create 120 accounts and conversations
export DRIFT_TOKEN=<PUT_YOUR_TOKEN_HERE>
cd airbyte-integrations/connectors/source-drift/source_drift/
python -m client.fixture