forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* mixpanel integration * add gcc to build signer tap * fix source * update catalogs * fix registration name * use base classes for source and tests + fix issues with creds and incremental in configured_catalog.json * restore json config file * set default start_date to 1 year ago * format * fix logging of errors in BaseSingerSource
- Loading branch information
1 parent
e1d9c49
commit 1db1e92
Showing
25 changed files
with
664 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...ain/resources/config/STANDARD_SOURCE_DEFINITION/859e501d-2b67-471f-91bb-1c801414d28f.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"sourceDefinitionId": "859e501d-2b67-471f-91bb-1c801414d28f", | ||
"name": "Mixpanel", | ||
"dockerRepository": "airbyte/source-mixpanel-singer", | ||
"dockerImageTag": "0.1.0", | ||
"documentationUrl": "https://hub.docker.com/r/airbyte/source-mixpanel-singer" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
airbyte-integrations/connectors/source-mixpanel-singer/.dockerignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build | ||
.venv |
1 change: 1 addition & 0 deletions
1
airbyte-integrations/connectors/source-mixpanel-singer/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
NEW_SOURCE_CHECKLIST.md |
21 changes: 21 additions & 0 deletions
21
airbyte-integrations/connectors/source-mixpanel-singer/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM airbyte/integration-base-singer:dev | ||
|
||
# Bash is installed for more convenient debugging. | ||
ENV DEBIAN_FRONTEND noninteractive | ||
RUN apt-get update \ | ||
&& apt-get install -y bash \ | ||
&& apt-get install -y gcc \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENV CODE_PATH="source_mixpanel_singer" | ||
ENV AIRBYTE_IMPL_MODULE="source_mixpanel_singer" | ||
ENV AIRBYTE_IMPL_PATH="SourceMixpanelSinger" | ||
|
||
WORKDIR /airbyte/integration_code | ||
COPY $CODE_PATH ./$CODE_PATH | ||
COPY setup.py ./ | ||
|
||
RUN pip install . | ||
|
||
LABEL io.airbyte.version=0.1.0 | ||
LABEL io.airbyte.name=airbyte/source-mixpanel-singer |
28 changes: 28 additions & 0 deletions
28
airbyte-integrations/connectors/source-mixpanel-singer/Dockerfile.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM airbyte/base-python-test:dev | ||
|
||
# Bash is installed for convenient debugging. | ||
ENV DEBIAN_FRONTEND noninteractive | ||
RUN apt-get update \ | ||
&& apt-get install -y bash \ | ||
&& apt-get install -y gcc \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENV MODULE_NAME="source_mixpanel_singer" | ||
ENV CODE_PATH="integration_tests" | ||
ENV AIRBYTE_TEST_MODULE="integration_tests" | ||
ENV AIRBYTE_TEST_PATH="SourceMixpanelSingerStandardTest" | ||
|
||
LABEL io.airbyte.version=0.1.0 | ||
LABEL io.airbyte.name=airbyte/source-mixpanel-singer-standard-test | ||
|
||
WORKDIR /airbyte/integration_code | ||
COPY $MODULE_NAME $MODULE_NAME | ||
COPY $CODE_PATH $CODE_PATH | ||
COPY secrets/* $CODE_PATH/ | ||
COPY $MODULE_NAME/*.json $CODE_PATH/ | ||
COPY sample_files/*.json $CODE_PATH/ | ||
COPY setup.py ./ | ||
|
||
RUN pip install ".[tests]" | ||
|
||
WORKDIR /airbyte |
62 changes: 62 additions & 0 deletions
62
airbyte-integrations/connectors/source-mixpanel-singer/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Source Mixpanel Singer | ||
|
||
This is the repository for the Mixpanel source connector, based on a Singer tap. | ||
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/mixpanel). | ||
|
||
## 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-mixpanel-singer:build | ||
``` | ||
|
||
This will generate a virtualenv for this module in `source-mixpanel-singer/.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-mixpanel # 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](https://docs.airbyte.io/integrations/sources/mixpanel) | ||
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_mixpanel_singer/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-mixpanel-singer-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-mixpanel-singer:airbyteDocker | ||
docker run --rm airbyte/source-mixpanel-singer:dev spec | ||
docker run --rm -v $(pwd)/airbyte-integrations/connectors/source-mixpanel-singer/secrets:/secrets airbyte/source-mixpanel-singer:dev check --config /secrets/config.json | ||
docker run --rm -v $(pwd)/airbyte-integrations/connectors/source-mixpanel-singer/secrets:/secrets airbyte/source-mixpanel-singer:dev discover --config /secrets/config.json | ||
docker run --rm -v $(pwd)/airbyte-integrations/connectors/source-mixpanel-singer/secrets:/secrets -v $(pwd)/airbyte-integrations/connectors/source-mixpanel-singer/sample_files:/sample_files airbyte/source-mixpanel-singer:dev read --config /secrets/config.json --catalog /sample_files/configured_catalog.json | ||
``` | ||
|
||
### Integration Tests | ||
1. From the airbyte project root, run `./gradlew :airbyte-integrations:connectors:source-mixpanel-singer:standardSourceTestPython` to run the standard integration test suite. | ||
1. To run additional integration tests, place your integration tests in the `integration_tests` directory and run them with `pytest integration_tests`. | ||
Make sure to familiarize yourself with [pytest test discovery](https://docs.pytest.org/en/latest/goodpractices.html#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. |
13 changes: 13 additions & 0 deletions
13
airbyte-integrations/connectors/source-mixpanel-singer/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
plugins { | ||
id 'airbyte-python' | ||
id 'airbyte-docker' | ||
id 'airbyte-source-test' | ||
} | ||
|
||
airbytePython { | ||
moduleDirectory 'source_mixpanel_singer' | ||
} | ||
|
||
dependencies { | ||
implementation files(project(':airbyte-integrations:bases:base-singer').airbyteDocker.outputs) | ||
} |
27 changes: 27 additions & 0 deletions
27
airbyte-integrations/connectors/source-mixpanel-singer/integration_tests/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
""" | ||
MIT License | ||
Copyright (c) 2020 Airbyte | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
""" | ||
|
||
from .standard_source_test import SourceMixpanelSingerStandardTest | ||
|
||
__all__ = ["SourceMixpanelSingerStandardTest"] |
29 changes: 29 additions & 0 deletions
29
...-integrations/connectors/source-mixpanel-singer/integration_tests/standard_source_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
""" | ||
MIT License | ||
Copyright (c) 2020 Airbyte | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
""" | ||
|
||
from base_python_test import DefaultStandardSourceTest | ||
|
||
|
||
class SourceMixpanelSingerStandardTest(DefaultStandardSourceTest): | ||
pass |
32 changes: 32 additions & 0 deletions
32
airbyte-integrations/connectors/source-mixpanel-singer/main_dev.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
MIT License | ||
Copyright (c) 2020 Airbyte | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
""" | ||
|
||
import sys | ||
|
||
from base_python.entrypoint import launch | ||
from source_mixpanel_singer import SourceMixpanelSinger | ||
|
||
if __name__ == "__main__": | ||
source = SourceMixpanelSinger() | ||
launch(source, sys.argv[1:]) |
5 changes: 5 additions & 0 deletions
5
airbyte-integrations/connectors/source-mixpanel-singer/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-e ../../bases/airbyte-protocol | ||
-e ../../bases/base-singer | ||
-e ../../bases/base-python | ||
-e ../../bases/base-python-test | ||
-e . |
80 changes: 80 additions & 0 deletions
80
airbyte-integrations/connectors/source-mixpanel-singer/sample_files/catalog.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
"streams": [ | ||
{ | ||
"name": "revenue", | ||
"json_schema": { | ||
"properties": { | ||
"date": { | ||
"format": "date", | ||
"type": [ | ||
"null", | ||
"string" | ||
] | ||
}, | ||
"datetime": { | ||
"format": "date-time", | ||
"type": [ | ||
"null", | ||
"string" | ||
] | ||
}, | ||
"count": { | ||
"type": [ | ||
"null", | ||
"integer" | ||
] | ||
}, | ||
"paid_count": { | ||
"type": [ | ||
"null", | ||
"integer" | ||
] | ||
}, | ||
"amount": { | ||
"multipleOf": 1e-20, | ||
"type": [ | ||
"null", | ||
"number" | ||
] | ||
} | ||
}, | ||
"type": "object", | ||
"additionalProperties": false | ||
}, | ||
}, | ||
{ | ||
"name": "annotations", | ||
"json_schema": { | ||
"properties": { | ||
"date": { | ||
"format": "date-time", | ||
"type": [ | ||
"null", | ||
"string" | ||
] | ||
}, | ||
"project_id": { | ||
"type": [ | ||
"null", | ||
"integer" | ||
] | ||
}, | ||
"id": { | ||
"type": [ | ||
"null", | ||
"integer" | ||
] | ||
}, | ||
"description": { | ||
"type": [ | ||
"null", | ||
"string" | ||
] | ||
} | ||
}, | ||
"type": "object", | ||
"additionalProperties": false | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.