0
# Core Connector Functions
1
2
Main connector functionality for initializing and running the Mailchimp source connector within the Airbyte framework.
3
4
## Capabilities
5
6
### Source Connector Class
7
8
The primary connector class that extends Airbyte's declarative framework to provide Mailchimp API integration.
9
10
```python { .api }
11
class SourceMailchimp(YamlDeclarativeSource):
12
"""
13
Main source connector for Mailchimp API integration.
14
15
Extends YamlDeclarativeSource to load configuration from manifest.yaml
16
which defines streams, authentication, pagination, and sync modes.
17
"""
18
19
def __init__(self):
20
"""
21
Initialize the connector with manifest.yaml configuration.
22
23
The manifest file defines:
24
- 12 data streams (campaigns, lists, segments, etc.)
25
- Authentication methods (OAuth, API key)
26
- Incremental sync capabilities
27
- Custom data extractors
28
"""
29
```
30
31
### Entry Point Function
32
33
Main entry point that coordinates connector initialization, configuration migration, and execution.
34
35
```python { .api }
36
def run():
37
"""
38
Main entry point for the Mailchimp source connector.
39
40
This function:
41
1. Creates a SourceMailchimp instance
42
2. Runs configuration migration (data center detection)
43
3. Launches the connector using Airbyte CDK framework
44
45
Uses sys.argv for command-line arguments and integrates with
46
Airbyte's standard connector interface (spec, check, discover, read).
47
"""
48
```
49
50
## Usage Examples
51
52
### Creating Connector Instance
53
54
```python
55
from source_mailchimp import SourceMailchimp
56
57
# Create connector instance
58
source = SourceMailchimp()
59
60
# The connector automatically loads its configuration from manifest.yaml
61
# which defines all available streams and their properties
62
```
63
64
### Running Connector
65
66
```python
67
from source_mailchimp.run import run
68
69
# Execute connector with command-line arguments
70
# This handles the full Airbyte connector lifecycle
71
run()
72
```
73
74
### Integration with Airbyte Framework
75
76
```python
77
import sys
78
from airbyte_cdk.entrypoint import launch
79
from source_mailchimp import SourceMailchimp
80
from source_mailchimp.config_migrations import MigrateDataCenter
81
82
# Manual setup (normally handled by run() function)
83
source = SourceMailchimp()
84
MigrateDataCenter.migrate(sys.argv[1:], source)
85
launch(source, sys.argv[1:])
86
```