1
0
mirror of synced 2025-12-25 02:09:19 -05:00

Source Chartmogul: Make Connector Compatible with Builder (#38145)

This commit is contained in:
Dhroov Makwana
2024-05-15 20:52:12 +05:30
committed by GitHub
parent 8db8a9613d
commit bce549a9e7
26 changed files with 1907 additions and 604 deletions

View File

@@ -1,38 +0,0 @@
FROM python:3.9.11-alpine3.15 as base
# build and load all requirements
FROM base as builder
WORKDIR /airbyte/integration_code
# upgrade pip to the latest version
RUN apk --no-cache upgrade \
&& pip install --upgrade pip \
&& apk --no-cache add tzdata build-base
COPY setup.py ./
# install necessary packages to a temporary folder
RUN pip install --prefix=/install .
# build a clean environment
FROM base
WORKDIR /airbyte/integration_code
# copy all loaded and built libraries to a pure basic image
COPY --from=builder /install /usr/local
# add default timezone settings
COPY --from=builder /usr/share/zoneinfo/Etc/UTC /etc/localtime
RUN echo "Etc/UTC" > /etc/timezone
# bash is installed for more convenient debugging.
RUN apk --no-cache add bash
# copy payload code only
COPY main.py ./
COPY source_chartmogul ./source_chartmogul
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
LABEL io.airbyte.version=1.0.0
LABEL io.airbyte.name=airbyte/source-chartmogul

View File

@@ -1,81 +1,64 @@
# Chartmogul Source
This is the repository for the Chartmogul source connector, written in Python.
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/chartmogul).
This is the repository for the Chartmogul configuration based source connector.
For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.com/integrations/sources/chartmogul).
## Local development
### Prerequisites
**To iterate on this connector, make sure to complete this prerequisites section.**
* Python (`^3.9`)
* Poetry (`^1.7`) - installation instructions [here](https://python-poetry.org/docs/#installation)
#### Minimum Python version required `= 3.7.0`
#### Build & Activate Virtual Environment and install dependencies
From this connector directory, create a virtual environment:
### Installing the connector
```
python3 -m venv .venv
From this connector directory, run:
```bash
poetry install --with dev
```
This will generate a virtualenv for this module in `.venv/`. Make sure this venv is active in your
development environment of choice. To activate it from the terminal, run:
```
source .venv/bin/activate
pip install -r requirements.txt
pip install '.[tests]'
```
### Create credentials
If you are in an IDE, follow your IDE's instructions to activate the virtualenv.
Note that while we are installing dependencies from `requirements.txt`, you should only edit `setup.py` for your dependencies. `requirements.txt` is
used for editable installs (`pip install -e`) to pull in Python dependencies from the monorepo and will call `setup.py`.
If this is mumbo jumbo to you, don't worry about it, just put your deps in `setup.py` but install using `pip install -r requirements.txt` and everything
should work as you expect.
#### Create credentials
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/chartmogul)
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_chartmogul/spec.json` file.
**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.com/integrations/sources/chartmogul)
to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `src/source_chartmogul/spec.yaml` file.
Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information.
See `integration_tests/sample_config.json` for a sample config file.
See `sample_files/sample_config.json` for a sample config file.
**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source chartmogul test creds`
and place them into `secrets/config.json`.
### Locally running the connector
```
python main.py spec
python main.py check --config secrets/config.json
python main.py discover --config secrets/config.json
python main.py read --config secrets/config.json --catalog integration_tests/configured_catalog.json
poetry run source-chartmogul spec
poetry run source-chartmogul check --config secrets/config.json
poetry run source-chartmogul discover --config secrets/config.json
poetry run source-chartmogul read --config secrets/config.json --catalog integration_tests/configured_catalog.json
```
### Locally running the connector docker image
### Running tests
#### Build
To run tests locally, from the connector directory run:
**Via [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md) (recommended):**
```
poetry run pytest tests
```
### Building the docker image
1. Install [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md)
2. Run the following command to build the docker image:
```bash
airbyte-ci connectors --name=source-chartmogul build
```
An image will be built with the tag `airbyte/source-chartmogul:dev`.
An image will be available on your host with the tag `airbyte/source-chartmogul:dev`.
**Via `docker build`:**
```bash
docker build -t airbyte/source-chartmogul:dev .
```
#### Run
### Running as a docker container
Then run any of the connector commands as follows:
```
docker run --rm airbyte/source-chartmogul:dev spec
docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-chartmogul:dev check --config /secrets/config.json
@@ -83,35 +66,38 @@ docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-chartmogul:dev discove
docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-chartmogul:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json
```
## Testing
### Running our CI test suite
You can run our full test suite locally using [`airbyte-ci`](https://github.com/airbytehq/airbyte/blob/master/airbyte-ci/connectors/pipelines/README.md):
```bash
airbyte-ci connectors --name=source-chartmogul test
```
### Customizing acceptance Tests
Customize `acceptance-test-config.yml` file to configure tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
Customize `acceptance-test-config.yml` file to configure acceptance tests. See [Connector Acceptance Tests](https://docs.airbyte.com/connector-development/testing-connectors/connector-acceptance-tests-reference) for more information.
If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py.
## Dependency Management
### 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.
We split dependencies between two groups, dependencies that are:
All of your dependencies should be managed via Poetry.
To add a new dependency, run:
```bash
poetry add <package-name>
```
- required for your connector to work need to go to `MAIN_REQUIREMENTS` list.
- required for the testing need to go to `TEST_REQUIREMENTS` list
Please commit the changes to `pyproject.toml` and `poetry.lock` files.
### Publishing a new version of the connector
## Publishing a new version of the connector
You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what?
1. Make sure your changes are passing our test suite: `airbyte-ci connectors --name=source-chartmogul test`
2. Bump the connector version in `metadata.yaml`: increment the `dockerImageTag` value. Please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors).
2. Bump the connector version (please follow [semantic versioning for connectors](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#semantic-versioning-for-connectors)):
- bump the `dockerImageTag` value in in `metadata.yaml`
- bump the `version` value in `pyproject.toml`
3. Make sure the `metadata.yaml` content is up to date.
4. Make the connector documentation and its changelog is up to date (`docs/integrations/sources/chartmogul.md`).
4. Make sure the connector documentation and its changelog is up to date (`docs/integrations/sources/chartmogul.md`).
5. Create a Pull Request: use [our PR naming conventions](https://docs.airbyte.com/contributing-to-airbyte/resources/pull-requests-handbook/#pull-request-title-convention).
6. Pat yourself on the back for being an awesome contributor.
7. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master.
8. Once your PR is merged, the new version of the connector will be automatically published to Docker Hub and our connector registry.

View File

@@ -0,0 +1,3 @@
#
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#

View File

@@ -1,3 +1,3 @@
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#

View File

@@ -1,3 +1,3 @@
{"stream":"customers","data":{"id":72038151,"uuid":"cus_e6e6b1e6-72d4-11ec-ac99-47c8cf90d52c","external_id":"cus_0001","name":"Adam Smith","email":"integration-test@airbyte.io","status":"Past Due","customer-since":"2015-11-01T00:00:00+00:00","attributes":{"custom":{},"clearbit":{},"stripe":{},"tags":[]},"data_source_uuid":"ds_2dbe3b80-72d4-11ec-bdef-0f585abe5bf3","data_source_uuids":["ds_2dbe3b80-72d4-11ec-bdef-0f585abe5bf3"],"external_ids":["cus_0001"],"company":"Airbyte","country":"US","state":"CA","city":"San Francisco","zip":"94121","lead_created_at":"2022-01-11T00:00:00.000Z","free_trial_started_at":"2022-01-11T00:00:00.000Z","address":{"country":"United States","state":"California","city":"San Francisco","address_zip":"94121"},"mrr":4100,"arr":49200,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#/customers/72038151-Airbyte","billing-system-type":"Import API","currency":"USD","currency-sign":"$", "owner": null},"emitted_at":1668512244585}
{"stream":"activities","data":{"description":"purchased the Bronze Plan plan with $10.00 discount applied","activity-mrr-movement":4100,"activity-mrr":4100,"activity-arr":49200,"date":"2015-11-01T00:00:00+00:00","type":"new_biz","currency":"USD","subscription-external-id":"sub_0001","plan-external-id":"bb8dcfe0-5505-013a-5d44-263d116b0774","customer-name":"Airbyte","customer-uuid":"cus_e6e6b1e6-72d4-11ec-ac99-47c8cf90d52c","customer-external-id":"cus_0001","billing-connector-uuid":"ds_2dbe3b80-72d4-11ec-bdef-0f585abe5bf3","uuid":"02a72371-72b1-440e-9816-d61435fd2e45"},"emitted_at":1668512245112}
{"stream":"customers","data":{"id":72038151,"uuid":"cus_e6e6b1e6-72d4-11ec-ac99-47c8cf90d52c","external_id":"cus_0001","name":"Adam Smith","email":"integration-test@airbyte.io","status":"Past Due","customer-since":"2015-11-01T00:00:00+00:00","attributes":{"custom":{},"clearbit":{},"stripe":{},"tags":[]},"data_source_uuid":"ds_2dbe3b80-72d4-11ec-bdef-0f585abe5bf3","data_source_uuids":["ds_2dbe3b80-72d4-11ec-bdef-0f585abe5bf3"],"external_ids":["cus_0001"],"company":"Airbyte","country":"US","state":"CA","city":"San Francisco","zip":"94121","lead_created_at":"2022-01-11T00:00:00.000Z","free_trial_started_at":"2022-01-11T00:00:00.000Z","address":{"country":"United States","state":"California","city":"San Francisco","address_zip":"94121"},"mrr":4100,"arr":49200,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#/customers/72038151-Airbyte","billing-system-type":"Import API","currency":"USD","currency-sign":"$","owner": null},"emitted_at":1668512244585}
{"stream":"activities","data":{"description":"purchased the Bronze Plan plan with $10.00 discount applied","activity-mrr-movement":4100,"activity-mrr":4100,"activity-arr":49200,"date":"2015-11-01T00:00:00+00:00","type":"new_biz","currency":"USD","subscription-external-id":"sub_0001","plan-external-id":"bb8dcfe0-5505-013a-5d44-263d116b0774","customer-name":"Airbyte","customer-uuid":"cus_e6e6b1e6-72d4-11ec-ac99-47c8cf90d52c","customer-external-id":"cus_0001","billing-connector-uuid":"ds_2dbe3b80-72d4-11ec-bdef-0f585abe5bf3","uuid":"1f366f3c-39e5-5061-ab9d-c1705ae21188"},"emitted_at":1668512245112}
{"stream":"customer_daily_count","data":{"date":"2022-01-01","customers":1,"percentage-change":0},"emitted_at":1668512245914}

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#
from source_chartmogul.run import run

View File

@@ -5,32 +5,38 @@ data:
allowedHosts:
hosts:
- api.chartmogul.com
registries:
oss:
enabled: true
cloud:
enabled: true
remoteRegistries:
pypi:
enabled: true
packageName: airbyte-source-chartmogul
connectorBuildOptions:
# Please update to the latest version of the connector base image.
# https://hub.docker.com/r/airbyte/python-connector-base
# Please use the full address with sha256 hash to guarantee build reproducibility.
baseImage: docker.io/airbyte/python-connector-base:1.2.0@sha256:c22a9d97464b69d6ef01898edf3f8612dc11614f05a84984451dde195f337db9
connectorSubtype: api
connectorType: source
definitionId: b6604cbd-1b12-4c08-8767-e140d0fb0877
dockerImageTag: 1.0.0
dockerImageTag: 1.0.1
dockerRepository: airbyte/source-chartmogul
githubIssueLabel: source-chartmogul
icon: chartmogul.svg
license: MIT
name: Chartmogul
releaseDate: 2022-01-10
releases:
breakingChanges:
1.0.0:
message: "This version separates the `customer_count` stream into multiple streams (daily, weekly, monthly, quarterly). Users previously using the `customer_count` stream will need to run a reset to enable the new streams and continue syncing."
upgradeDeadline: "2023-11-29"
dockerRepository: airbyte/source-chartmogul
documentationUrl: https://docs.airbyte.com/integrations/sources/chartmogul
githubIssueLabel: source-chartmogul
icon: chartmogul.svg
license: MIT
name: Chartmogul
remoteRegistries:
pypi:
enabled: true
packageName: airbyte-source-chartmogul
registries:
cloud:
enabled: true
oss:
enabled: true
releaseStage: beta
supportLevel: community
documentationUrl: https://docs.airbyte.com/integrations/sources/chartmogul
tags:
- language:python
- cdk:low-code

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
[build-system]
requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
version = "1.0.1"
name = "source-chartmogul"
description = "Source implementation for chartmogul."
authors = [ "Airbyte <contact@airbyte.io>",]
license = "MIT"
readme = "README.md"
documentation = "https://docs.airbyte.com/integrations/sources/chartmogul"
homepage = "https://airbyte.com"
repository = "https://github.com/airbytehq/airbyte"
packages = [ { include = "source_chartmogul" }, {include = "main.py" } ]
[tool.poetry.dependencies]
python = "^3.9,<3.12"
airbyte-cdk = "^0"
[tool.poetry.scripts]
source-chartmogul = "source_chartmogul.run:run"
[tool.poetry.group.dev.dependencies]
requests-mock = "*"
pytest-mock = "*"
pytest = "*"

View File

@@ -1,58 +0,0 @@
{
"streams": [
{
"stream": {
"name": "customers",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "activities",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "customer_count_daily",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "customer_count_weekly",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "customer_count_monthly",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
},
{
"stream": {
"name": "customer_count_quarterly",
"json_schema": {},
"supported_sync_modes": ["full_refresh"]
},
"sync_mode": "full_refresh",
"destination_sync_mode": "overwrite"
}
]
}

View File

@@ -1,46 +0,0 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from setuptools import find_packages, setup
MAIN_REQUIREMENTS = [
"airbyte-cdk",
]
TEST_REQUIREMENTS = [
"pytest~=6.1",
"pytest-mock~=3.6.1",
"requests-mock",
]
setup(
entry_points={
"console_scripts": [
"source-chartmogul=source_chartmogul.run:run",
],
},
name="source_chartmogul",
description="Source implementation for Chartmogul.",
author="Titas Skrebe",
author_email="titas@omnisend.com",
packages=find_packages(),
install_requires=MAIN_REQUIREMENTS,
package_data={
"": [
# Include yaml files in the package (if any)
"*.yml",
"*.yaml",
# Include all json files in the package, up to 4 levels deep
"*.json",
"*/*.json",
"*/*/*.json",
"*/*/*/*.json",
"*/*/*/*/*.json",
]
},
extras_require={
"tests": TEST_REQUIREMENTS,
},
)

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#

View File

@@ -1,132 +1,506 @@
version: "0.51.0"
version: 0.78.1
type: DeclarativeSource
check:
type: CheckStream
stream_names:
- customers
definitions:
entries_selector:
extractor:
field_path: ["entries"]
requester:
url_base: "https://api.chartmogul.com"
http_method: "GET"
streams:
customers:
type: DeclarativeStream
name: customers
primary_key:
- id
retriever:
type: SimpleRetriever
requester:
$ref: "#/definitions/base_requester"
path: /v1/customers
http_method: GET
record_selector:
type: RecordSelector
extractor:
type: DpathExtractor
field_path:
- entries
paginator:
type: DefaultPaginator
page_token_option:
type: RequestOption
inject_into: request_parameter
field_name: page
page_size_option:
type: RequestOption
inject_into: request_parameter
field_name: per_page
pagination_strategy:
type: PageIncrement
start_from_page: 1
page_size: 200
schema_loader:
type: InlineSchemaLoader
schema:
$ref: "#/schemas/customers"
activities:
type: DeclarativeStream
name: activities
primary_key:
- uuid
retriever:
type: SimpleRetriever
requester:
$ref: "#/definitions/base_requester"
path: /v1/activities
http_method: GET
request_parameters:
start-date: "{{ config.start_date }}"
record_selector:
type: RecordSelector
extractor:
type: DpathExtractor
field_path:
- entries
paginator:
type: DefaultPaginator
page_token_option:
type: RequestOption
inject_into: request_parameter
field_name: start-after
page_size_option:
type: RequestOption
inject_into: request_parameter
field_name: per_page
pagination_strategy:
type: CursorPagination
page_size: 200
cursor_value: "{{ response['entries'][-1]['uuid'] }}"
stop_condition: "{{ not response.has_more }}"
schema_loader:
type: InlineSchemaLoader
schema:
$ref: "#/schemas/activities"
customer_daily_count:
type: DeclarativeStream
name: customer_daily_count
primary_key:
- date
retriever:
type: SimpleRetriever
requester:
$ref: "#/definitions/base_requester"
path: /v1/metrics/customer-count
http_method: GET
request_parameters:
start-date: "{{ format_datetime(config['start_date'], '%Y-%m-%d') }}"
end-date: "{{ now_utc().strftime('%Y-%m-%d') }}"
interval: day
record_selector:
type: RecordSelector
extractor:
type: DpathExtractor
field_path:
- entries
schema_loader:
type: InlineSchemaLoader
schema:
$ref: "#/schemas/customer_daily_count"
customer_weekly_count:
type: DeclarativeStream
name: customer_weekly_count
primary_key:
- date
retriever:
type: SimpleRetriever
requester:
$ref: "#/definitions/base_requester"
path: /v1/metrics/customer-count
http_method: GET
request_parameters:
start-date: "{{ format_datetime(config['start_date'], '%Y-%m-%d') }}"
end-date: "{{ now_utc().strftime('%Y-%m-%d') }}"
interval: week
record_selector:
type: RecordSelector
extractor:
type: DpathExtractor
field_path:
- entries
schema_loader:
type: InlineSchemaLoader
schema:
$ref: "#/schemas/customer_weekly_count"
customer_monthly_count:
type: DeclarativeStream
name: customer_monthly_count
primary_key:
- date
retriever:
type: SimpleRetriever
requester:
$ref: "#/definitions/base_requester"
path: /v1/metrics/customer-count
http_method: GET
request_parameters:
start-date: "{{ format_datetime(config['start_date'], '%Y-%m-%d') }}"
end-date: "{{ now_utc().strftime('%Y-%m-%d') }}"
interval: month
record_selector:
type: RecordSelector
extractor:
type: DpathExtractor
field_path:
- entries
schema_loader:
type: InlineSchemaLoader
schema:
$ref: "#/schemas/customer_monthly_count"
customer_quarterly_count:
type: DeclarativeStream
name: customer_quarterly_count
primary_key:
- date
retriever:
type: SimpleRetriever
requester:
$ref: "#/definitions/base_requester"
path: /v1/metrics/customer-count
http_method: GET
request_parameters:
start-date: "{{ format_datetime(config['start_date'], '%Y-%m-%d') }}"
end-date: "{{ now_utc().strftime('%Y-%m-%d') }}"
interval: quarter
record_selector:
type: RecordSelector
extractor:
type: DpathExtractor
field_path:
- entries
schema_loader:
type: InlineSchemaLoader
schema:
$ref: "#/schemas/customer_quarterly_count"
base_requester:
type: HttpRequester
url_base: https://api.chartmogul.com
authenticator:
type: BasicHttpAuthenticator
username: "{{ config['api_key'] }}"
retriever:
record_selector:
$ref: "#/definitions/entries_selector"
requester:
$ref: "#/definitions/requester"
customers_stream:
retriever:
$ref: "#/definitions/retriever"
paginator:
type: DefaultPaginator
pagination_strategy:
type: "PageIncrement"
start_from_page: 1
page_size: 200
page_size_option:
inject_into: request_parameter
field_name: per_page
page_token_option:
type: RequestOption
inject_into: request_parameter
field_name: page
$parameters:
name: "customers"
primary_key: "id"
path: "/v1/customers"
activities_stream:
retriever:
$ref: "#/definitions/retriever"
requester:
$ref: "#/definitions/requester"
request_parameters:
start-date: "{{ config.start_date }}"
paginator:
type: DefaultPaginator
pagination_strategy:
type: "CursorPagination"
cursor_value: "{{ response['entries'][-1]['uuid'] }}"
stop_condition: "{{ not response.has_more }}"
page_size: 200
page_size_option:
inject_into: request_parameter
field_name: per_page
page_token_option:
type: RequestOption
inject_into: request_parameter
field_name: start-after
$parameters:
name: "activities"
primary_key: "uuid"
path: "/v1/activities"
customer_daily_count_stream:
retriever:
$ref: "#/definitions/retriever"
requester:
$ref: "#/definitions/requester"
request_body_data:
start-date: "{{ format_datetime(config['start_date'], '%Y-%m-%d') }}"
end-date: "{{ now_utc().strftime('%Y-%m-%d') }}"
interval: day
$parameters:
name: "customer_daily_count"
primary_key: "date"
path: "/v1/metrics/customer-count"
customer_weekly_count_stream:
retriever:
$ref: "#/definitions/retriever"
requester:
$ref: "#/definitions/requester"
request_body_data:
start-date: "{{ format_datetime(config['start_date'], '%Y-%m-%d') }}"
end-date: "{{ now_utc().strftime('%Y-%m-%d') }}"
interval: week
$parameters:
name: "customer_weekly_count"
primary_key: "date"
path: "/v1/metrics/customer-count"
customer_monthly_count_stream:
retriever:
$ref: "#/definitions/retriever"
requester:
$ref: "#/definitions/requester"
request_body_data:
start-date: "{{ format_datetime(config['start_date'], '%Y-%m-%d') }}"
end-date: "{{ now_utc().strftime('%Y-%m-%d') }}"
interval: month
$parameters:
name: "customer_monthly_count"
primary_key: "date"
path: "/v1/metrics/customer-count"
customer_quarterly_count_stream:
retriever:
$ref: "#/definitions/retriever"
requester:
$ref: "#/definitions/requester"
request_body_data:
start-date: "{{ format_datetime(config['start_date'], '%Y-%m-%d') }}"
end-date: "{{ now_utc().strftime('%Y-%m-%d') }}"
interval: quarter
$parameters:
name: "customer_quarterly_count"
primary_key: "date"
path: "/v1/metrics/customer-count"
password: "{{ config['api_key'] }}"
streams:
- "#/definitions/customers_stream"
- "#/definitions/activities_stream"
- "#/definitions/customer_daily_count_stream"
- "#/definitions/customer_weekly_count_stream"
- "#/definitions/customer_monthly_count_stream"
- "#/definitions/customer_quarterly_count_stream"
- $ref: "#/definitions/streams/customers"
- $ref: "#/definitions/streams/activities"
- $ref: "#/definitions/streams/customer_daily_count"
- $ref: "#/definitions/streams/customer_weekly_count"
- $ref: "#/definitions/streams/customer_monthly_count"
- $ref: "#/definitions/streams/customer_quarterly_count"
check:
stream_names:
- "customers"
spec:
type: Spec
documentation_url: https://docs.airbyte.com/integrations/sources/chartmogul
connection_specification:
type: object
$schema: http://json-schema.org/draft-07/schema#
required:
- api_key
- start_date
properties:
api_key:
type: string
title: API key
description: >-
Your Chartmogul API key. See <a
href="https://help.chartmogul.com/hc/en-us/articles/4407796325906-Creating-and-Managing-API-keys#creating-an-api-key">
the docs </a> for info on how to obtain this.
airbyte_secret: true
order: 0
start_date:
type: string
title: Start date
pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$
description: >-
UTC date and time in the format 2017-01-25T00:00:00Z. When feasible,
any data before this date will not be replicated.
examples:
- "2017-01-25T00:00:00Z"
order: 1
format: date-time
additionalProperties: true
metadata:
autoImportSchema:
customers: false
activities: false
customer_daily_count: false
customer_weekly_count: false
customer_monthly_count: false
customer_quarterly_count: false
schemas:
customers:
type: object
$schema: http://json-schema.org/draft-07/schema#
additionalProperties: true
properties:
address:
type:
- "null"
- object
properties:
address_zip:
type:
- "null"
- string
city:
type:
- "null"
- string
country:
type:
- "null"
- string
state:
type:
- "null"
- string
arr:
type:
- "null"
- integer
attributes:
type:
- "null"
- object
properties:
clearbit:
type:
- "null"
- object
properties: {}
custom:
type:
- "null"
- object
properties: {}
stripe:
type:
- "null"
- object
properties:
brandID:
type:
- "null"
- string
brandName:
type:
- "null"
- string
createdAt:
type:
- "null"
- string
platformName:
type:
- "null"
- string
tags:
type:
- "null"
- array
billing-system-type:
type:
- "null"
- string
billing-system-url:
type:
- "null"
- string
chartmogul-url:
type:
- "null"
- string
city:
type:
- "null"
- string
company:
type:
- "null"
- string
country:
type:
- "null"
- string
currency:
type:
- "null"
- string
currency-sign:
type:
- "null"
- string
customer_since:
type:
- "null"
- string
data_source_uuid:
type:
- "null"
- string
data_source_uuids:
type:
- "null"
- array
email:
type:
- "null"
- string
external_id:
type:
- "null"
- string
external_ids:
type:
- "null"
- array
free_trial_started_at:
type:
- "null"
- string
id:
type:
- integer
lead_created_at:
type:
- "null"
- string
mrr:
type:
- "null"
- integer
name:
type:
- "null"
- string
state:
type:
- "null"
- string
status:
type:
- "null"
- string
uuid:
type:
- string
zip:
type:
- "null"
- string
activities:
"$schema": http://json-schema.org/draft-07/schema#
type: object
additionalProperties: true
properties:
description:
type:
- "null"
- string
activity-mrr-movement:
type:
- "null"
- integer
activity-mrr:
type:
- "null"
- integer
activity-arr:
type:
- "null"
- integer
date:
type:
- "null"
- string
type:
type:
- "null"
- string
currency:
type:
- "null"
- string
subscription-external-id:
type:
- "null"
- string
plan-external-id:
type:
- "null"
- string
customer-name:
type:
- "null"
- string
customer-uuid:
type:
- "null"
- string
customer-external-id:
type:
- "null"
- string
billing-connector-uuid:
type:
- "null"
- string
uuid:
type:
- string
customer_daily_count:
"$schema": http://json-schema.org/draft-07/schema#
type: object
additionalProperties: true
properties:
date:
type:
- string
customers:
type:
- integer
customer_weekly_count:
"$schema": http://json-schema.org/draft-07/schema#
type: object
additionalProperties: true
properties:
date:
type:
- string
customers:
type:
- integer
customer_monthly_count:
"$schema": http://json-schema.org/draft-07/schema#
type: object
additionalProperties: true
properties:
date:
type:
- string
customers:
type:
- integer
customer_quarterly_count:
"$schema": http://json-schema.org/draft-07/schema#
type: object
additionalProperties: true
properties:
date:
type:
- string
customers:
type:
- integer

View File

@@ -1,12 +1,13 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#
import sys
from airbyte_cdk.entrypoint import launch
from source_chartmogul import SourceChartmogul
from .source import SourceChartmogul
def run():

View File

@@ -1,49 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": true,
"properties": {
"description": {
"type": ["null", "string"]
},
"activity-mrr-movement": {
"type": ["null", "integer"]
},
"activity-mrr": {
"type": ["null", "integer"]
},
"activity-arr": {
"type": ["null", "integer"]
},
"date": {
"type": ["null", "string"]
},
"type": {
"type": ["null", "string"]
},
"currency": {
"type": ["null", "string"]
},
"subscription-external-id": {
"type": ["null", "string"]
},
"plan-external-id": {
"type": ["null", "string"]
},
"customer-name": {
"type": ["null", "string"]
},
"customer-uuid": {
"type": ["null", "string"]
},
"customer-external-id": {
"type": ["null", "string"]
},
"billing-connector-uuid": {
"type": ["null", "string"]
},
"uuid": {
"type": ["string"]
}
}
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": true,
"properties": {
"date": {
"type": ["string"]
},
"customers": {
"type": ["integer"]
}
}
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": true,
"properties": {
"date": {
"type": ["string"]
},
"customers": {
"type": ["integer"]
}
}
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": true,
"properties": {
"date": {
"type": ["string"]
},
"customers": {
"type": ["integer"]
}
}
}

View File

@@ -1,13 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": true,
"properties": {
"date": {
"type": ["string"]
},
"customers": {
"type": ["integer"]
}
}
}

View File

@@ -1,128 +0,0 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"id": {
"type": ["integer"]
},
"uuid": {
"type": ["string"]
},
"external_id": {
"type": ["null", "string"]
},
"external_ids": {
"type": ["null", "array"]
},
"data_source_uuid": {
"type": ["null", "string"]
},
"data_source_uuids": {
"type": ["null", "array"]
},
"name": {
"type": ["null", "string"]
},
"company": {
"type": ["null", "string"]
},
"email": {
"type": ["null", "string"]
},
"status": {
"type": ["null", "string"]
},
"lead_created_at": {
"type": ["null", "string"]
},
"free_trial_started_at": {
"type": ["null", "string"]
},
"customer_since": {
"type": ["null", "string"]
},
"city": {
"type": ["null", "string"]
},
"state": {
"type": ["null", "string"]
},
"country": {
"type": ["null", "string"]
},
"zip": {
"type": ["null", "string"]
},
"attributes": {
"type": ["null", "object"],
"properties": {
"tags": {
"type": ["null", "array"]
},
"stripe": {
"type": ["null", "object"],
"properties": {
"brandID": {
"type": ["null", "string"]
},
"brandName": {
"type": ["null", "string"]
},
"createdAt": {
"type": ["null", "string"]
},
"platformName": {
"type": ["null", "string"]
}
}
},
"clearbit": {
"type": ["null", "object"],
"properties": {}
},
"custom": {
"type": ["null", "object"],
"properties": {}
}
}
},
"address": {
"type": ["null", "object"],
"properties": {
"country": {
"type": ["null", "string"]
},
"state": {
"type": ["null", "string"]
},
"city": {
"type": ["null", "string"]
},
"address_zip": {
"type": ["null", "string"]
}
}
},
"mrr": {
"type": ["null", "integer"]
},
"arr": {
"type": ["null", "integer"]
},
"billing-system-url": {
"type": ["null", "string"]
},
"chartmogul-url": {
"type": ["null", "string"]
},
"billing-system-type": {
"type": ["null", "string"]
},
"currency": {
"type": ["null", "string"]
},
"currency-sign": {
"type": ["null", "string"]
}
}
}

View File

@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
# Copyright (c) 2024 Airbyte, Inc., all rights reserved.
#
from airbyte_cdk.sources.declarative.yaml_declarative_source import YamlDeclarativeSource

View File

@@ -1,23 +0,0 @@
documentationUrl: https://docs.airbyte.com/integrations/sources/chartmogul
connectionSpecification:
$schema: http://json-schema.org/draft-07/schema#
title: "Chartmogul Spec"
type: object
required:
- api_key
- start_date
properties:
api_key:
type: string
title: "API key"
description: 'Your Chartmogul API key. See <a href="https://help.chartmogul.com/hc/en-us/articles/4407796325906-Creating-and-Managing-API-keys#creating-an-api-key"> the docs </a> for info on how to obtain this.'
airbyte_secret: true
order: 0
start_date:
type: string
title: "Start date"
pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
description: "UTC date and time in the format 2017-01-25T00:00:00Z. When feasible, any data before this date will not be replicated."
examples: ["2017-01-25T00:00:00Z"]
order: 1
format: date-time

View File

@@ -1,3 +0,0 @@
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#

View File

@@ -61,7 +61,8 @@ The Chartmogul connector should not run into Chartmogul API limitations under no
## Changelog
| Version | Date | Pull Request | Subject |
| :------ | :--------- | :------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------- |
|:--------|:-----------| :------------------------------------------------------- |:---------------------------------------------------------------------------------------------------------------------------------|
| 1.0.1 | 2024-05-14 | [38145](https://github.com/airbytehq/airbyte/pull/38145) | Make connector compatible with builder |
| 1.0.0 | 2023-11-09 | [23075](https://github.com/airbytehq/airbyte/pull/23075) | Refactor CustomerCount stream into CustomerCountDaily, CustomerCountWeekly, CustomerCountMonthly, CustomerCountQuarterly Streams |
| 0.2.1 | 2023-02-15 | [23075](https://github.com/airbytehq/airbyte/pull/23075) | Specified date formatting in specification |
| 0.2.0 | 2022-11-15 | [19276](https://github.com/airbytehq/airbyte/pull/19276) | Migrate connector from Alpha (Python) to Beta (YAML) |